Skip to content

Commit

Permalink
feat: wfs decorator and pp synch and orm mappings (#216)
Browse files Browse the repository at this point in the history
* feat: wfs decorator and pp synch and  orm mappings

* fix: lint

* fix: lintint in spec
  • Loading branch information
alebinson authored Oct 21, 2024
1 parent 92a8310 commit e515e1f
Show file tree
Hide file tree
Showing 4 changed files with 160 additions and 30 deletions.
36 changes: 36 additions & 0 deletions src/models/common/decorators/wfs/wfs.decorator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import 'reflect-metadata';

const wfsMetadataKey = Symbol('wfsmapping');

// eslint-disable-next-line @typescript-eslint/naming-convention
export enum JAVA_BINDINGS {
UUID = 'java.util.UUID',
STRING = 'java.lang.String',
TIMESTAMP = 'java.sql.Timestamp',
FLOAT = 'java.lang.Float',
BIGDECIMAL = 'java.math.BigDecimal',
POLYGON = 'org.locationtech.jts.geom.Polygon',
}

export interface IWFSMapping {
binding: JAVA_BINDINGS; // java type 'java.util.UUID'
name?: string; // property name that will be exposed by WFS service
minOccurs?: number;
maxOccurs?: number;
}

export interface IPropWFSMapping extends IWFSMapping {
prop: string; // prop name for convinience
source: string; // DB column name. IMPORTANT: Will be derived from catalogDB decorator metadata
nillable: boolean; // is nullable by DB definitions
}

export function wfs(wfsmapping?: IWFSMapping): PropertyDecorator {
return Reflect.metadata(wfsMetadataKey, wfsmapping);
}

export function getWFSMapping<T>(target: T, propertyKey: string): IWFSMapping | undefined {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
//@ts-ignore
return Reflect.getMetadata(wfsMetadataKey, target, propertyKey) as IWFSMapping;
}
1 change: 1 addition & 0 deletions src/models/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ export * from './interfaces/ormCatalog.interface';
export * from './interfaces/propCatalogDBMapping.interface';
export * from './interfaces/propGraphQLMapping.interface';
export * from './decorators/fieldConfig/fieldConfig.decorator';
export * from './decorators/wfs/wfs.decorator';
Loading

0 comments on commit e515e1f

Please sign in to comment.