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

149 lines
3.2 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,
comment: "สถานะของหน่วยงาน", //ปกติ = 1 , ยุกเลิก = 0
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
orgChild2IsNormal: 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
@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
@ManyToOne(() => OrgChild1, orgChild1 => orgChild1.orgChild2s)
2024-01-25 10:13:36 +07:00
@JoinColumn({ name: "orgChild1Id" })
2024-01-24 16:08:34 +07:00
orgChild1: OrgChild1;
@OneToMany(() => OrgChild3, orgChild3 => orgChild3.orgChild2)
orgChild3s: OrgChild3[];
2024-01-25 14:35:19 +07:00
}
export class CreateOrgChild2 {
@Column()
orgChild2Name: string;
@Column()
orgChild2ShortName: string;
@Column()
orgChild2Code: string;
@Column()
orgChild2Rank: string;
@Column()
orgChild2Order: number;
@Column()
orgChild2PhoneEx: string;
@Column()
orgChild2PhoneIn: string;
@Column()
orgChild2Fax: string;
@Column()
orgChild2IsNormal: boolean;
@Column('uuid')
orgRootId: string;
@Column('uuid')
orgChild1Id: string;
2024-01-24 16:08:34 +07:00
}
export type UpdateOrgChild2 = Partial<OrgChild2>;