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

106 lines
2.3 KiB
TypeScript

import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { ProfileEmployee } from "./ProfileEmployee";
import { ProfileDisciplineEmployeeHistory } from "./ProfileDisciplineEmployeeHistory";
@Entity("profileDisciplineEmployee")
export class ProfileDisciplineEmployee extends EntityBase {
@Column({
nullable: true,
type: "datetime",
comment: "วันที่",
default: null,
})
date: Date;
@Column({
length: 40,
comment: "ไอดีโปรไฟล์",
type: "uuid",
})
profileId: string;
@Column({
comment: "สถานะการใช้งาน",
default: false,
})
isActive: boolean;
@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(
() => ProfileDisciplineEmployeeHistory,
(profileDisciplineHistory) => profileDisciplineHistory.histories,
)
profileDisciplineHistories: ProfileDisciplineEmployeeHistory[];
@ManyToOne(() => ProfileEmployee, (profile) => profile.profileDiscipline)
@JoinColumn({ name: "profileId" })
profile: ProfileEmployee;
}
export class CreateProfileDisciplineEmployee {
@Column()
date: Date | null;
@Column()
profileId: string;
@Column()
isActive: boolean | null;
@Column()
level: string | null;
@Column()
detail: string | null;
@Column()
refCommandDate: Date | null;
@Column()
refCommandNo: string | null;
@Column()
unStigma: string | null;
}
export type UpdateProfileDisciplineEmployee = Partial<CreateProfileDisciplineEmployee>;