import 'reflect-metadata' ; import { RestRegistry } from '../rest-registry' ; import { RestgooseModel } from '../restgoose-model' ; import { Constructor } from '../types' ; export interface PropConfiguration < T extends RestgooseModel > { required ? : boolean ; index ? : boolean ; unique ? : boolean ; default ? : any ; enum ? : string [ ] | object ; validate ? : ( value : any ) => boolean ; } export function prop < T extends RestgooseModel > ( config = { } ) { return ( target , key ) => { const Type = Reflect . getMetadata ( 'design:type' , target , key ) ; RestRegistry . registerProperty ( target . constructor as Constructor < T > , key , Type , config ) ; } ; }