Skip to content

Commit

Permalink
refactor: add writer for reuseType calling existing kind write
Browse files Browse the repository at this point in the history
  • Loading branch information
AlitaBernachot committed Jan 28, 2025
1 parent ea83ce2 commit 7b3d945
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {
writeResourceCreated,
writeResourcePublished,
writeResourceUpdated,
writeReuseType,
writeSpatialRepresentation,
writeStatus,
writeUniqueIdentifier,
Expand Down Expand Up @@ -65,6 +66,7 @@ export class Iso191153Converter extends Iso19139Converter {
this.writers['resourceUpdated'] = writeResourceUpdated
this.writers['resourceCreated'] = writeResourceCreated
this.writers['resourcePublished'] = writeResourcePublished
this.writers['reuseType'] = writeReuseType
this.writers['contacts'] = writeContacts
this.writers['contactsForResource'] = writeContactsForResource
this.writers['ownerOrganization'] = () => undefined // fixme: find a way to store this value properly
Expand Down
4 changes: 4 additions & 0 deletions libs/api/metadata-converter/src/lib/iso19115-3/write-parts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@ export function writeResourcePublished(
appendResourceDate(record.resourcePublished, 'publication')(rootEl)
}

export function writeReuseType(record: CatalogRecord, rootEl: XmlElement) {
writeKind(record, rootEl)
}

export function appendResponsibleParty(
contact: Individual,
defaultLanguage: LanguageCode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ import {
writeResourceIdentifier,
writeResourcePublished,
writeResourceUpdated,
writeReuseType,
writeSecurityConstraints,
writeSpatialExtents,
writeSpatialRepresentation,
Expand Down Expand Up @@ -122,7 +123,7 @@ export class Iso19139Converter extends BaseConverter<string> {
}

protected writers: Record<
Exclude<CatalogRecordKeys, 'reuseType'>,
CatalogRecordKeys,
(record: CatalogRecord, rootEl: XmlElement) => void
> = {
uniqueIdentifier: writeUniqueIdentifier,
Expand All @@ -135,6 +136,7 @@ export class Iso19139Converter extends BaseConverter<string> {
resourceUpdated: writeResourceUpdated,
resourceCreated: writeResourceCreated,
resourcePublished: writeResourcePublished,
reuseType: writeReuseType,
title: writeTitle,
abstract: writeAbstract,
contacts: writeContacts,
Expand Down Expand Up @@ -340,7 +342,7 @@ export class Iso19139Converter extends BaseConverter<string> {

fieldChanged('uniqueIdentifier') &&
this.writers['uniqueIdentifier'](record, rootEl)
fieldChanged('reuseType') && this.writers['kind'](record, rootEl)
fieldChanged('reuseType') && this.writers['reuseType'](record, rootEl)
fieldChanged('kind') && this.writers['kind'](record, rootEl)
fieldChanged('defaultLanguage') &&
this.writers['defaultLanguage'](record, rootEl)
Expand Down
4 changes: 4 additions & 0 deletions libs/api/metadata-converter/src/lib/iso19139/write-parts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1126,6 +1126,10 @@ export function writeResourcePublished(
appendResourceDate(record.resourcePublished, 'publication')(rootEl)
}

export function writeReuseType(record: CatalogRecord, rootEl: XmlElement) {
writeKind(record, rootEl)
}

export function writeSpatialRepresentation(
record: DatasetRecord,
rootEl: XmlElement
Expand Down

0 comments on commit 7b3d945

Please sign in to comment.