hrms-api-org/src/entities/OrgChild4.ts

158 lines
3.4 KiB
TypeScript

import { Entity, Column, ManyToOne, JoinColumn, OneToOne } from "typeorm";
import { EntityBase } from "./base/Base";
import { OrgRoot } from "./OrgRoot";
import { OrgChild1 } from "./OrgChild1";
import { OrgChild2 } from "./OrgChild2";
import { OrgChild3 } from "./OrgChild3";
// ENUM orgChild4Rank
enum OrgChild4Rank {
DEPARTMENT = "department",
OFFICE = "office",
DIVISION = "division",
SECTION = "section",
}
@Entity("orgChild4")
export class OrgChild4 extends EntityBase {
// @Column({
// comment: "",
// length: 40,
// default: "00000000-0000-0000-0000-000000000000",
// })
// orgChild4Id: string;
@Column({
nullable: true,
comment: "ชื่อส่วนราชการ",
length: 255,
default: "string",
})
orgChild4Name: string;
@Column({
nullable: true,
comment: "ชื่อย่อส่วนราชการ",
length: 16,
default: "string",
})
orgChild4ShortName: string;
@Column({
nullable: true,
comment: "รหัสส่วนราชการ",
length: 8,
default: "string",
})
orgChild4Code: string;
@Column({
nullable: true,
comment: "ระดับส่วนราชการ",
type: "enum",
enum: OrgChild4Rank,
// default: OrgChild4Rank.DEPARTMENT,
})
orgChild4Rank: OrgChild4Rank;
@Column({
nullable: true,
comment: "ลำดับที่ของส่วนราชการภายใน Child เดียวกัน",
})
orgChild4Order: number;
@Column({
nullable: true,
length: 64,
comment: "หมายเลขโทรศัพท์ที่ติดต่อจากภายนอก",
})
orgChild4PhoneEx: string;
@Column({
nullable: true,
length: 64,
comment: "หมายเลขโทรศัพท์ที่ติดต่อจากภายใน",
})
orgChild4PhoneIn: string;
@Column({
nullable: true,
length: 64,
comment: "หมายเลขโทรสาร",
})
orgChild4Fax: string;
@Column({
nullable: true,
comment: "สถานะของหน่วยงาน", //ปกติ = 1 , ยุกเลิก = 0
default: true
})
orgChild4IsNormal: boolean;
@Column({
length: 40,
default: "00000000-0000-0000-0000-000000000000",
})
orgRootId: string;
@Column({
length: 40,
default: "00000000-0000-0000-0000-000000000000",
})
orgChild1Id: string;
@Column({
length: 40,
default: "00000000-0000-0000-0000-000000000000",
})
orgChild2Id: string;
@Column({
length: 40,
default: "00000000-0000-0000-0000-000000000000",
})
orgChild3Id: string;
@Column({
length: 40,
default: "00000000-0000-0000-0000-000000000000",
})
isAncestorDNA: string;
@ManyToOne(() => OrgChild3, orgChild3 => orgChild3.orgChild4s)
@JoinColumn({ name: "orgChild3Id" })
orgChild3: OrgChild3;
}
export class CreateOrgChild4 {
@Column()
orgChild4Name: string;
@Column()
orgChild4ShortName: string;
@Column()
orgChild4Code: string;
@Column()
orgChild4Rank: string;
@Column()
orgChild4Order: number;
@Column()
orgChild4PhoneEx: string;
@Column()
orgChild4PhoneIn: string;
@Column()
orgChild4Fax: string;
@Column()
orgChild4IsNormal: boolean;
@Column('uuid')
orgChild3Id: string;
}
export type UpdateOrgChild4 = Partial<OrgChild4>;