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

128 lines
2.6 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 { OrgChild1 } from "./OrgChild1";
// ENUM orgRootRank
enum OrgRootRank {
2024-01-25 14:35:19 +07:00
DEPARTMENT = "department",
OFFICE = "office",
DIVISION = "division",
SECTION = "section",
2024-01-24 16:08:34 +07:00
}
@Entity("orgRoot")
export class OrgRoot extends EntityBase {
@Column({
nullable: true,
comment: "ชื่อหน่วยงาน",
length: 255,
default: "string",
})
orgRootName: string;
@Column({
nullable: true,
comment: "ชื่อย่อหน่วยงาน",
length: 16,
default: "string",
})
orgRootShortName: string;
@Column({
nullable: true,
comment: "รหัสหน่วยงาน",
length: 8,
default: "string",
})
orgRootCode: string;
@Column({
nullable: true,
comment: "ระดับของหน่วยงาน",
type: "enum",
enum: OrgRootRank,
default: OrgRootRank.DEPARTMENT,
})
orgRootRank: OrgRootRank;
@Column({
nullable: true,
comment: "ลำดับที่ของหน่วยงาน",
})
orgRootOrder: number;
@Column({
nullable: true,
length: 64,
comment: "หมายเลขโทรศัพท์ที่ติดต่อจากภายนอก",
})
orgRootPhoneEx: string;
@Column({
nullable: true,
length: 64,
comment: "หมายเลขโทรศัพท์ที่ติดต่อจากภายใน",
})
orgRootPhoneIn: string;
@Column({
nullable: true,
length: 64,
comment: "หมายเลขโทรสาร",
})
orgRootFax: string;
@Column({
nullable: true,
comment: "สถานะของหน่วยงาน", //ปกติ = 1 , ยุกเลิก = 0
2024-01-25 14:35:19 +07:00
default: true,
2024-01-24 16:08:34 +07:00
})
2024-01-25 10:13:36 +07:00
orgRootIsNormal: boolean;
2024-01-25 14:35:19 +07:00
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
orgRevisionId: string;
2024-01-24 16:08:34 +07:00
@Column({
length: 40,
default: "00000000-0000-0000-0000-000000000000",
})
isAncestorDNA: string;
2024-01-25 14:35:19 +07:00
@OneToMany(() => OrgChild1, (orgChild1) => orgChild1.orgRoot)
2024-01-24 16:08:34 +07:00
orgChild1s: OrgChild1[];
}
export type UpdateOrgRoot = Partial<OrgRoot>;
2024-01-25 10:13:36 +07:00
export class CreateOrgRoot {
@Column()
orgRootName: string;
@Column()
orgRootShortName: string;
@Column()
orgRootCode: string;
@Column()
orgRootRank: OrgRootRank;
@Column()
orgRootOrder: number;
@Column()
orgRootPhoneEx: string;
@Column()
orgRootPhoneIn: string;
@Column()
orgRootFax: string;
@Column()
orgRootIsNormal: boolean;
}