How to use the @loopback/context.PropertyDecoratorFactory.createDecorator function in @loopback/context

To help you get started, we’ve selected a few @loopback/context examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github strongloop / loopback-next / packages / repository / src / relations / relation.decorator.ts View on Github external
export function relation(definition?: Object) {
  // Apply relation definition to the model class
  return PropertyDecoratorFactory.createDecorator(RELATIONS_KEY, definition, {
    decoratorName: '@relation',
  });
}
github strongloop / loopback-next / packages / repository / src / relations / relation.decorator.ts View on Github external
export function embedsOne(definition?: Object) {
  const rel = Object.assign({type: RelationType.embedsOne}, definition);
  return PropertyDecoratorFactory.createDecorator(RELATIONS_KEY, rel, {
    decoratorName: '@embedsOne',
  });
}
github strongloop / loopback-next / packages / repository / src / relations / relation.decorator.ts View on Github external
export function referencesOne(definition?: Object) {
  const rel = Object.assign({type: RelationType.referencesOne}, definition);
  return PropertyDecoratorFactory.createDecorator(RELATIONS_KEY, rel, {
    decoratorName: '@referencesOne',
  });
}
github strongloop / loopback-next / packages / repository / src / decorators / model.decorator.ts View on Github external
export function property(definition?: Partial) {
  return PropertyDecoratorFactory.createDecorator(
    MODEL_PROPERTIES_KEY,
    Object.assign({}, definition),
    {decoratorName: '@property'},
  );
}
github strongloop / loopback-next / packages / repository / src / relations / relation.decorator.ts View on Github external
export function referencesMany(definition?: Object) {
  const rel = Object.assign({type: RelationType.referencesMany}, definition);
  return PropertyDecoratorFactory.createDecorator(RELATIONS_KEY, rel, {
    decoratorName: '@referencesMany',
  });
}
github strongloop / loopback-next / packages / repository / src / relations / relation.decorator.ts View on Github external
export function embedsMany(definition?: Object) {
  const rel = Object.assign({type: RelationType.embedsMany}, definition);
  return PropertyDecoratorFactory.createDecorator(RELATIONS_KEY, rel, {
    decoratorName: '@embedsMany',
  });
}