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

120 lines
2.8 KiB
TypeScript
Raw Normal View History

2024-03-13 10:43:50 +07:00
import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { Profile } from "./Profile";
2024-05-13 16:37:51 +07:00
import { ProfileEmployee } from "./ProfileEmployee";
2024-03-13 10:43:50 +07:00
import { ProfileDutyHistory } from "./ProfileDutyHistory";
@Entity("profileDuty")
export class ProfileDuty extends EntityBase {
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง Profile",
default: null,
})
profileId: string;
2024-05-13 16:37:51 +07:00
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง ProfileEmployee",
default: null,
})
profileEmployeeId: string;
2024-03-13 10:43:50 +07:00
@Column({
nullable: true,
type: "datetime",
comment: "เริ่มต้น",
default: null,
})
dateStart: Date;
@Column({
nullable: true,
type: "datetime",
comment: "สิ้นสุด",
default: null,
})
dateEnd: Date;
@Column({
nullable: true,
comment: "รายละเอียด",
type: "text",
default: null,
})
detail: string;
@Column({
nullable: true,
comment: "เอกสารอ้างอิง",
type: "text",
default: null,
})
reference: string;
@Column({
nullable: true,
type: "datetime",
comment: "เอกสารอ้างอิง (ลงวันที่)",
default: null,
})
refCommandDate: Date;
@Column({
nullable: true,
comment: "เอกสารอ้างอิง (เลขที่คำสั่ง)",
type: "text",
default: null,
})
refCommandNo: string;
2025-01-28 14:37:40 +07:00
@Column({
comment: "แนบไฟล์เอกสาร",
default: false,
})
isUpload: boolean;
2024-03-13 10:43:50 +07:00
@OneToMany(() => ProfileDutyHistory, (profileDutyHistory) => profileDutyHistory.histories)
profileDutyHistories: ProfileDutyHistory[];
@ManyToOne(() => Profile, (profile) => profile.profileDutys)
@JoinColumn({ name: "profileId" })
profile: Profile;
2024-05-13 16:37:51 +07:00
@ManyToOne(() => ProfileEmployee, (ProfileEmployee) => ProfileEmployee.profileDutys)
@JoinColumn({ name: "profileEmployeeId" })
profileEmployee: ProfileEmployee;
2024-03-13 10:43:50 +07:00
}
export class CreateProfileDuty {
profileId: string | null;
dateStart: Date | null;
dateEnd: Date | null;
detail: string | null;
reference: string | null;
refCommandDate: Date | null;
refCommandNo: string | null;
}
export class CreateProfileEmployeeDuty {
profileEmployeeId: string | null;
2024-03-13 10:43:50 +07:00
dateStart: Date | null;
dateEnd: Date | null;
detail: string | null;
reference: string | null;
refCommandDate: Date | null;
refCommandNo: string | null;
}
2024-03-18 17:23:59 +07:00
export type UpdateProfileDuty = {
dateStart?: Date | null;
dateEnd?: Date | null;
detail?: string | null;
reference?: string | null;
2024-03-18 17:23:59 +07:00
refCommandDate?: Date | null;
refCommandNo?: string | null;
2025-01-28 14:37:40 +07:00
isUpload?: boolean | null;
2024-03-18 17:23:59 +07:00
};