hrms-api-org/src/entities/ProfileAssistance.ts
waruneeauy 922a0ab1c2
All checks were successful
Build & Deploy on Dev / build (push) Successful in 51s
fix: ช่วยรายการและรักษาการ endDate null
2026-02-06 22:11:07 +07:00

160 lines
3.8 KiB
TypeScript

import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { Profile } from "./Profile";
import { ProfileAssistanceHistory } from "./ProfileAssistanceHistory";
import { ProfileEmployee } from "./ProfileEmployee";
import { Command } from "./Command";
@Entity("profileAssistance")
export class ProfileAssistance extends EntityBase {
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง Profile",
default: null,
})
profileId: string;
@Column({
comment: "สถานะ",
default: "PENDING",
length: 20,
})
status: string;
@Column({
nullable: true,
comment: "หน่วยงานที่ให้ช่วยราชการ",
default: null,
})
agency: string;
@Column({
nullable: true,
type: "datetime",
comment: "วันเริ่มช่วยราชการ",
default: null,
})
dateStart: Date;
@Column({
nullable: true,
type: "datetime",
comment: "วันสิ้นสุดการช่วยราชการ",
default: null,
})
dateEnd: Date | null;
@Column({
nullable: true,
comment: "เลขที่คำสั่ง",
default: null,
})
commandNo: string;
@Column({
nullable: true,
comment: "ชื่อคำสั่ง",
default: null,
})
commandName: string;
@Column({
nullable: true,
comment: "id อ้างอิงรายการ",
default: null,
})
refId: string;
@Column({
nullable: true,
comment: "เอกสารอ้างอิง",
default: null,
})
document: string;
@Column({
comment: "แนบไฟล์เอกสาร",
default: false,
})
isUpload: boolean;
@Column({
comment: "วันที่ออกคำสั่ง",
type: "datetime",
nullable: true,
})
refCommandDate: Date;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง command",
default: null,
})
commandId: string;
@ManyToOne(() => Command, (command) => command.profileSalarys)
@JoinColumn({ name: "commandId" })
command: Command;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง ProfileEmployee",
default: null,
})
profileEmployeeId: string;
@OneToMany(
() => ProfileAssistanceHistory,
(profileAssistanceHistory) => profileAssistanceHistory.histories,
)
profileAssistanceHistorys: ProfileAssistanceHistory[];
@ManyToOne(() => Profile, (profile) => profile.profileAbilities)
@JoinColumn({ name: "profileId" })
profile: Profile;
@ManyToOne(() => ProfileEmployee, (ProfileEmployee) => ProfileEmployee.profileAbilities)
@JoinColumn({ name: "profileEmployeeId" })
profileEmployee: ProfileEmployee;
}
export class CreateProfileAssistance {
profileId: string | null;
agency: string | null;
dateStart: Date | null;
dateEnd: Date | null;
commandNo: string | null;
document: string | null;
refCommandDate?: string | null;
commandId?: string | null;
isUpload?: boolean | null;
commandName?: string | null;
}
export class CreateProfileAssistanceEmployee {
profileEmployeeId: string | null;
agency: string | null;
dateStart: Date | null;
dateEnd: Date | null;
commandNo: string | null;
document: string | null;
refCommandDate?: string | null;
commandId?: string | null;
isUpload?: boolean | null;
commandName?: string | null;
}
export type UpdateProfileAssistance = {
agency?: string | null;
dateStart?: Date | null;
dateEnd?: Date | null;
commandNo?: string | null;
document?: string | null;
isUpload?: boolean | null;
refCommandDate?: string | null;
commandId?: string | null;
commandName?: string | null;
};