hrms-api-org/src/entities/ProfileDiscipline.ts
2024-05-16 09:35:11 +07:00

116 lines
2.7 KiB
TypeScript

import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { Profile } from "./Profile";
import { ProfileEmployee } from "./ProfileEmployee";
import { ProfileDisciplineHistory } from "./ProfileDisciplineHistory";
@Entity("profileDiscipline")
export class ProfileDiscipline extends EntityBase {
@Column({
nullable: true,
type: "datetime",
comment: "วันที่",
default: null,
})
date: Date;
@Column({
nullable: true,
length: 40,
comment: "ไอดีโปรไฟล์",
type: "uuid",
})
profileId: string;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง ProfileEmployee",
default: null,
})
profileEmployeeId: string;
@Column({
nullable: true,
comment: "ระดับความผิด",
type: "text",
default: null,
})
level: string;
@Column({
nullable: true,
comment: "รายละเอียด",
type: "text",
default: null,
})
detail: 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: "ล้างมลทิน",
type: "text",
default: null,
})
unStigma: string;
@OneToMany(
() => ProfileDisciplineHistory,
(profileDisciplineHistory) => profileDisciplineHistory.histories,
)
profileDisciplineHistories: ProfileDisciplineHistory[];
@ManyToOne(() => Profile, (profile) => profile.profileDisciplines)
@JoinColumn({ name: "profileId" })
profile: Profile;
@ManyToOne(() => ProfileEmployee, (ProfileEmployee) => ProfileEmployee.profileDisciplines)
@JoinColumn({ name: "profileEmployeeId" })
profileEmployee: ProfileEmployee;
}
export class CreateProfileDiscipline {
date: Date | null;
profileId: string;
level: string | null;
detail: string | null;
refCommandDate: Date | null;
refCommandNo: string | null;
unStigma: string | null;
}
export class CreateProfileEmployeeDiscipline {
date: Date | null;
profileEmployeeId: string | null;
level: string | null;
detail: string | null;
refCommandDate: Date | null;
refCommandNo: string | null;
unStigma: string | null;
}
export type UpdateProfileDiscipline = {
date?: Date | null;
level?: string | null;
detail?: string | null;
refCommandDate?: Date | null;
refCommandNo?: string | null;
unStigma?: string | null;
};