เพิ่มฟิลด์ ProfileGovernment.profileEmployeeId

This commit is contained in:
Bright 2024-05-14 12:00:08 +07:00
parent b766112870
commit 4888b36eb1
2 changed files with 215 additions and 4 deletions

View file

@ -1,7 +1,7 @@
import { Column, Entity, ManyToOne } from "typeorm";
import { Column, Entity, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base";
import { Profile } from "./Profile";
import { ProfileEmployee } from "./ProfileEmployee";
@Entity("profileGovernment")
export class ProfileGovernment extends EntityBase {
@Column({
@ -12,8 +12,13 @@ export class ProfileGovernment extends EntityBase {
})
profileId: string;
@ManyToOne(() => Profile, (v) => v.profileGovernment)
profile: Profile;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง ProfileEmployee",
default: null,
})
profileEmployeeId: string;
@Column({
nullable: true,
@ -52,6 +57,14 @@ export class ProfileGovernment extends EntityBase {
default: null,
})
reasonSameDate: string;
@ManyToOne(() => Profile, (v) => v.profileGovernment)
@JoinColumn({ name: "profileId" })
profile: Profile;
@ManyToOne(() => ProfileEmployee, (ProfileEmployee) => ProfileEmployee.profileTrainings)
@JoinColumn({ name: "profileEmployeeId" })
profileEmployee: ProfileEmployee;
}
export type CreateProfileGovernment = {
@ -61,6 +74,13 @@ export type CreateProfileGovernment = {
reasonSameDate?: string | null;
};
export type CreateProfileEmployeeGovernment = {
profileEmployeeId: string;
dateAppoint?: Date | null;
dateStart?: Date | null;
reasonSameDate?: string | null;
};
export type UpdateProfileGovernment = {
dateAppoint?: Date | null;
dateStart?: Date | null;