-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: wfs decorator and pp synch and orm mappings (#216)
* feat: wfs decorator and pp synch and orm mappings * fix: lint * fix: lintint in spec
- Loading branch information
Showing
4 changed files
with
160 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.