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

128 lines
3.9 KiB
TypeScript
Raw Normal View History

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
}