Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function relation(definition?: Object) {
// Apply relation definition to the model class
return PropertyDecoratorFactory.createDecorator(RELATIONS_KEY, definition, {
decoratorName: '@relation',
});
}
export function embedsOne(definition?: Object) {
const rel = Object.assign({type: RelationType.embedsOne}, definition);
return PropertyDecoratorFactory.createDecorator(RELATIONS_KEY, rel, {
decoratorName: '@embedsOne',
});
}
export function referencesOne(definition?: Object) {
const rel = Object.assign({type: RelationType.referencesOne}, definition);
return PropertyDecoratorFactory.createDecorator(RELATIONS_KEY, rel, {
decoratorName: '@referencesOne',
});
}
export function property(definition?: Partial) {
return PropertyDecoratorFactory.createDecorator(
MODEL_PROPERTIES_KEY,
Object.assign({}, definition),
{decoratorName: '@property'},
);
}
export function referencesMany(definition?: Object) {
const rel = Object.assign({type: RelationType.referencesMany}, definition);
return PropertyDecoratorFactory.createDecorator(RELATIONS_KEY, rel, {
decoratorName: '@referencesMany',
});
}
export function embedsMany(definition?: Object) {
const rel = Object.assign({type: RelationType.embedsMany}, definition);
return PropertyDecoratorFactory.createDecorator(RELATIONS_KEY, rel, {
decoratorName: '@embedsMany',
});
}