เพิ่ม entity [PosType ,PosExecutive ,PosLevel]

This commit is contained in:
AdisakKanthawilang 2024-01-30 10:59:49 +07:00
parent 33967dcd7c
commit c72dbe5fb0
3 changed files with 89 additions and 0 deletions

46
src/entities/PosLevel.ts Normal file
View file

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