class-entity.model.ts 816 B

1234567891011121314151617181920212223242526272829
  1. import { BaseModel, IntField, Model, ManyToOne, StringField } from 'warthog';
  2. import { Block } from '../block/block.model';
  3. @Model({
  4. api: {
  5. description: `This type is to keep which entity belongs to which class. This type will be used
  6. by EntityCreated event. When a new schema support added to an Entity we will get the
  7. class name from this table.
  8. We need this because we can't create a database row (Channel, Video etc) without
  9. with empty fields.`,
  10. },
  11. })
  12. export class ClassEntity extends BaseModel {
  13. @IntField({
  14. description: `The class id of this entity`,
  15. })
  16. classId!: number;
  17. @ManyToOne(() => Block, (param: Block) => param.classEntitys, {
  18. skipGraphQLField: true,
  19. })
  20. happenedIn!: Block;
  21. constructor(init?: Partial<ClassEntity>) {
  22. super();
  23. Object.assign(this, init);
  24. }
  25. }