hrms-api-org/src/entities/ProfileEmployeeEmployment.ts
Suphonchai Phoonsawat 4852131651 add dpis controller
2024-10-07 14:53:27 +07:00

47 lines
1.3 KiB
TypeScript

import { Entity, Column, OneToMany, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base";
import { ProfileEmployee } from "./ProfileEmployee";
import { ProfileEmployeeEmploymentHistory } from "./ProfileEmployeeEmploymentHistory";
@Entity("profileEmployeeEmployment")
export class ProfileEmployeeEmployment extends EntityBase {
@Column({
nullable: true,
type: "datetime",
comment: "วันที่จ้าง",
default: null,
})
date: Date;
@Column({
nullable: true,
comment: "คำสั่งจ้าง",
default: null,
})
command: string;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง ProfileEmployee",
default: null,
})
profileEmployeeId: string;
@ManyToOne(() => ProfileEmployee, (v) => v.profileEmployeeEmployment)
@JoinColumn({ name: "profileEmployeeId" })
profileEmployee: ProfileEmployee;
@OneToMany(() => ProfileEmployeeEmploymentHistory, (v) => v.profileEmployeeEmployment)
histories: ProfileEmployeeEmploymentHistory[];
}
export class CreateEmploymentProfileEmployee {
date: Date | null;
command: string | null;
}
export class UpdateEmploymentProfileEmployee {
date: Date | null;
command: string | null;
}