diff --git a/src/entities/ProfileEmployee.ts b/src/entities/ProfileEmployee.ts index 74c95972..73b4e4a6 100644 --- a/src/entities/ProfileEmployee.ts +++ b/src/entities/ProfileEmployee.ts @@ -23,12 +23,14 @@ import { ProfileGovernment } from "./ProfileGovernment"; import { ProfileFamilyFather } from "./ProfileFamilyFather"; import { ProfileFamilyMother } from "./ProfileFamilyMother"; import { ProfileFamilyCouple } from "./ProfileFamilyCouple"; -import { ProfileEmployeeInformationHistory } from "./ProfileEmployeeInformationHistory" import { ProfileChildren } from "./ProfileChildren"; import { Profile, ProfileAddressHistory } from "./Profile"; import { Province } from "./Province"; import { District } from "./District"; import { SubDistrict } from "./SubDistrict"; +import { ProfileEmployeeInformationHistory } from "./ProfileEmployeeInformationHistory" +import { ProfileEmployeeEmployment } from "./ProfileEmployeeEmployment" + @Entity("profileEmployee") export class ProfileEmployee extends EntityBase { @Column({ @@ -566,6 +568,9 @@ export class ProfileEmployee extends EntityBase { @OneToMany(() => ProfileEmployeeInformationHistory, (v) => v.profileEmployeeInformation) information_histories: ProfileEmployeeInformationHistory[]; + @OneToMany(() => ProfileEmployeeEmployment, (v) => v.profileEmployee) + profileEmployeeEmployment: ProfileEmployeeEmployment[]; + @OneToMany(() => EmployeePosMaster, (v) => v.current_holder) current_holders: EmployeePosMaster[]; @@ -577,7 +582,7 @@ export class ProfileEmployee extends EntityBase { @OneToMany(() => ProfileCertificate, (v) => v.profileEmployee) profileCertificates: ProfileCertificate[]; - + @OneToMany(() => ProfileTraining, (v) => v.profileEmployee) profileTrainings: ProfileTraining[]; @@ -782,10 +787,10 @@ export class CreateProfileEmployee { employeeClass?: string | null; } -export class CreateInformationProfileEmployee { - positionEmployeeGroupId?: string | null; - positionEmployeeLineId?: string | null; - positionEmployeePositionId?: string | null; +export class UpdateInformationProfileEmployee { + positionEmployeeGroupId: string | null; + positionEmployeeLineId: string | null; + positionEmployeePositionId: string | null; employeeOc?: string | null; employeeTypeIndividual?: string | null; employeeWage?: string | null; diff --git a/src/entities/ProfileEmployeeEmployment.ts b/src/entities/ProfileEmployeeEmployment.ts index 645b900f..379c5744 100644 --- a/src/entities/ProfileEmployeeEmployment.ts +++ b/src/entities/ProfileEmployeeEmployment.ts @@ -1,5 +1,6 @@ -import { Entity, Column, OneToMany, ManyToOne } from "typeorm"; +import { Entity, Column, OneToMany, ManyToOne, JoinColumn } from "typeorm"; import { EntityBase } from "./base/Base"; +import { ProfileEmployee } from "./ProfileEmployee" import { ProfileEmployeeEmploymentHistory } from "./ProfileEmployeeEmploymentHistory" @Entity("profileEmployeeEmployment") @@ -18,7 +19,19 @@ export class ProfileEmployeeEmployment extends EntityBase { 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[];