From c72dbe5fb0a6d0cde8e16cd2e3047fefc3f59bbf Mon Sep 17 00:00:00 2001 From: AdisakKanthawilang Date: Tue, 30 Jan 2024 10:59:49 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88=E0=B8=A1?= =?UTF-8?q?=20entity=20[PosType=20,PosExecutive=20,PosLevel]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/entities/PosExecutive.ts | 19 +++++++++++++++ src/entities/PosLevel.ts | 46 ++++++++++++++++++++++++++++++++++++ src/entities/PosType.ts | 24 +++++++++++++++++++ 3 files changed, 89 insertions(+) create mode 100644 src/entities/PosExecutive.ts create mode 100644 src/entities/PosLevel.ts create mode 100644 src/entities/PosType.ts diff --git a/src/entities/PosExecutive.ts b/src/entities/PosExecutive.ts new file mode 100644 index 00000000..00e32379 --- /dev/null +++ b/src/entities/PosExecutive.ts @@ -0,0 +1,19 @@ +import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany } from "typeorm"; +import { EntityBase } from "./base/Base"; + +@Entity("posExecutive") +export class PosExecutive extends EntityBase { + @Column({ + nullable: true, + comment: "ชื่อตำแหน่งทางการบริหาร", + length: 255, + default: "string", + }) + posExecutiveName: string; + + @Column({ + nullable: true, + comment: "ลำดับความสำคัญ", + }) + posExecutivePriority: number; +} diff --git a/src/entities/PosLevel.ts b/src/entities/PosLevel.ts new file mode 100644 index 00000000..f5a7b6d0 --- /dev/null +++ b/src/entities/PosLevel.ts @@ -0,0 +1,46 @@ +import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany } from "typeorm"; +import { EntityBase } from "./base/Base"; +import { PosType } from "./PosType"; +// ENUM PosLevelAuthority +enum PosLevelAuthority { + HEAD = "HEAD", + DEPUTY = "DEPUTY", + GOVERNOR = "GOVERNOR", +} +@Entity("posLevel") +export class PosLevel extends EntityBase { + @Column({ + nullable: true, + comment: "ชื่อระดับตำแหน่ง", + type: "tinytext", + default: "string", + }) + posLevelName: string; + + @Column({ + nullable: true, + comment: "ระดับของระดับตำแหน่ง", + }) + posLevelRank: number; + + @Column({ + nullable: true, + comment: + "ผู้มีอำนาจสั่งบรรจุของระดับนี้ head = หัวหน้าหน่วยงาน , deputy = ปลัด , governor = ผู้ว่าฯ", + type: "enum", + enum: PosLevelAuthority, + }) + posLevelAuthority: PosLevelAuthority; + + @Column({ + length: 40, + comment: "เป็นระดับของประเภทตำแหน่งใด", + default: "00000000-0000-0000-0000-000000000000", + }) + posTypeId: string; + + @ManyToOne(() => PosType, (posType) => posType.posLevels) + @JoinColumn({ name: "posTypeId" }) + posType: PosType; + +} diff --git a/src/entities/PosType.ts b/src/entities/PosType.ts new file mode 100644 index 00000000..d2ce24ae --- /dev/null +++ b/src/entities/PosType.ts @@ -0,0 +1,24 @@ +import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany } from "typeorm"; +import { EntityBase } from "./base/Base"; +import { PosLevel } from "./PosLevel"; + +@Entity("posType") +export class PosType extends EntityBase { + @Column({ + nullable: true, + comment: "ชื่อประเภทตำแหน่ง (ทั่วไป วิชาการ อำนวยการ บริหาร)", + type: "tinytext", + default: "string", + }) + posTypeName: string; + + @Column({ + nullable: true, + comment: "ระดับของประเภทตำแหน่ง ไว้ใช้ระบุว่าประเภทตำแหน่งนี้อยู่ระดับสูงหรือต่ำกว่ากัน โดย 1 = ต่ำกว่า , มากกว่า 1 = สูงกว่า ทั่วไป = 1 วิชาการ = 2 อำนวยการ = 3 บริหาร = 4", + }) + posTypeRank: number; + + @OneToMany(() => PosLevel, (posLevel) => posLevel.posType) + posLevels: PosLevel[]; + +}