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

132 lines
2.7 KiB
TypeScript
Raw Normal View History

2024-01-25 11:09:54 +07:00
import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";
2024-01-24 16:08:34 +07:00
import { EntityBase } from "./base/Base";
import { OrgRoot } from "./OrgRoot";
import { OrgChild2 } from "./OrgChild2";
enum OrgChild1Rank {
DEPARTMENT = "department",
OFFICE = "office",
DIVISION = "division",
SECTION = "section",
}
2024-01-25 13:08:25 +07:00
2024-01-24 17:22:41 +07:00
@Entity("orgChild1")
2024-01-24 16:08:34 +07:00
export class OrgChild1 extends EntityBase {
@Column({
nullable: true,
comment: "ชื่อส่วนราชการ",
length: 255,
default: "string",
})
orgChild1Name: string;
@Column({
nullable: true,
comment: "ชื่อย่อส่วนราชการ",
length: 16,
default: "string",
})
orgChild1ShortName: string;
@Column({
nullable: true,
comment: "รหัสส่วนราชการ",
length: 8,
default: "string",
})
orgChild1Code: string;
@Column({
nullable: true,
comment: "ระดับส่วนราชการ",
type: "enum",
enum: OrgChild1Rank,
})
orgChild1Rank: OrgChild1Rank;
@Column({
nullable: true,
comment: "ลำดับที่ของส่วนราชการภายใน Child เดียวกัน",
})
orgChild1Order: number;
@Column({
nullable: true,
length: 64,
comment: "หมายเลขโทรศัพท์ที่ติดต่อจากภายนอก",
})
orgChild1PhoneEx: string;
@Column({
nullable: true,
length: 64,
comment: "หมายเลขโทรศัพท์ที่ติดต่อจากภายใน",
})
orgChild1PhoneIn: string;
@Column({
nullable: true,
length: 64,
comment: "หมายเลขโทรสาร",
})
orgChild1Fax: string;
@Column({
nullable: true,
2024-01-25 11:09:54 +07:00
comment: "สถานะของหน่วยงาน",
2024-01-25 10:13:36 +07:00
default: true
2024-01-24 16:08:34 +07:00
})
2024-01-25 10:13:36 +07:00
orgChild1IsNormal: boolean;
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
orgRootId: string;
2024-01-24 16:08:34 +07:00
@ManyToOne(() => OrgRoot, orgRoot => orgRoot.orgChild1s)
2024-01-25 10:13:36 +07:00
@JoinColumn({ name: "orgRootId" })
2024-01-24 16:08:34 +07:00
orgRoot: OrgRoot;
@OneToMany(() => OrgChild2, orgChild2 => orgChild2.orgChild1)
orgChild2s: OrgChild2[];
2024-01-25 11:09:54 +07:00
}
export class CreateOrgChild1 {
@Column()
orgChild1Name: string;
@Column()
orgChild1ShortName: string;
@Column()
orgChild1Code: string;
@Column()
orgChild1Rank: string;
@Column()
orgChild1Order: number;
2024-01-24 16:08:34 +07:00
2024-01-25 11:09:54 +07:00
@Column()
orgChild1PhoneEx: string;
@Column()
orgChild1PhoneIn: string;
@Column()
orgChild1Fax: string;
@Column()
orgChild1IsNormal: boolean;
2024-01-25 13:08:25 +07:00
@Column('uuid')
2024-01-25 11:09:54 +07:00
orgRootId: string;
2024-01-24 16:08:34 +07:00
}
2024-01-25 11:09:54 +07:00
2024-01-25 13:08:25 +07:00
export type UpdateOrgChild1 = Partial<CreateOrgChild1> & { orgChild1Rank?: OrgChild1Rank };