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

179 lines
4.5 KiB
TypeScript
Raw Normal View History

2024-03-12 14:53:15 +07:00
import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { Profile } from "./Profile";
2024-05-13 15:06:52 +07:00
import { ProfileEmployee } from "./ProfileEmployee";
2024-03-12 14:53:15 +07:00
import { ProfileTrainingHistory } from "./ProfileTrainingHistory";
@Entity("profileTraining")
export class ProfileTraining extends EntityBase {
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง Profile",
default: null,
})
profileId: string;
2024-05-13 15:06:52 +07:00
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง ProfileEmployee",
default: null,
})
profileEmployeeId: string;
2024-03-12 14:53:15 +07:00
@Column({
nullable: true,
type: "datetime",
comment: "วันเริ่มต้นการฝึกอบรม/ดูงาน ",
2024-03-12 14:53:15 +07:00
default: null,
})
startDate: Date;
@Column({
nullable: true,
type: "datetime",
comment: "วันสิ้นสุดการฝึกอบรม/ดูงาน ",
2024-03-12 14:53:15 +07:00
default: null,
})
endDate: Date;
@Column({
nullable: true,
length: 200,
comment: "เลขที่คำสั่ง/เลขที่หนังสืออนุมัติ ",
2024-03-12 14:53:15 +07:00
default: null,
})
numberOrder: string;
@Column({
nullable: true,
length: 200,
comment: "หัวข้อการฝึกอบรม/ดูงาน ",
2024-03-12 14:53:15 +07:00
default: null,
})
topic: string;
@Column({
nullable: true,
length: 200,
comment: "สถานที่ฝึกอบรม/ดูงาน ",
2024-03-12 14:53:15 +07:00
default: null,
})
place: string;
@Column({
nullable: true,
type: "datetime",
comment: "คำสั่งลงวันที่/หนังสืออนุมัติลงวันที่ ",
2024-03-12 14:53:15 +07:00
default: null,
})
dateOrder: Date;
@Column({
nullable: true,
length: 200,
comment: "หน่วยงานที่รับผิดชอบจัดการฝึกอบรม/ดูงาน ",
2024-03-12 14:53:15 +07:00
default: null,
})
department: string;
@Column({
nullable: true,
length: 200,
comment: "รวมระยะเวลาในการฝึกอบรม/ดูงาน ",
2024-03-12 14:53:15 +07:00
default: null,
})
duration: string;
@Column({
nullable: true,
length: 200,
comment: "ชื่อโครงการ/หลักสูตรการฝึกอบรม ",
2024-03-12 14:53:15 +07:00
default: null,
})
name: string;
@Column({
nullable: true,
comment: "ปีที่อบรม (พ.ศ.) ",
2024-03-12 14:53:15 +07:00
default: null,
})
yearly: number;
2024-03-21 14:19:42 +07:00
@Column({
nullable: true,
comment: "ประเภทช่วงเวลาการศึกษา",
default: null,
})
isDate: boolean;
@Column({
nullable: true,
length: 40,
comment: "ไอดีโครงการ/หลักสูตรการฝึกอบรม",
default: null,
})
developmentId: string;
2024-03-18 17:23:59 +07:00
@OneToMany(
() => ProfileTrainingHistory,
(profileTrainingHistory) => profileTrainingHistory.histories,
)
2024-03-12 14:53:15 +07:00
profileTrainingHistories: ProfileTrainingHistory[];
@ManyToOne(() => Profile, (profile) => profile.profileTrainings)
@JoinColumn({ name: "profileId" })
profile: Profile;
2024-05-13 15:06:52 +07:00
@ManyToOne(() => ProfileEmployee, (ProfileEmployee) => ProfileEmployee.profileTrainings)
@JoinColumn({ name: "profileEmployeeId" })
profileEmployee: ProfileEmployee;
2024-03-12 14:53:15 +07:00
}
export class CreateProfileTraining {
profileId: string | null;
startDate: Date | null;
endDate: Date | null;
numberOrder: string | null;
topic: string | null;
place: string | null;
dateOrder: Date | null;
department: string | null;
duration: string | null;
name: string | null;
yearly: number | null;
isDate: boolean | null;
developmentId?: string | null;
}
export class CreateProfileEmployeeTraining {
profileEmployeeId: string | null;
2024-03-12 14:53:15 +07:00
startDate: Date | null;
endDate: Date | null;
2024-03-18 17:23:59 +07:00
numberOrder: string | null;
2024-03-12 14:53:15 +07:00
topic: string | null;
place: string | null;
dateOrder: Date | null;
department: string | null;
duration: string | null;
name: string | null;
yearly: number | null;
2024-03-21 14:19:42 +07:00
isDate: boolean | null;
developmentId?: string | null;
2024-03-12 14:53:15 +07:00
}
2024-03-18 17:23:59 +07:00
export type UpdateProfileTraining = {
startDate?: Date | null;
endDate?: Date | null;
numberOrder?: string | null;
topic?: string | null;
place?: string | null;
2024-03-18 17:23:59 +07:00
dateOrder?: Date | null;
department?: string | null;
duration?: string | null;
name?: string | null;
yearly?: number | null;
2024-03-21 14:19:42 +07:00
isDate?: boolean | null;
2024-03-18 17:23:59 +07:00
};