Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: wfs decorator and pp synch and orm mappings #216

Merged
merged 3 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading