diff --git a/src/models/layerMetadata/decorators/property/tsTypes.decorator.ts b/src/models/layerMetadata/decorators/property/tsTypes.decorator.ts index b6df5b34..da19f0b6 100644 --- a/src/models/layerMetadata/decorators/property/tsTypes.decorator.ts +++ b/src/models/layerMetadata/decorators/property/tsTypes.decorator.ts @@ -80,11 +80,6 @@ export const TsTypes = { type: PropertiesTypes.ENUM, importFromPackage: '@map-colonies/mc-model-types', }, - UNDULATION_MODEL: { - value: 'UndulationModel', - type: PropertiesTypes.ENUM, - importFromPackage: '@map-colonies/mc-model-types', - }, DATATYPE: { value: 'DataType', type: PropertiesTypes.ENUM, @@ -95,11 +90,6 @@ export const TsTypes = { type: PropertiesTypes.ENUM, importFromPackage: '@map-colonies/mc-model-types', }, - NO_DATA_VALUE: { - value: 'NoDataValue', - type: PropertiesTypes.ENUM, - importFromPackage: '@map-colonies/mc-model-types', - }, FIELDCATEGORY: { value: 'FieldCategory', type: PropertiesTypes.ENUM, diff --git a/src/models/layerMetadata/layerDEMMetadata.ts b/src/models/layerMetadata/layerDEMMetadata.ts index 7fddb36e..aad835cb 100644 --- a/src/models/layerMetadata/layerDEMMetadata.ts +++ b/src/models/layerMetadata/layerDEMMetadata.ts @@ -9,40 +9,76 @@ import { IFieldConfigInfo, IPropFieldConfigInfo, } from '../common/decorators/fieldConfig/fieldConfig.decorator'; -import { DEMDataType, NoDataValue, UndulationModel } from '../pycsw/coreEnums'; +import type { AreaOrPoint, DEMDataType, VerticalType } from '../pycsw/types'; import { IMetadataCommonModel } from './interfaces/metadataCommonModel'; import { getPyCSWMapping, IPYCSWMapping, pycsw } from './decorators/property/csw.decorator'; import { getCatalogDBMapping, ICatalogDBMapping, catalogDB } from './decorators/property/catalogDB.decorator'; import { getTsTypesMapping, tsTypes, TsTypes } from './decorators/property/tsTypes.decorator'; export interface ILayerMetadata { - srsId: string | undefined; - resolutionDegree: number | undefined; - resolutionMeter: number | undefined; - absoluteAccuracyLEP90: number | undefined; - relativeAccuracyLEP90: number | undefined; - layerPolygonParts: GeoJSON | undefined; - productBoundingBox: string | undefined; - heightRangeFrom: number | undefined; - heightRangeTo: number | undefined; - geographicArea: string | undefined; - undulationModel: UndulationModel | undefined; - dataType: DEMDataType | undefined; - noDataValue: NoDataValue | undefined; - imagingSortieAccuracyCEP90: number | undefined; - productStatus: RecordStatus | undefined; - hasTerrain: boolean | undefined; - sourceDateStart: Date | undefined; - sourceDateEnd: Date | undefined; - updateDate: Date | undefined; + acquisitionTimeBeginUTC: Date; + acquisitionTimeEndUTC: Date; + areaOrPoint: AreaOrPoint; + dataType: DEMDataType; + displayPath: string; + ingestionDateUTC: Date; + maxAbsoluteAccuracyLEP90: number | undefined; + maxHorizontalAccuracyCEP90: number | undefined; + maxRelativeAccuracyLEP90: number | undefined; + maxResolutionDegree: number; + maxResolutionMeter: number; + minAbsoluteAccuracyLEP90: number | undefined; + minHorizontalAccuracyCEP90: number | undefined; + minRelativeAccuracyLEP90: number | undefined; + minResolutionDegree: number; + minResolutionMeter: number; + noDataValue: number; + productStatus: RecordStatus; + productSubType: string | undefined; + productVersion: number; + srsId: number; + updateDateUTC: Date; + verticalSrsId: number; + verticalSrsName: string; + verticalType: VerticalType; } export interface IPropPYCSWMapping extends IPYCSWMapping { prop: string; } -export class LayerDemMetadata implements ILayerMetadata, IMetadataCommonModel { +export type DEMProductType = ProductType.DSM | ProductType.DTM; +export type DEMProductTypes = { [K in keyof Pick]: DEMProductType }; +export type DEMMetadataCommonModel = Omit; + +export class LayerDemMetadata implements ILayerMetadata, DEMMetadataCommonModel, DEMProductTypes { //#region COMMON FIELDS + //#region CORE: id + @pycsw({ + profile: 'mc_dem', + xmlElement: 'mc:id', + queryableField: 'mc:id', + pycswField: 'pycsw:Identifier', + }) + @catalogDB({ + column: { + name: 'identifier', + type: 'text', + nullable: false, + primary: true, + }, + }) + @tsTypes({ + mappingType: TsTypes.STRING, + }) + @graphql() + @fieldConfig({ + category: FieldCategory.MAIN, + isAutoGenerated: true, + }) + //#endregion + public id!: string; + //#region COMMON: type @pycsw({ profile: 'mc_dem', @@ -54,7 +90,7 @@ export class LayerDemMetadata implements ILayerMetadata, IMetadataCommonModel { column: { name: 'type', type: 'text', - nullable: true, + nullable: false, }, }) @tsTypes({ @@ -64,7 +100,7 @@ export class LayerDemMetadata implements ILayerMetadata, IMetadataCommonModel { nullable: true, }) //#endregion - public type: RecordType | undefined = RecordType.RECORD_DEM; + public type: RecordType = RecordType.RECORD_DEM; //#region COMMON: classification @pycsw({ @@ -98,7 +134,7 @@ export class LayerDemMetadata implements ILayerMetadata, IMetadataCommonModel { ], }) //#endregion - public classification: string | undefined = undefined; + public classification!: string; //#region COMMON: productName @pycsw({ @@ -111,7 +147,7 @@ export class LayerDemMetadata implements ILayerMetadata, IMetadataCommonModel { column: { name: 'product_name', type: 'text', - nullable: true, + nullable: false, }, }) @tsTypes({ @@ -129,7 +165,7 @@ export class LayerDemMetadata implements ILayerMetadata, IMetadataCommonModel { ], }) //#endregion - public productName: string | undefined = undefined; + public productName!: string; //#region COMMON: description @pycsw({ @@ -160,20 +196,19 @@ export class LayerDemMetadata implements ILayerMetadata, IMetadataCommonModel { //#region COMMON: srsId @pycsw({ profile: 'mc_dem', - xmlElement: 'mc:SRS', - queryableField: 'mc:SRS', + xmlElement: 'mc:srsId', + queryableField: 'mc:srsId', pycswField: 'pycsw:CRS', }) @catalogDB({ column: { - name: 'srs', - type: 'text', + name: 'srs_id', + type: 'number', nullable: false, - default: '4326', }, }) @tsTypes({ - mappingType: TsTypes.STRING, + mappingType: TsTypes.NUMBER, }) @graphql({ nullable: false, @@ -183,13 +218,13 @@ export class LayerDemMetadata implements ILayerMetadata, IMetadataCommonModel { isAutoGenerated: true, }) //#endregion - public srsId: string | undefined = undefined; + public srsId!: number; //#region COMMON: srsName @pycsw({ profile: 'mc_dem', - xmlElement: 'mc:SRSName', - queryableField: 'mc:SRSName', + xmlElement: 'mc:srsName', + queryableField: 'mc:srsName', pycswField: 'pycsw:CRSName', }) @catalogDB({ @@ -197,7 +232,6 @@ export class LayerDemMetadata implements ILayerMetadata, IMetadataCommonModel { name: 'srs_name', type: 'text', nullable: false, - default: 'WGS84GEO', }, }) @tsTypes({ @@ -211,7 +245,7 @@ export class LayerDemMetadata implements ILayerMetadata, IMetadataCommonModel { isAutoGenerated: true, }) //#endregion - public srsName: string | undefined = undefined; + public srsName!: string; //#region COMMON: producerName @pycsw({ @@ -239,19 +273,47 @@ export class LayerDemMetadata implements ILayerMetadata, IMetadataCommonModel { default: 'IDFMU', }) //#endregion - public producerName: string | undefined = undefined; + public producerName = 'IDFMU'; + + //#region DEM: ingestionDateUTC + @pycsw({ + profile: 'mc_dem', + xmlElement: 'mc:ingestionDateUTC', + queryableField: 'mc:ingestionDateUTC', + pycswField: 'pycsw:ingestionDateUTC', + }) + @catalogDB({ + column: { + name: 'ingestion_date_utc', + type: 'timestamp with time zone', + nullable: false, + }, + }) + @tsTypes({ + mappingType: TsTypes.DATE, + }) + @graphql({ + nullable: true, + }) + @fieldConfig({ + category: FieldCategory.MAIN, + isAutoGenerated: true, + }) + //#endregion + public ingestionDateUTC!: Date; - //#region COMMON: updateDate + //#region COMMON: updateDateUTC @pycsw({ profile: 'mc_dem', xmlElement: 'mc:updateDateUTC', queryableField: 'mc:updateDateUTC', - pycswField: 'pycsw:UpdateDate', + pycswField: 'pycsw:updateDateUTC', }) @catalogDB({ column: { - name: 'update_date', - type: 'timestamp without time zone', + name: 'update_date_utc', + type: 'timestamp with time zone', + nullable: false, }, }) @tsTypes({ @@ -265,19 +327,19 @@ export class LayerDemMetadata implements ILayerMetadata, IMetadataCommonModel { isAutoGenerated: true, }) //#endregion - public updateDate: Date | undefined = undefined; + public updateDateUTC!: Date; - //#region COMMON: sourceDateStart + //#region COMMON: acquisitionTimeBeginUTC @pycsw({ profile: 'mc_dem', - xmlElement: 'mc:imagingTimeBeginUTC', - queryableField: 'mc:imagingTimeBeginUTC', + xmlElement: 'mc:acquisitionTimeBeginUTC', + queryableField: 'mc:acquisitionTimeBeginUTC', pycswField: 'pycsw:TempExtent_begin', }) @catalogDB({ column: { - name: 'source_start_date', - type: 'timestamp without time zone', + name: 'acquisition_time_begin_utc', + type: 'timestamp with time zone', nullable: false, }, }) @@ -289,33 +351,33 @@ export class LayerDemMetadata implements ILayerMetadata, IMetadataCommonModel { }) @fieldConfig({ category: FieldCategory.GENERAL, - infoMsgCode: ['info-general-tooltip.required', 'info-field-tooltip.sourceDateStart.max'], + infoMsgCode: ['info-general-tooltip.required', 'info-field-tooltip.acquisitionTimeBeginUTC.max'], validation: [ { errorMsgCode: 'validation-general.required', required: true, }, { - errorMsgCode: 'validation-field.sourceDateStart.max', + errorMsgCode: 'validation-field.acquisitionTimeBeginUTC.max', valueType: 'field', - max: 'sourceDateEnd', + max: 'acquisitionTimeEndUTC', }, ], }) //#endregion - public sourceDateStart: Date | undefined = undefined; + public acquisitionTimeBeginUTC!: Date; - //#region COMMON: sourceDateEnd + //#region COMMON: acquisitionTimeEndUTC @pycsw({ profile: 'mc_dem', - xmlElement: 'mc:imagingTimeEndUTC', - queryableField: 'mc:imagingTimeEndUTC', + xmlElement: 'mc:acquisitionTimeEndUTC', + queryableField: 'mc:acquisitionTimeEndUTC', pycswField: 'pycsw:TempExtent_end', }) @catalogDB({ column: { - name: 'source_end_date', - type: 'timestamp without time zone', + name: 'acquisition_time_end_utc', + type: 'timestamp with time zone', nullable: false, }, }) @@ -336,7 +398,7 @@ export class LayerDemMetadata implements ILayerMetadata, IMetadataCommonModel { ], }) //#endregion - public sourceDateEnd: Date | undefined = undefined; + public acquisitionTimeEndUTC!: Date; //#region COMMON: sensors @pycsw({ @@ -347,8 +409,9 @@ export class LayerDemMetadata implements ILayerMetadata, IMetadataCommonModel { }) @catalogDB({ column: { - name: 'sensor_type', + name: 'sensors', type: 'text', + nullable: false, }, field: { overrideType: TsTypes.STRING, @@ -365,7 +428,7 @@ export class LayerDemMetadata implements ILayerMetadata, IMetadataCommonModel { infoMsgCode: ['info-field-tooltip.sensors.tooltip'], }) //#endregion - public sensors: string[] | undefined = undefined; + public sensors!: string[]; //#region COMMON: region @pycsw({ @@ -378,6 +441,7 @@ export class LayerDemMetadata implements ILayerMetadata, IMetadataCommonModel { column: { name: 'region', type: 'text', + nullable: false, }, field: { overrideType: TsTypes.STRING, @@ -402,7 +466,7 @@ export class LayerDemMetadata implements ILayerMetadata, IMetadataCommonModel { ], }) //#endregion - public region: string[] | undefined = undefined; + public region!: string[]; //#region COMMON: productId @pycsw({ @@ -435,7 +499,7 @@ export class LayerDemMetadata implements ILayerMetadata, IMetadataCommonModel { ], }) //#endregion - public productId: string | undefined = 'UNKNOWN'; + public productId!: string; //#region COMMON: productType @pycsw({ @@ -447,8 +511,9 @@ export class LayerDemMetadata implements ILayerMetadata, IMetadataCommonModel { @catalogDB({ column: { name: 'product_type', - type: 'text', + type: 'product_type', nullable: false, + default: ProductType.DTM, }, }) @tsTypes({ @@ -466,7 +531,70 @@ export class LayerDemMetadata implements ILayerMetadata, IMetadataCommonModel { ], }) //#endregion - public productType: ProductType | undefined = undefined; + public productType: DEMProductType = ProductType.DTM; + + //#region COMMON: productSubType + @pycsw({ + profile: 'mc_dem', + xmlElement: 'mc:productSubType', + queryableField: 'mc:productSubType', + pycswField: 'pycsw:ProductSubType', + }) + @catalogDB({ + column: { + name: 'product_sub_type', + type: 'text', + nullable: true, + }, + }) + @tsTypes({ + mappingType: TsTypes.STRING, + }) + @graphql() + @fieldConfig({ + category: FieldCategory.MAIN, + infoMsgCode: ['info-general-tooltip.required'], + validation: [ + { + errorMsgCode: 'validation-general.required', + required: false, + }, + ], + }) + //#endregion + public productSubType: string | undefined = undefined; + + //#region COMMON: productVersion + @pycsw({ + profile: 'mc_dem', + xmlElement: 'mc:productVersion', + queryableField: 'mc:productVersion', + pycswField: 'pycsw:productVersion', + }) + @catalogDB({ + column: { + name: 'product_version', + type: 'number', + nullable: false, + default: '1', //TODO: the type does not support number + }, + }) + @tsTypes({ + mappingType: TsTypes.NUMBER, + }) + @graphql() + @fieldConfig({ + category: FieldCategory.MAIN, + infoMsgCode: ['info-general-tooltip.required'], + validation: [ + { + errorMsgCode: 'validation-general.required', + required: true, + }, + ], + }) + //#endregion + public productVersion = 1; //#region COMMON: footprint @pycsw({ @@ -503,22 +631,22 @@ export class LayerDemMetadata implements ILayerMetadata, IMetadataCommonModel { ], }) //#endregion - public footprint: GeoJSON | undefined = undefined; + public footprint!: GeoJSON; //#endregion //#region DEM SPECIFIC FIELDS - //#region DEM: absoluteAccuracyLEP90 + //#region DEM: minAbsoluteAccuracyLEP90 @pycsw({ profile: 'mc_dem', - xmlElement: 'mc:absoluteAccuracyLEP90', - queryableField: 'mc:absoluteAccuracyLEP90', - pycswField: 'pycsw:absoluteAccuracyLEP90', + xmlElement: 'mc:minAbsoluteAccuracyLEP90', + queryableField: 'mc:minAbsoluteAccuracyLEP90', + pycswField: 'pycsw:minAbsoluteAccuracyLEP90', }) @catalogDB({ column: { - name: 'absolute_accuracy_lep_90', - type: 'real', - nullable: false, + name: 'min_absolute_accuracy_lep_90', + type: 'numeric', + nullable: true, }, }) @tsTypes({ @@ -533,25 +661,58 @@ export class LayerDemMetadata implements ILayerMetadata, IMetadataCommonModel { validation: [ { errorMsgCode: 'validation-general.required', - required: true, + required: false, }, ], }) //#endregion - public absoluteAccuracyLEP90: number | undefined = undefined; + public minAbsoluteAccuracyLEP90: number | undefined = undefined; - //#region DEM: relativeAccuracyLEP90 + //#region DEM: maxAbsoluteAccuracyLEP90 @pycsw({ profile: 'mc_dem', - xmlElement: 'mc:relativeAccuracyLEP90', - queryableField: 'mc:relativeAccuracyLEP90', - pycswField: 'pycsw:relativeAccuracyLEP90', + xmlElement: 'mc:maxAbsoluteAccuracyLEP90', + queryableField: 'mc:maxAbsoluteAccuracyLEP90', + pycswField: 'pycsw:maxAbsoluteAccuracyLEP90', }) @catalogDB({ column: { - name: 'relative_accuracy_lep_90', - type: 'real', - nullable: false, + name: 'max_absolute_accuracy_lep_90', + type: 'numeric', + nullable: true, + }, + }) + @tsTypes({ + mappingType: TsTypes.NUMBER, + }) + @graphql({ + nullable: false, + }) + @fieldConfig({ + category: FieldCategory.GEO_INFO, + infoMsgCode: ['info-general-tooltip.required'], + validation: [ + { + errorMsgCode: 'validation-general.required', + required: false, + }, + ], + }) + //#endregion + public maxAbsoluteAccuracyLEP90: number | undefined = undefined; + + //#region DEM: minRelativeAccuracyLEP90 + @pycsw({ + profile: 'mc_dem', + xmlElement: 'mc:minRelativeAccuracyLEP90', + queryableField: 'mc:minRelativeAccuracyLEP90', + pycswField: 'pycsw:minRelativeAccuracyLEP90', + }) + @catalogDB({ + column: { + name: 'min_relative_accuracy_lep_90', + type: 'numeric', + nullable: true, }, }) @tsTypes({ @@ -566,24 +727,24 @@ export class LayerDemMetadata implements ILayerMetadata, IMetadataCommonModel { validation: [ { errorMsgCode: 'validation-general.required', - required: true, + required: false, }, ], }) //#endregion - public relativeAccuracyLEP90: number | undefined = undefined; + public minRelativeAccuracyLEP90: number | undefined = undefined; - //#region DEM: resolutionDegree + //#region DEM: maxRelativeAccuracyLEP90 @pycsw({ profile: 'mc_dem', - xmlElement: 'mc:resolutionDeg', - queryableField: 'mc:resolutionDeg', - pycswField: 'pycsw:resolutionDeg', + xmlElement: 'mc:maxRelativeAccuracyLEP90', + queryableField: 'mc:maxRelativeAccuracyLEP90', + pycswField: 'pycsw:maxRelativeAccuracyLEP90', }) @catalogDB({ column: { - name: 'resolution_degree', - type: 'real', + name: 'max_relative_accuracy_lep_90', + type: 'numeric', nullable: true, }, }) @@ -593,25 +754,58 @@ export class LayerDemMetadata implements ILayerMetadata, IMetadataCommonModel { @graphql({ nullable: true, }) + @fieldConfig({ + category: FieldCategory.GEO_INFO, + infoMsgCode: ['info-general-tooltip.required'], + validation: [ + { + errorMsgCode: 'validation-general.required', + required: false, + }, + ], + }) + //#endregion + public maxRelativeAccuracyLEP90: number | undefined = undefined; + + //#region DEM: minResolutionDegree + @pycsw({ + profile: 'mc_dem', + xmlElement: 'mc:minResolutionDegree', + queryableField: 'mc:minResolutionDegree', + pycswField: 'pycsw:minResolutionDegree', + }) + @catalogDB({ + column: { + name: 'min_resolution_degree', + type: 'numeric', + nullable: false, + }, + }) + @tsTypes({ + mappingType: TsTypes.NUMBER, + }) + @graphql({ + nullable: true, + }) @fieldConfig({ category: FieldCategory.MAIN, isAutoGenerated: true, - infoMsgCode: ['info-field-tooltip.resolutionDegree.tooltip'], + infoMsgCode: ['info-field-tooltip.minResolutionDegree.tooltip'], }) //#endregion - public resolutionDegree: number | undefined = undefined; + public minResolutionDegree!: number; - //#region DEM: resolutionMeter + //#region DEM: maxResolutionDegree @pycsw({ profile: 'mc_dem', - xmlElement: 'mc:resolutionMeter', - queryableField: 'mc:resolutionMeter', - pycswField: 'pycsw:resolutionMeter', + xmlElement: 'mc:maxResolutionDegree', + queryableField: 'mc:maxResolutionDegree', + pycswField: 'pycsw:maxResolutionDegree', }) @catalogDB({ column: { - name: 'resolution_meter', - type: 'real', + name: 'max_resolution_degree', + type: 'numeric', nullable: false, }, }) @@ -619,115 +813,112 @@ export class LayerDemMetadata implements ILayerMetadata, IMetadataCommonModel { mappingType: TsTypes.NUMBER, }) @graphql({ - nullable: false, + nullable: true, }) @fieldConfig({ category: FieldCategory.MAIN, isAutoGenerated: true, - infoMsgCode: ['info-field-tooltip.resolutionMeter.tooltip'], + infoMsgCode: ['info-field-tooltip.maxResolutionDegree.tooltip'], }) //#endregion - public resolutionMeter: number | undefined = undefined; + public maxResolutionDegree!: number; - //#region DEM: imagingSortieAccuracyCEP90 + //#region DEM: minResolutionMeter @pycsw({ profile: 'mc_dem', - xmlElement: 'mc:imagingSortieAccuracyCEP90', - queryableField: 'mc:imagingSortieAccuracyCEP90', - pycswField: 'pycsw:imagingSortieAccuracyCEP90', + xmlElement: 'mc:minResolutionMeter', + queryableField: 'mc:minResolutionMeter', + pycswField: 'pycsw:minResolutionMeter', }) @catalogDB({ column: { - name: 'imaging_sortie_accuracy_cep_90', - type: 'real', - nullable: true, + name: 'min_resolution_meter', + type: 'numeric', + nullable: false, }, }) @tsTypes({ mappingType: TsTypes.NUMBER, }) @graphql({ - nullable: true, + nullable: false, }) @fieldConfig({ category: FieldCategory.MAIN, - isFilterable: true, - infoMsgCode: ['info-field-tooltip.imagingSortieAccuracyCEP90.tooltip'], + isAutoGenerated: true, + infoMsgCode: ['info-field-tooltip.minResolutionMeter.tooltip'], }) //#endregion - public imagingSortieAccuracyCEP90: number | undefined = undefined; + public minResolutionMeter!: number; - //#region DEM: layerPolygonParts + //#region DEM: maxResolutionMeter @pycsw({ profile: 'mc_dem', - xmlElement: 'mc:layerPolygonParts', - queryableField: 'mc:layerPolygonParts', - pycswField: 'pycsw:layerPolygonParts', + xmlElement: 'mc:maxResolutionMeter', + queryableField: 'mc:maxResolutionMeter', + pycswField: 'pycsw:maxResolutionMeter', }) @catalogDB({ column: { - name: 'layer_polygon_parts', - type: 'text', - nullable: true, + name: 'max_resolution_meter', + type: 'numeric', + nullable: false, }, }) @tsTypes({ - mappingType: TsTypes.OBJECT, + mappingType: TsTypes.NUMBER, }) @graphql({ - nullable: true, + nullable: false, }) @fieldConfig({ - category: FieldCategory.GEO_INFO, - validation: [ - { - errorMsgCode: 'validation-field.layerPolygonParts.json', - json: true, - }, - ], + category: FieldCategory.MAIN, + isAutoGenerated: true, + infoMsgCode: ['info-field-tooltip.maxResolutionMeter.tooltip'], }) //#endregion - public layerPolygonParts: GeoJSON | undefined = undefined; + public maxResolutionMeter!: number; - //#region DEM: productBoundingBox + //#region DEM: minHorizontalAccuracyCEP90 @pycsw({ profile: 'mc_dem', - xmlElement: 'mc:productBBox', - queryableField: 'mc:productBBox', - pycswField: 'pycsw:productBBox', + xmlElement: 'mc:minHorizontalAccuracyCEP90', + queryableField: 'mc:minHorizontalAccuracyCEP90', + pycswField: 'pycsw:minHorizontalAccuracyCEP90', }) @catalogDB({ column: { - name: 'product_bbox', - type: 'text', + name: 'min_horizontal_accuracy_cep_90', + type: 'numeric', nullable: true, }, }) @tsTypes({ - mappingType: TsTypes.STRING, + mappingType: TsTypes.NUMBER, }) @graphql({ nullable: true, }) @fieldConfig({ - category: FieldCategory.GEO_INFO, - isAutoGenerated: true, + category: FieldCategory.MAIN, + isFilterable: true, + infoMsgCode: ['info-field-tooltip.minHorizontalAccuracyCEP90.tooltip'], }) //#endregion - public productBoundingBox: string | undefined = undefined; + public minHorizontalAccuracyCEP90: number | undefined = undefined; - //#region DEM: heightRangeFrom + //#region DEM: maxHorizontalAccuracyCEP90 @pycsw({ profile: 'mc_dem', - xmlElement: 'mc:heightRangeFrom', - queryableField: 'mc:heightRangeFrom', - pycswField: 'pycsw:heightRangeFrom', + xmlElement: 'mc:maxHorizontalAccuracyCEP90', + queryableField: 'mc:maxHorizontalAccuracyCEP90', + pycswField: 'pycsw:maxHorizontalAccuracyCEP90', }) @catalogDB({ column: { - name: 'height_range_from', - type: 'real', - nullable: false, + name: 'max_horizontal_accuracy_cep_90', + type: 'numeric', + nullable: true, }, }) @tsTypes({ @@ -737,78 +928,95 @@ export class LayerDemMetadata implements ILayerMetadata, IMetadataCommonModel { nullable: true, }) @fieldConfig({ - category: FieldCategory.GEO_INFO, - isAutoGenerated: true, + category: FieldCategory.MAIN, + isFilterable: true, + infoMsgCode: ['info-field-tooltip.maxHorizontalAccuracyCEP90.tooltip'], }) //#endregion - public heightRangeFrom: number | undefined = undefined; + public maxHorizontalAccuracyCEP90: number | undefined = undefined; - //#region DEM: heightRangeTo + //#region DEM: verticalType @pycsw({ profile: 'mc_dem', - xmlElement: 'mc:heightRangeTo', - queryableField: 'mc:heightRangeTo', - pycswField: 'pycsw:heightRangeTo', + xmlElement: 'mc:verticalType', + queryableField: 'mc:verticalType', + pycswField: 'pycsw:verticalType', }) @catalogDB({ column: { - name: 'height_range_to', - type: 'real', + name: 'vertical_type', + type: 'vertical_type', nullable: false, }, }) @tsTypes({ - mappingType: TsTypes.NUMBER, + mappingType: TsTypes.STRING, }) @graphql({ - nullable: true, + nullable: false, }) @fieldConfig({ category: FieldCategory.GEO_INFO, - isAutoGenerated: true, + infoMsgCode: ['info-general-tooltip.required'], + validation: [ + { + errorMsgCode: 'validation-general.required', + required: true, + }, + ], }) //#endregion - public heightRangeTo: number | undefined = undefined; + public verticalType!: VerticalType; - //#region DEM: geographicArea + //#region DEM: verticalSrsId @pycsw({ profile: 'mc_dem', - xmlElement: 'mc:geographicArea', - queryableField: 'mc:geographicArea', - pycswField: 'pycsw:geographicArea', + xmlElement: 'mc:verticalSrsId', + queryableField: 'mc:verticalSrsId', + pycswField: 'pycsw:verticalSrsId', }) @catalogDB({ column: { - name: 'geographic_area', - type: 'text', - nullable: true, + name: 'vertical_srs_id', + type: 'integer', + nullable: false, }, }) @tsTypes({ - mappingType: TsTypes.STRING, + mappingType: TsTypes.NUMBER, }) @graphql({ - nullable: true, + nullable: false, + }) + @fieldConfig({ + category: FieldCategory.GEO_INFO, + infoMsgCode: ['info-general-tooltip.required'], + validation: [ + { + errorMsgCode: 'validation-general.required', + required: true, + }, + ], }) //#endregion - public geographicArea: string | undefined = undefined; + public verticalSrsId!: number; - //#region DEM: undulationModel + //#region DEM: verticalSrsName @pycsw({ profile: 'mc_dem', - xmlElement: 'mc:undulationModel', - queryableField: 'mc:undulationModel', - pycswField: 'pycsw:undulationModel', + xmlElement: 'mc:verticalSrsName', + queryableField: 'mc:verticalSrsName', + pycswField: 'pycsw:verticalSrsName', }) @catalogDB({ column: { - name: 'undulation_model', + name: 'vertical_srs_name', type: 'text', nullable: false, }, }) @tsTypes({ - mappingType: TsTypes.UNDULATION_MODEL, + mappingType: TsTypes.STRING, }) @graphql({ nullable: false, @@ -824,7 +1032,7 @@ export class LayerDemMetadata implements ILayerMetadata, IMetadataCommonModel { ], }) //#endregion - public undulationModel: UndulationModel | undefined = undefined; + public verticalSrsName!: string; //#region DEM: dataType @pycsw({ @@ -836,7 +1044,7 @@ export class LayerDemMetadata implements ILayerMetadata, IMetadataCommonModel { @catalogDB({ column: { name: 'data_type', - type: 'text', + type: 'data_type', nullable: false, }, }) @@ -851,7 +1059,34 @@ export class LayerDemMetadata implements ILayerMetadata, IMetadataCommonModel { isAutoGenerated: true, }) //#endregion - public dataType: DEMDataType | undefined = undefined; + public dataType!: DEMDataType; + + //#region DEM: areaOrPoint + @pycsw({ + profile: 'mc_dem', + xmlElement: 'mc:areaOrPoint', + queryableField: 'mc:areaOrPoint', + pycswField: 'pycsw:areaOrPoint', + }) + @catalogDB({ + column: { + name: 'area_or_point', + type: 'pixel_type', + nullable: false, + }, + }) + @tsTypes({ + mappingType: TsTypes.STRING, + }) + @graphql({ + nullable: false, + }) + @fieldConfig({ + category: FieldCategory.GENERAL, + isAutoGenerated: true, + }) + //#endregion + public areaOrPoint!: AreaOrPoint; //#region DEM: noDataValue @pycsw({ @@ -863,12 +1098,12 @@ export class LayerDemMetadata implements ILayerMetadata, IMetadataCommonModel { @catalogDB({ column: { name: 'no_data_value', - type: 'text', + type: 'numeric', nullable: false, }, }) @tsTypes({ - mappingType: TsTypes.NO_DATA_VALUE, + mappingType: TsTypes.NUMBER, }) @graphql({ nullable: false, @@ -884,7 +1119,7 @@ export class LayerDemMetadata implements ILayerMetadata, IMetadataCommonModel { ], }) //#endregion - public noDataValue: NoDataValue | undefined = undefined; + public noDataValue!: number; //#region DEM: productStatus @pycsw({ @@ -896,7 +1131,7 @@ export class LayerDemMetadata implements ILayerMetadata, IMetadataCommonModel { @catalogDB({ column: { name: 'product_status', - type: 'text', + type: 'product_status', default: RecordStatus.UNPUBLISHED, nullable: false, }, @@ -913,30 +1148,21 @@ export class LayerDemMetadata implements ILayerMetadata, IMetadataCommonModel { isLifecycleEnvolved: true, }) //#endregion - public productStatus: RecordStatus | undefined = RecordStatus.UNPUBLISHED; + public productStatus: RecordStatus = RecordStatus.UNPUBLISHED; - //#region DEM: hasTerrain - @pycsw({ - profile: 'mc_dem', - xmlElement: 'mc:hasTerrain', - queryableField: 'mc:hasTerrain', - pycswField: 'pycsw:hasTerrain', - }) + //#region DEM: dispalyPath @catalogDB({ column: { - name: 'has_terrain', - type: 'boolean', + name: 'display_path', + type: 'text', nullable: false, }, }) @tsTypes({ - mappingType: TsTypes.BOOLEAN, - }) - @graphql({ - nullable: true, + mappingType: TsTypes.STRING, }) //#endregion - public hasTerrain: boolean | undefined = false; + public displayPath!: string; //#endregion public static getPyCSWMapping(prop: string): IPYCSWMapping | undefined { diff --git a/src/models/layerMetadata/pycswDEMCatalogRecord.ts b/src/models/layerMetadata/pycswDEMCatalogRecord.ts index 1d1b0745..751ab98a 100644 --- a/src/models/layerMetadata/pycswDEMCatalogRecord.ts +++ b/src/models/layerMetadata/pycswDEMCatalogRecord.ts @@ -19,107 +19,88 @@ import { IPropSHPMapping } from './decorators/property/shp.decorator'; }) @graphqlClass({ alias: 'LayerDemRecord' }) export class PycswDemCatalogRecord extends LayerDemMetadata implements IPycswCoreModel, IOrmCatalog { - //#region CORE: id - @pycsw({ - profile: 'mc_dem', - xmlElement: 'mc:id', - queryableField: 'mc:id', - pycswField: 'pycsw:Identifier', - }) - @catalogDB({ - column: { - name: 'identifier', - type: 'text', - nullable: false, - }, - }) - @tsTypes({ - mappingType: TsTypes.STRING, - }) - @graphql() - @fieldConfig({ - category: FieldCategory.MAIN, - isAutoGenerated: true, - }) - //#endregion - public id: string | undefined = 'UNKNOWN'; - //#region CORE: typename @catalogDB({ column: { name: 'typename', type: 'text', + nullable: false, }, }) @tsTypes({ mappingType: TsTypes.STRING, }) //#endregion - public typeName: string | undefined = 'mc:MCDEMRecord'; + public typeName = 'mc:MCDEMRecord'; //#region CORE: schema @catalogDB({ column: { name: 'schema', type: 'text', + nullable: false, }, }) @tsTypes({ mappingType: TsTypes.STRING, }) //#endregion - public schema: string | undefined = 'mc_dem'; + public schema = 'mc_dem'; //#region CORE: mdsource @catalogDB({ column: { name: 'mdsource', type: 'text', + nullable: false, }, }) @tsTypes({ mappingType: TsTypes.STRING, }) //#endregion - public mdSource: string | undefined = undefined; + public mdSource!: string; //#region CORE: xml @catalogDB({ column: { name: 'xml', - type: 'text', + type: 'character varying', + nullable: false, }, }) @tsTypes({ mappingType: TsTypes.STRING, }) //#endregion - public xml: string | undefined = undefined; + public xml!: string; //#region CORE: anyText @catalogDB({ column: { name: 'anytext', type: 'text', + nullable: false, }, }) @tsTypes({ mappingType: TsTypes.STRING, }) //#endregion - public anyText: string | undefined = undefined; + public anyText!: string; //#region CORE: insertDate @pycsw({ profile: 'mc_dem', - xmlElement: 'mc:insertDate', - queryableField: 'mc:insertDate', + xmlElement: 'mc:insertDateUTC', + queryableField: 'mc:insertDateUTC', pycswField: 'pycsw:InsertDate', }) @catalogDB({ column: { - name: 'insert_date', - type: 'timestamp without time zone', + name: 'insert_date_utc', + type: 'timestamp with time zone', + nullable: false, }, }) @tsTypes({ @@ -133,7 +114,7 @@ export class PycswDemCatalogRecord extends LayerDemMetadata implements IPycswCor isAutoGenerated: true, }) //#endregion - public insertDate: Date | undefined = undefined; + public insertDate!: Date; //#region CORE: wktGeometry @pycsw({ @@ -188,6 +169,7 @@ export class PycswDemCatalogRecord extends LayerDemMetadata implements IPycswCor column: { name: 'keywords', type: 'text', + nullable: true, }, }) @tsTypes({ @@ -228,7 +210,7 @@ export class PycswDemCatalogRecord extends LayerDemMetadata implements IPycswCor column: { name: 'links', type: 'text', - nullable: true, + nullable: false, }, field: { overrideType: TsTypes.STRING, @@ -246,7 +228,7 @@ export class PycswDemCatalogRecord extends LayerDemMetadata implements IPycswCor isAutoGenerated: true, }) //#endregion - public links: Link[] | undefined = undefined; + public links!: Link[]; public constructor() { // eslint-disable-next-line diff --git a/src/models/pycsw/constants.ts b/src/models/pycsw/constants.ts new file mode 100644 index 00000000..5562a943 --- /dev/null +++ b/src/models/pycsw/constants.ts @@ -0,0 +1,4 @@ +// TODO: import directly from dem-shared and remove this file +export const areaOrPoint = ['Area', 'Point'] as const; +export const demDataType = ['Int8', 'Int16', 'Int32', 'Int64', 'Float16', 'Float32', 'Float64'] as const; +export const verticalType = ['Orthometric', 'Ellipsoidal'] as const; diff --git a/src/models/pycsw/coreEnums.ts b/src/models/pycsw/coreEnums.ts index f19cdceb..33824f7d 100644 --- a/src/models/pycsw/coreEnums.ts +++ b/src/models/pycsw/coreEnums.ts @@ -1,6 +1,4 @@ /* eslint-disable @typescript-eslint/prefer-literal-enum-member, @typescript-eslint/no-magic-numbers */ -import { DataType } from '@map-colonies/mc-utils'; - export { RecordType } from '@map-colonies/types'; export enum Units { @@ -10,22 +8,3 @@ export enum Units { ARC_SECONDS = 'ARC_SECONDS', UNKNOWN = 'UNKNOWN', } - -export enum UndulationModel { - MSL_EGM96 = 'MSL EGM96', - MSL_EGM2008 = 'MSL EGM2008', - MSL_DMA10 = 'MSL DMA10', - ILUM = 'ILUM', -} - -export enum DEMDataType { - INT16 = DataType.INT16, - FLOAT32 = DataType.FLOAT32, - FLOAT64 = DataType.FLOAT64, -} - -export enum NoDataValue { - NO_DATA_32768 = '-32768', - NO_DATA_32767 = '-32767', - NO_DATA_999 = '-999', -} diff --git a/src/models/pycsw/types.ts b/src/models/pycsw/types.ts new file mode 100644 index 00000000..be6b6362 --- /dev/null +++ b/src/models/pycsw/types.ts @@ -0,0 +1,6 @@ +import { areaOrPoint, demDataType, verticalType } from './constants'; + +// TODO: import directly from dem-shared and remove this file +export type AreaOrPoint = (typeof areaOrPoint)[number]; +export type DEMDataType = (typeof demDataType)[number]; +export type VerticalType = (typeof verticalType)[number];