import { Cascade, Collection, Entity, EntityRepositoryType, Enum, ManyToOne, OneToMany, OneToOne, Opt, Property } from "@mikro-orm/core"; import { BaseEntity } from "../../../common/entities/base.entity"; import { Business } from "src/modules/business/entities/business.entity"; import { CatalogueSize, CatalogueStatus } from "../enums/company-status.enum"; import { CatalogueRepository } from "../repositories/catalogue.repository"; @Entity({ repository: () => CatalogueRepository }) export class Catalogue extends BaseEntity { @Property({ type: "varchar", length: 255}) name!: string; @Property({ type: "varchar", length: 255, nullable: false }) slug!: string; @Property({ type: "json" }) content!: string; @Enum({ items: () => CatalogueStatus, nullable: false }) status!: CatalogueStatus; @Enum({ items: () => CatalogueSize, nullable: false }) size!: CatalogueSize; //----------------------------------- @ManyToOne(() => Business, { deleteRule: "restrict" }) business!: Business; //----------------------------------- [EntityRepositoryType]?: CatalogueRepository; }