Files
dpage-api/src/modules/catalogue/entities/catalogue.entity.ts
T
2026-05-18 12:58:42 +03:30

37 lines
1.1 KiB
TypeScript

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;
}