Skip to content

Commit

Permalink
feat(record-type): record type enum in models (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
alebinson authored May 13, 2021
1 parent 97bbb93 commit b2fad6d
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/models/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export * from './common/index';
export * from './layerMetadata/index';
export * from './discreteIngestion/index';
export * from './layerMetadata/pycswLayerCatalogRecord';
export * from './layerMetadata/pycsw3DCatalogRecord';
export * from './pycsw/index';
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ export const TsTypes: Record<string, IDescribeTsType> = {
type: PropertiesTypes.ENUM,
importFromPackage: '@map-colonies/mc-model-types',
},
RECORDTYPE: {
value: 'RecordType',
type: PropertiesTypes.ENUM,
importFromPackage: '@map-colonies/mc-model-types',
},
};
/* eslint-enable @typescript-eslint/naming-convention */
export interface ITsTypesMapping {
Expand Down
3 changes: 3 additions & 0 deletions src/models/layerMetadata/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ export { TsTypes, IDescribeTsType, PropertiesTypes } from './decorators/property
export { IPYCSWMapping } from './decorators/property/csw.decorator';
export { IColumnProps } from './decorators/property/catalogDB.decorator';
export { IOrmCatalog } from '../common/interfaces/ormCatalog.interface';

export * from './pycswLayerCatalogRecord';
export * from './pycsw3DCatalogRecord';
5 changes: 3 additions & 2 deletions src/models/layerMetadata/pycsw3DCatalogRecord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { IPropCatalogDBMapping } from '../common/interfaces/propCatalogDBMapping
import { IOrmCatalog } from '../common/interfaces/ormCatalog.interface';
import { graphql } from '../common/decorators/property/graphql.decorator';
import { graphqlClass } from '../common/decorators/property/classGraphql.decorator';
import { RecordType } from '../pycsw/coreEnums';
import { Link } from './link';
import { catalogDB, getCatalogDBMapping } from './decorators/property/catalogDB.decorator';
import { getTsTypesMapping, TsTypes, tsTypes } from './decorators/property/tsTypes.decorator';
Expand Down Expand Up @@ -187,12 +188,12 @@ export class Pycsw3DCatalogRecord extends LayerMetadata implements IPycswCoreMod
},
})
@tsTypes({
mappingType: TsTypes.STRING,
mappingType: TsTypes.RECORDTYPE,
})
@graphql({
nullable: true,
})
public type?: string = undefined;
public type?: RecordType = RecordType.RECORD_3D;

@catalogDB({
column: {
Expand Down
5 changes: 3 additions & 2 deletions src/models/layerMetadata/pycswLayerCatalogRecord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { IPropCatalogDBMapping } from '../common/interfaces/propCatalogDBMapping
import { IOrmCatalog } from '../common/interfaces/ormCatalog.interface';
import { graphql } from '../common/decorators/property/graphql.decorator';
import { graphqlClass } from '../common/decorators/property/classGraphql.decorator';
import { RecordType } from '../pycsw/coreEnums';
import { Link } from './link';
import { catalogDB, getCatalogDBMapping } from './decorators/property/catalogDB.decorator';
import { getTsTypesMapping, TsTypes, tsTypes } from './decorators/property/tsTypes.decorator';
Expand Down Expand Up @@ -186,12 +187,12 @@ export class PycswLayerCatalogRecord extends LayerMetadata implements IPycswCore
},
})
@tsTypes({
mappingType: TsTypes.STRING,
mappingType: TsTypes.RECORDTYPE,
})
@graphql({
nullable: true,
})
public type?: string = undefined;
public type?: RecordType = RecordType.RECORD_RASTER;

@catalogDB({
column: {
Expand Down
5 changes: 5 additions & 0 deletions src/models/pycsw/coreEnums.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export enum RecordType {
RECORD_RASTER = 'raster',
RECORD_3D = '3d',
RECORD_ALL = 'all',
}
1 change: 1 addition & 0 deletions src/models/pycsw/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './coreEnums';

0 comments on commit b2fad6d

Please sign in to comment.