diff --git a/src/entities/PosDict.ts b/src/entities/PosDict.ts new file mode 100644 index 00000000..e37b5848 --- /dev/null +++ b/src/entities/PosDict.ts @@ -0,0 +1,60 @@ +import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany } from "typeorm"; +import { EntityBase } from "./base/Base"; + +@Entity("posDict") +export class PosDict extends EntityBase { + @Column({ + nullable: true, + comment: "ชื่อตำแหน่งในสายงาน (ชื่อตำแหน่ง)", + length: 255, + default: "string", + }) + posDictName: string; + + @Column({ + nullable: true, + comment: "สายงาน", + length: 255, + default: "string", + }) + posDictField: string; + + @Column({ + length: 40, + comment: "ตำแหน่งประเภท", + default: "00000000-0000-0000-0000-000000000000", + }) + + posTypeId: string; + + @Column({ + length: 40, + comment: "ระดับตำแหน่ง", + default: "00000000-0000-0000-0000-000000000000", + }) + posLevelId: string; + + @Column({ + nullable: true, + length: 40, + comment: "ตำแหน่งทางการบริหาร", + default: "00000000-0000-0000-0000-000000000000", + }) + posExecutiveId: string; + + @Column({ + nullable: true, + length: 255, + comment: "ด้านทางการบริหาร", + default: "string", + }) + posDictExecutiveField: string; + + @Column({ + nullable: true, + length: 255, + comment: "ด้าน/สาขา", + default: "string", + }) + posDictArea: string; +} diff --git a/src/entities/PosMaster.ts b/src/entities/PosMaster.ts new file mode 100644 index 00000000..0f4742b2 --- /dev/null +++ b/src/entities/PosMaster.ts @@ -0,0 +1,127 @@ +import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany } from "typeorm"; +import { EntityBase } from "./base/Base"; + +enum PosMasterLine { + MAIN = "MAIN", + SUPPORT = "SUPPORT", +} + +@Entity("posMaster") +export class PosMaster extends EntityBase { + @Column({ + nullable: true, + comment: "Prefix นำหน้าเลขที่ตำแหน่ง เป็น Optional (ไม่ใช่อักษรย่อของหน่วยงาน/ส่วนราชการ)", + length: 16, + default: "string", + }) + posMasterNoPrefix: string; + + @Column({ + nullable: true, + comment: "เลขที่ตำแหน่ง เป็นตัวเลข", + length: 16, + default: "string", + }) + posMasterNo: string; + + @Column({ + nullable: true, + comment: "Suffix หลังเลขที่ตำแหน่ง เช่น ช.", + length: 16, + default: "string", + }) + posMasterNoSuffix: string; + + @Column({ + nullable: true, + type: "datetime", + comment: "วัน-เวลาที่สร้าง", + }) + posMasterCreatedAt: Date; + + @Column({ + nullable: true, + comment: + "รหัส DNA ใช้ในกรณีที่มีการทำสำเนาโครงสร้างและตำแหน่ง ตำแหน่งที่ทำสำเนามากับตำแหน่งเก่าจะต้องมี DNA เดียวกัน เพื่อให้ track ประวัติการแก้ไขตำแหน่งย้อนหลังได้", + length: 40, + default: "string", + }) + ancestorDNA: string; + + @Column({ + nullable: true, + comment: "ลำดับที่แสดงผล", + }) + posMasterOrder: number; + + @Column({ + nullable: true, + comment: "ลำดับความสำคัญ", + }) + posMasterPriority: number; + + @Column({ + nullable: true, + comment: "สายงานในอัตรากำลัง (หลัก / สนับสนุน) คนละฟิลด์กับสายงานของตำแหน่ง", + type: "enum", + enum: PosMasterLine, + }) + posMasterLine: PosMasterLine; + + @Column({ + nullable: true, + length: 40, + default: "00000000-0000-0000-0000-000000000000", + }) + orgRootId: string; + + @Column({ + nullable: true, + length: 40, + default: "00000000-0000-0000-0000-000000000000", + }) + orgChild1Id: string; + + @Column({ + nullable: true, + length: 40, + default: "00000000-0000-0000-0000-000000000000", + }) + orgChild2Id: string; + + @Column({ + nullable: true, + length: 40, + default: "00000000-0000-0000-0000-000000000000", + }) + orgChild3Id: string; + + @Column({ + nullable: true, + length: 40, + default: "00000000-0000-0000-0000-000000000000", + }) + orgChild4Id: string; + + @Column({ + nullable: true, + length: 40, + comment: "คนครองปัจจุบัน เมื่อทำสำเนาโครงสร้างและตำแหน่งพร้อมกับคนครองมา คนครองจะอยู่ในฟิลด์นี้", + default: "string", + }) + profileIdCurrentHolder: string; + + @Column({ + nullable: true, + length: 40, + comment: "คนที่กำลังจะมาครอง ตอนปรับโครงสร้าง ถ้าเลือกให้ใครมาครอง ProfileId ของคนนั้นจะมาอยู่ในช่องนี้ รวมทั้งตอนเลือกตำแหน่งเพื่อบรรจุ แต่งตั้ง เลื่อน ย้าย ในระบบบรรจุแต่งตั้งด้วย", + default: "string", + }) + profileIdNextHolder: string; + + @Column({ + length: 40, + default: "00000000-0000-0000-0000-000000000000", + }) + orgRevisionId: string;//fk +} diff --git a/src/entities/Position.ts b/src/entities/Position.ts new file mode 100644 index 00000000..4df27021 --- /dev/null +++ b/src/entities/Position.ts @@ -0,0 +1,73 @@ +import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany } from "typeorm"; +import { EntityBase } from "./base/Base"; + +@Entity("position") +export class Position extends EntityBase { + @Column({ + nullable: true, + comment: "ชื่อตำแหน่งในสายงาน (ชื่อตำแหน่ง)", + length: 255, + default: "string", + }) + positionName: string; + + @Column({ + nullable: true, + comment: "สายงาน", + length: 45, + default: "string", + }) + positionField: string; + + @Column({ + length: 40, + comment: "ประเภทตำแหน่ง", + default: "00000000-0000-0000-0000-000000000000", + }) + posTypeId: string; + + @Column({ + length: 40, + comment: "ระดับตำแหน่ง", + default: "00000000-0000-0000-0000-000000000000", + }) + posLevelId: string; + + @Column({ + nullable: true, + length: 40, + comment: "ตำแหน่งทางการบริหาร", + default: "00000000-0000-0000-0000-000000000000", + }) + posExecutiveId: string; + + @Column({ + nullable: true, + comment: "ด้านทางการบริหาร", + length: 255, + default: "string", + }) + positionExecutiveField: string; + + @Column({ + nullable: true, + comment: "ด้าน/สาขา", + length: 255, + default: "string", + }) + positionArea: string; + + @Column({ + nullable: true, + comment: "เป็นตำแหน่งที่ถูกเลือกในรอบนั้นๆ หรือไม่?", + }) + positionIsSelected: boolean; + + @Column({ + length: 40, + comment: "เชื่อมโยงกับตารางเลขที่ตำแหน่ง", + default: "00000000-0000-0000-0000-000000000000", + }) + posMasterId: string; + +} \ No newline at end of file