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

139 lines
2.9 KiB
TypeScript
Raw Normal View History

2024-01-25 15:54:03 +07:00
import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
2024-01-24 16:08:34 +07:00
import { EntityBase } from "./base/Base";
import { OrgChild2 } from "./OrgChild2";
import { OrgChild4 } from "./OrgChild4";
2024-01-25 15:54:03 +07:00
2024-01-24 16:08:34 +07:00
enum OrgChild3Rank {
2024-01-26 10:13:07 +07:00
DEPARTMENT = "DEPARTMENT",
OFFICE = "OFFICE",
DIVISION = "DIVISION",
SECTION = "SECTION",
2024-01-24 16:08:34 +07:00
}
2024-01-25 15:54:03 +07:00
2024-01-24 17:22:41 +07:00
@Entity("orgChild3")
2024-01-24 16:08:34 +07:00
export class OrgChild3 extends EntityBase {
@Column({
nullable: true,
comment: "ชื่อส่วนราชการ",
length: 255,
default: "string",
})
orgChild3Name: string;
@Column({
nullable: true,
comment: "ชื่อย่อส่วนราชการ",
length: 16,
default: "string",
})
orgChild3ShortName: string;
@Column({
nullable: true,
comment: "รหัสส่วนราชการ",
length: 8,
default: "string",
})
orgChild3Code: string;
@Column({
nullable: true,
comment: "ระดับส่วนราชการ",
type: "enum",
enum: OrgChild3Rank,
})
orgChild3Rank: OrgChild3Rank;
@Column({
nullable: true,
comment: "ลำดับที่ของส่วนราชการภายใน Child เดียวกัน",
})
orgChild3Order: number;
@Column({
nullable: true,
length: 64,
comment: "หมายเลขโทรศัพท์ที่ติดต่อจากภายนอก",
})
orgChild3PhoneEx: string;
@Column({
nullable: true,
length: 64,
comment: "หมายเลขโทรศัพท์ที่ติดต่อจากภายใน",
})
orgChild3PhoneIn: string;
@Column({
nullable: true,
length: 64,
comment: "หมายเลขโทรสาร",
})
orgChild3Fax: string;
@Column({
length: 40,
default: "00000000-0000-0000-0000-000000000000",
})
2024-01-25 10:13:36 +07:00
orgRootId: string;
2024-01-24 16:08:34 +07:00
@Column({
length: 40,
default: "00000000-0000-0000-0000-000000000000",
})
2024-01-25 10:13:36 +07:00
orgChild1Id: string;
2024-01-24 16:08:34 +07:00
@Column({
length: 40,
default: "00000000-0000-0000-0000-000000000000",
})
2024-01-25 10:13:36 +07:00
orgChild2Id: string;
2024-01-24 16:08:34 +07:00
@Column({
length: 40,
default: "00000000-0000-0000-0000-000000000000",
})
orgRevisionId: string;
@Column({
length: 40,
default: "00000000-0000-0000-0000-000000000000",
})
isAncestorDNA: string;
2024-01-26 17:09:28 +07:00
@ManyToOne(() => OrgChild2, (orgChild2) => orgChild2.orgChild3s)
2024-01-25 10:13:36 +07:00
@JoinColumn({ name: "orgChild2Id" })
2024-01-24 16:08:34 +07:00
orgChild2: OrgChild2;
2024-01-26 17:09:28 +07:00
@OneToMany(() => OrgChild4, (orgChild4) => orgChild4.orgChild3)
2024-01-24 16:08:34 +07:00
orgChild4s: OrgChild4[];
}
2024-01-25 15:54:03 +07:00
export class CreateOrgChild3 {
@Column()
orgChild3Name: string;
@Column()
orgChild3ShortName: string;
@Column()
orgChild3Code: string;
2024-01-26 17:09:28 +07:00
2024-01-25 15:54:03 +07:00
@Column()
orgChild3Rank: string;
@Column()
2024-01-26 17:09:28 +07:00
orgChild3PhoneEx?: string;
2024-01-25 15:54:03 +07:00
@Column()
2024-01-26 17:09:28 +07:00
orgChild3PhoneIn?: string;
2024-01-25 15:54:03 +07:00
@Column()
2024-01-26 17:09:28 +07:00
orgChild3Fax?: string;
2024-01-25 15:54:03 +07:00
2024-01-26 17:09:28 +07:00
@Column("uuid")
2024-01-25 15:54:03 +07:00
orgChild2Id: string;
}
export type UpdateOrgChild3 = Partial<CreateOrgChild3> & { orgChild3Rank?: OrgChild3Rank };