hrms-api-org/src/entities/ProfileHonor.ts
2025-03-18 15:32:21 +07:00

131 lines
3.1 KiB
TypeScript

import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { Profile } from "./Profile";
import { ProfileEmployee } from "./ProfileEmployee";
import { ProfileHonorHistory } from "./ProfileHonorHistory";
@Entity("profileHonor")
export class ProfileHonor extends EntityBase {
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง Profile",
default: null,
})
profileId: string;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง ProfileEmployee",
default: null,
})
profileEmployeeId: string;
@Column({
nullable: true,
length: 2000,
comment: "รายละเอียด",
default: null,
})
detail: string;
@Column({
nullable: true,
type: "datetime",
comment: "วันที่ได้รับ",
default: null,
})
issueDate: Date;
@Column({
nullable: true,
length: 200,
comment: "หน่วยงานที่ออก ",
default: null,
})
issuer: string;
@Column({
nullable: true,
length: 200,
comment: "ประเภท",
default: null,
})
type: string;
@Column({
nullable: true,
type: "datetime",
comment: "เอกสารอ้างอิง (ลงวันที่)",
default: null,
})
refCommandDate: Date;
@Column({
nullable: true,
comment: "เอกสารอ้างอิง (เลขที่คำสั่ง)",
type: "text",
default: null,
})
refCommandNo: string;
@Column({
nullable: true,
comment: "ประเภทช่วงเวลา",
default: null,
})
isDate: boolean;
@Column({
comment: "แนบไฟล์เอกสาร",
default: false,
})
isUpload: boolean;
@OneToMany(() => ProfileHonorHistory, (profileHonorHistory) => profileHonorHistory.histories)
profileHonorHistories: ProfileHonorHistory[];
@ManyToOne(() => Profile, (profile) => profile.profileHonors)
@JoinColumn({ name: "profileId" })
profile: Profile;
@ManyToOne(() => ProfileEmployee, (ProfileEmployee) => ProfileEmployee.profileHonors)
@JoinColumn({ name: "profileEmployeeId" })
profileEmployee: ProfileEmployee;
}
export class CreateProfileHonor {
profileId: string | null;
detail: string | null;
issueDate: Date | null;
issuer: string | null;
refCommandDate: Date | null;
refCommandNo: string | null;
type: string | null;
isDate: boolean | null;
isUpload?: boolean | null;
}
export class CreateProfileEmployeeHonor {
profileEmployeeId: string | null;
detail: string | null;
issueDate: Date | null;
issuer: string | null;
refCommandDate: Date | null;
refCommandNo: string | null;
type: string | null;
isDate: boolean | null;
isUpload?: boolean | null;
}
export type UpdateProfileHonor = {
detail?: string | null;
issueDate?: Date | null;
issuer?: string | null;
refCommandDate?: Date | null;
refCommandNo?: string | null;
type?: string | null;
isDate: boolean | null;
isUpload?: boolean | null;
};