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

44 lines
1.2 KiB
TypeScript
Raw Normal View History

2024-06-07 12:59:55 +07:00
import { Entity, Column, OneToMany, ManyToOne, JoinColumn } from "typeorm";
2024-06-07 10:50:31 +07:00
import { EntityBase } from "./base/Base";
2024-06-07 12:59:55 +07:00
import { ProfileEmployee } from "./ProfileEmployee"
2024-06-07 10:50:31 +07:00
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;
2024-06-07 12:59:55 +07:00
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง ProfileEmployee",
default: null,
})
profileEmployeeId: string;
2024-06-07 10:50:31 +07:00
2024-06-07 12:59:55 +07:00
@ManyToOne(() => ProfileEmployee, (v) => v.profileEmployeeEmployment)
@JoinColumn({ name: "profileEmployeeId" })
profileEmployee: ProfileEmployee;
2024-06-07 10:50:31 +07:00
@OneToMany(() => ProfileEmployeeEmploymentHistory, (v) => v.profileEmployeeEmployment)
histories: ProfileEmployeeEmploymentHistory[];
}
export class CreateEmploymentProfileEmployee {
date: Date | null;
command: string | null;
}