curator-group.model.ts 810 B

123456789101112131415161718192021222324252627282930
  1. import { BaseModel, BooleanField, IntField, Model, OneToMany, CustomField, StringField } from 'warthog';
  2. import { Channel } from '../channel/channel.model';
  3. @Model({ api: {} })
  4. export class CuratorGroup extends BaseModel {
  5. @CustomField({
  6. db: { type: 'integer', array: true },
  7. api: { type: 'integer', description: `Curators belonging to this group` },
  8. })
  9. curatorIds!: number[];
  10. @BooleanField({
  11. description: `Is group active or not`,
  12. })
  13. isActive!: boolean;
  14. @OneToMany(() => Channel, (param: Channel) => param.ownerCuratorGroup, {
  15. cascade: ["insert", "update"],
  16. modelName: 'CuratorGroup',
  17. relModelName: 'Channel',
  18. propertyName: 'channels',
  19. })
  20. channels?: Channel[];
  21. constructor(init?: Partial<CuratorGroup>) {
  22. super();
  23. Object.assign(this, init);
  24. }
  25. }