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 528199c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
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: DatasetRecord, rootEl: XmlElement) {
writeKind(record, rootEl)
}

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

0 comments on commit 528199c

Please sign in to comment.