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; }