import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany } from "typeorm"; import { EntityBase } from "./base/Base"; import { OrgRoot } from "./OrgRoot"; import { PosMaster } from "./PosMaster"; import { OrgChild1 } from "./OrgChild1"; import { OrgChild2 } from "./OrgChild2"; import { OrgChild3 } from "./OrgChild3"; import { OrgChild4 } from "./OrgChild4"; @Entity("orgRevision") export class OrgRevision extends EntityBase { @Column({ comment: "ชื่อของโครงสร้าง", length: 255, default: null, }) orgRevisionName: string; @Column({ comment: "สถานะเป็นโครงสร้างปัจจุบันหรือไม่", default: false, }) orgRevisionIsCurrent: boolean; @Column({ nullable: true, type: "datetime", comment: "วันเวลาที่สร้างโครงสร้าง", default: null, }) orgRevisionCreatedAt: Date; @Column({ nullable: true, type: "datetime", comment: "เวลาเผยแพร่", default: null, }) orgPublishDate: Date; @Column({ comment: "สถานะเป็นโครงสร้างแบบร่างหรือไม่", default: false, }) orgRevisionIsDraft: boolean; @OneToMany(() => PosMaster, (posMaster) => posMaster.orgRevision) posMasters: PosMaster[]; @OneToMany(() => OrgRoot, (orgRoot) => orgRoot.orgRevision) orgRoots: OrgRoot[]; @OneToMany(() => OrgChild1, (orgChild1) => orgChild1.orgRevision) orgChild1s: OrgChild1[]; @OneToMany(() => OrgChild2, (orgChild2) => orgChild2.orgRevision) orgChild2s: OrgChild2[]; @OneToMany(() => OrgChild3, (orgChild3) => orgChild3.orgRevision) orgChild3s: OrgChild3[]; @OneToMany(() => OrgChild4, (orgChild4) => orgChild4.orgRevision) orgChild4s: OrgChild4[]; } export class CreateOrgRevision { @Column() orgRevisionName: string; @Column() typeDraft: string; @Column("uuid") orgRevisionId?: string; } export type UpdateOrgRevision = Partial;