import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany } from "typeorm"; import { EntityBase } from "./base/Base"; import { OrgChild1 } from "./OrgChild1"; // ENUM orgRootRank enum OrgRootRank { DEPARTMENT = "department", OFFICE = "office", DIVISION = "division", SECTION = "section", } @Entity("orgRoot") export class OrgRoot extends EntityBase { @Column({ nullable: true, comment: "ชื่อหน่วยงาน", length: 255, default: "string", }) orgRootName: string; @Column({ nullable: true, comment: "ชื่อย่อหน่วยงาน", length: 16, default: "string", }) orgRootShortName: string; @Column({ nullable: true, comment: "รหัสหน่วยงาน", length: 8, default: "string", }) orgRootCode: string; @Column({ nullable: true, comment: "ระดับของหน่วยงาน", type: "enum", enum: OrgRootRank, default: OrgRootRank.DEPARTMENT, }) orgRootRank: OrgRootRank; @Column({ nullable: true, comment: "ลำดับที่ของหน่วยงาน", }) orgRootOrder: number; @Column({ nullable: true, length: 64, comment: "หมายเลขโทรศัพท์ที่ติดต่อจากภายนอก", }) orgRootPhoneEx: string; @Column({ nullable: true, length: 64, comment: "หมายเลขโทรศัพท์ที่ติดต่อจากภายใน", }) orgRootPhoneIn: string; @Column({ nullable: true, length: 64, comment: "หมายเลขโทรสาร", }) orgRootFax: string; @Column({ nullable: true, comment: "สถานะของหน่วยงาน", //ปกติ = 1 , ยุกเลิก = 0 default: true, }) orgRootIsNormal: boolean; @Column({ length: 40, default: "00000000-0000-0000-0000-000000000000", }) orgRevisionId: string; @Column({ length: 40, default: "00000000-0000-0000-0000-000000000000", }) isAncestorDNA: string; @OneToMany(() => OrgChild1, (orgChild1) => orgChild1.orgRoot) orgChild1s: OrgChild1[]; } export type UpdateOrgRoot = Partial; export class CreateOrgRoot { @Column() orgRootName: string; @Column() orgRootShortName: string; @Column() orgRootCode: string; @Column() orgRootRank: OrgRootRank; @Column() orgRootOrder: number; @Column() orgRootPhoneEx: string; @Column() orgRootPhoneIn: string; @Column() orgRootFax: string; @Column() orgRootIsNormal: boolean; }