hrms-api-development/src/entities/DevelopmentHistory.ts
2024-10-01 00:41:09 +07:00

328 lines
7 KiB
TypeScript

import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base";
import { PosLevel } from "./PosLevel";
import { PosType } from "./PosType";
import { Development } from "./Development";
import { EmployeePosType } from "./EmployeePosType";
import { EmployeePosLevel } from "./EmployeePosLevel";
@Entity("developmentHistory")
export class DevelopmentHistory extends EntityBase {
@Column({
nullable: true,
comment: "id หน่วยงาน",
default: null,
})
rootId: string;
@Column({
nullable: true,
comment: "ชื่อหน่วยงาน",
default: null,
})
root: string;
@Column({
nullable: true,
comment: "ชื่อหน่วยงานที่สังกัด",
default: null,
})
org: string;
@Column({
nullable: true,
comment: "ชื่อย่อหน่วยงาน",
default: null,
})
orgRootShortName: string;
@Column({
nullable: true,
comment: "id revision",
default: null,
})
orgRevisionId: string;
@Column({
nullable: true,
comment: "id profile",
length: 40,
default: null,
})
profileId: string;
@Column({
nullable: true,
comment: "ประเภทราชการ",
length: 40,
default: null,
})
type: string;
@Column({
nullable: true,
comment: "ยศ",
length: 40,
default: null,
})
rank: string;
@Column({
nullable: true,
comment: "คำนำหน้าชื่อ",
length: 40,
default: null,
})
prefix: string;
@Column({
nullable: true,
comment: "ชื่อ",
length: 255,
default: null,
})
firstName: string;
@Column({
nullable: true,
comment: "นามสกุล",
length: 255,
default: null,
})
lastName: string;
@Column({
nullable: true,
comment: "เลขประจำตัวประชาชน",
default: null,
length: 13,
})
citizenId: string;
@Column({
nullable: true,
comment: "ตำแหน่ง",
default: null,
length: 255,
})
position: string;
@Column({
nullable: true,
comment: "ชื่อตำแหน่งทางการบริหาร",
length: 255,
default: null,
})
posExecutive: string;
@Column({
nullable: true,
length: 40,
comment: "ไอดีระดับตำแหน่ง",
})
posLevelId: string | null;
@ManyToOne(() => PosLevel, (posLevel) => posLevel.developmentHistorys)
@JoinColumn({ name: "posLevelId" })
posLevel: PosLevel;
@Column({
nullable: true,
length: 40,
comment: "ไอดีประเภทตำแหน่ง",
})
posTypeId: string | null;
@ManyToOne(() => PosType, (posType) => posType.developmentHistorys)
@JoinColumn({ name: "posTypeId" })
posType: PosType;
@Column({
nullable: true,
length: 40,
comment: "ไอดีระดับตำแหน่ง",
})
employeePosLevelId: string | null;
@ManyToOne(() => EmployeePosLevel, (employeePosLevel) => employeePosLevel.developmentHistorys)
@JoinColumn({ name: "employeePosLevelId" })
employeePosLevel: EmployeePosLevel;
@Column({
nullable: true,
length: 40,
comment: "ไอดีประเภทตำแหน่ง",
})
employeePosTypeId: string | null;
@ManyToOne(() => EmployeePosType, (employeePosType) => employeePosType.developmentHistorys)
@JoinColumn({ name: "employeePosTypeId" })
employeePosType: EmployeePosType;
@Column({
nullable: true,
comment: "โครงการ/หลักสูตรการฝึกอบรม",
default: null,
})
developmentId: string;
@ManyToOne(() => Development, (development: Development) => development.developmentHistorys)
@JoinColumn({ name: "developmentId" })
development: Development;
@Column({
nullable: true,
comment: "จำนวนวันที่อบรม",
default: null,
length: 255,
})
trainingDays: string;
@Column({
nullable: true,
comment: "เลขที่คำสั่ง/เลขที่หนังสืออนุมัติ",
default: null,
length: 255,
})
order: string;
@Column({
nullable: true,
type: "datetime",
comment: "วันที่เริ่มต้น",
default: null,
})
dateStart: Date;
@Column({
nullable: true,
type: "datetime",
comment: "วันที่สิ้นสุด",
default: null,
})
dateEnd: Date;
@Column({
nullable: true,
type: "datetime",
comment: "คำสั่งลงวันที่/หนังสืออนุมัติลงวันที่",
default: null,
})
dateOrder: Date;
@Column({
comment: "บันทึกลงทะเบียนประวัติ",
default: false,
})
isDone: boolean;
@Column({
comment: "บันทึก IDP ที่ทะเบียนประวัติ",
default: false,
})
isDoneIDP: boolean;
@Column({
comment: "มีข้อมูลอยู่ในทะเบียนประวัติ",
default: false,
})
isProfile: boolean;
}
export class CreateDevelopmentHistory {
@Column()
rank: string | null;
@Column()
prefix: string | null;
@Column()
firstName: string | null;
@Column()
lastName: string | null;
@Column()
citizenId: string;
@Column()
position: string | null;
@Column()
posExecutive: string | null;
@Column()
posLevelId: string | null;
@Column()
posTypeId: string | null;
@Column()
developmentId: string;
@Column()
order: string | null;
@Column()
dateOrder: Date | null;
@Column()
dateStart: Date | null;
@Column()
dateEnd: Date | null;
}
export class UpdateDevelopmentHistory {
@Column()
rank: string | null;
@Column()
prefix: string | null;
@Column()
firstName: string | null;
@Column()
lastName: string | null;
@Column()
citizenId: string;
@Column()
position: string | null;
@Column()
posExecutive: string | null;
@Column()
posLevelId: string | null;
@Column()
posTypeId: string | null;
@Column()
developmentId: string;
@Column()
order: string | null;
@Column()
dateOrder: Date | null;
@Column()
dateStart: Date | null;
@Column()
dateEnd: Date | null;
}
export class CreateDevelopmentHistoryOBO {
// @Column()
// rank: string | null;
@Column()
prefix: string | null;
@Column()
firstName: string | null;
@Column()
lastName: string | null;
@Column()
citizenId: string;
@Column()
position: string | null;
@Column()
posExecutive?: string | null;
@Column()
posLevelId?: string | null;
@Column()
posTypeId?: string | null;
// @Column()
// developmentId: string;
@Column()
commandNumber: string | null;
@Column()
commandDate: Date | null;
@Column()
trainingDays: string | null;
@Column()
org: string | null;
@Column()
type: string | null;
@Column()
dateStart: Date | null;
@Column()
dateEnd: Date | null;
}