A Model field decorator.
Model with a one-to-many association:
import { HasMany, Model } from '@sgrud/data';
import { OwnedModel } from './owned-model';
export class ExampleModel extends Model<ExampleModel> {
@HasMany(() => OwnedModel)
public field?: OwnedModel[];
protected [Symbol.toStringTag]: string = 'ExampleModel';
}
Generated using TypeDoc
Model field decorator factory. Using this decorator, Models can be enriched with one-to-many associations to other Models. The value for the
typeFactoryargument has to be another Model. By applying this decorator, the decorated field will (depending on thetransientargument value) be taken into account when serializing or treemapping the Model containing the decorated field.