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

120 lines
2.9 KiB
TypeScript
Raw Normal View History

2024-01-24 16:08:34 +07:00
import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { OrgRoot } from "./OrgRoot";
import { OrgChild1 } from "./OrgChild1";
import { OrgChild3 } from "./OrgChild3";
import { OrgChild4 } from "./OrgChild4";
// ENUM orgChild2Rank
enum OrgChild2Rank {
DEPARTMENT = "department",
OFFICE = "office",
DIVISION = "division",
SECTION = "section",
}
2024-01-24 17:22:41 +07:00
@Entity("orgChild2")
2024-01-24 16:08:34 +07:00
export class OrgChild2 extends EntityBase {
// @Column({
// comment: "",
// length: 40,
// default: "00000000-0000-0000-0000-000000000000",
// })
// orgChild2Id: string;
@Column({
nullable: true,
comment: "ชื่อส่วนราชการ",
length: 255,
default: "string",
})
orgChild2Name: string;
@Column({
nullable: true,
comment: "ชื่อย่อส่วนราชการ",
length: 16,
default: "string",
})
orgChild2ShortName: string;
@Column({
nullable: true,
comment: "รหัสส่วนราชการ",
length: 8,
default: "string",
})
orgChild2Code: string;
@Column({
nullable: true,
comment: "ระดับส่วนราชการ",
type: "enum",
enum: OrgChild2Rank,
// default: OrgChild2Rank.DEPARTMENT,
})
orgChild2Rank: OrgChild2Rank;
@Column({
nullable: true,
comment: "ลำดับที่ของส่วนราชการภายใน Child เดียวกัน",
})
orgChild2Order: number;
@Column({
nullable: true,
length: 64,
comment: "หมายเลขโทรศัพท์ที่ติดต่อจากภายนอก",
})
orgChild2PhoneEx: string;
@Column({
nullable: true,
length: 64,
comment: "หมายเลขโทรศัพท์ที่ติดต่อจากภายใน",
})
orgChild2PhoneIn: string;
@Column({
nullable: true,
length: 64,
comment: "หมายเลขโทรสาร",
})
orgChild2Fax: string;
@Column({
nullable: true,
type: "tinyint",
comment: "สถานะของหน่วยงาน", //ปกติ = 1 , ยุกเลิก = 0
})
orgChild2IsNormal: number;
@Column({
length: 40,
default: "00000000-0000-0000-0000-000000000000",
})
fkOrgRootId: string;
@Column({
length: 40,
default: "00000000-0000-0000-0000-000000000000",
})
fkOrgChild1Id: string;
2024-01-24 17:22:41 +07:00
// @ManyToOne(() => OrgRoot, orgRoot => orgRoot.orgChild2s)
// @JoinColumn({ name: "fkOrgRootId" })
// orgRoot: OrgRoot;
2024-01-24 16:08:34 +07:00
@ManyToOne(() => OrgChild1, orgChild1 => orgChild1.orgChild2s)
@JoinColumn({ name: "fkOrgChild1Id" })
orgChild1: OrgChild1;
//child table 3,4
@OneToMany(() => OrgChild3, orgChild3 => orgChild3.orgChild2)
orgChild3s: OrgChild3[];
2024-01-24 17:22:41 +07:00
// @OneToMany(() => OrgChild4, orgChild4 => orgChild4.orgChild2)
// orgChild4s: OrgChild4[];
2024-01-24 16:08:34 +07:00
}
export type UpdateOrgChild2 = Partial<OrgChild2>;