update relation

This commit is contained in:
Bright 2024-06-07 12:59:55 +07:00
parent 709417bd2f
commit c1d73486af
2 changed files with 25 additions and 7 deletions

View file

@ -23,12 +23,14 @@ import { ProfileGovernment } from "./ProfileGovernment";
import { ProfileFamilyFather } from "./ProfileFamilyFather"; import { ProfileFamilyFather } from "./ProfileFamilyFather";
import { ProfileFamilyMother } from "./ProfileFamilyMother"; import { ProfileFamilyMother } from "./ProfileFamilyMother";
import { ProfileFamilyCouple } from "./ProfileFamilyCouple"; import { ProfileFamilyCouple } from "./ProfileFamilyCouple";
import { ProfileEmployeeInformationHistory } from "./ProfileEmployeeInformationHistory"
import { ProfileChildren } from "./ProfileChildren"; import { ProfileChildren } from "./ProfileChildren";
import { Profile, ProfileAddressHistory } from "./Profile"; import { Profile, ProfileAddressHistory } from "./Profile";
import { Province } from "./Province"; import { Province } from "./Province";
import { District } from "./District"; import { District } from "./District";
import { SubDistrict } from "./SubDistrict"; import { SubDistrict } from "./SubDistrict";
import { ProfileEmployeeInformationHistory } from "./ProfileEmployeeInformationHistory"
import { ProfileEmployeeEmployment } from "./ProfileEmployeeEmployment"
@Entity("profileEmployee") @Entity("profileEmployee")
export class ProfileEmployee extends EntityBase { export class ProfileEmployee extends EntityBase {
@Column({ @Column({
@ -566,6 +568,9 @@ export class ProfileEmployee extends EntityBase {
@OneToMany(() => ProfileEmployeeInformationHistory, (v) => v.profileEmployeeInformation) @OneToMany(() => ProfileEmployeeInformationHistory, (v) => v.profileEmployeeInformation)
information_histories: ProfileEmployeeInformationHistory[]; information_histories: ProfileEmployeeInformationHistory[];
@OneToMany(() => ProfileEmployeeEmployment, (v) => v.profileEmployee)
profileEmployeeEmployment: ProfileEmployeeEmployment[];
@OneToMany(() => EmployeePosMaster, (v) => v.current_holder) @OneToMany(() => EmployeePosMaster, (v) => v.current_holder)
current_holders: EmployeePosMaster[]; current_holders: EmployeePosMaster[];
@ -577,7 +582,7 @@ export class ProfileEmployee extends EntityBase {
@OneToMany(() => ProfileCertificate, (v) => v.profileEmployee) @OneToMany(() => ProfileCertificate, (v) => v.profileEmployee)
profileCertificates: ProfileCertificate[]; profileCertificates: ProfileCertificate[];
@OneToMany(() => ProfileTraining, (v) => v.profileEmployee) @OneToMany(() => ProfileTraining, (v) => v.profileEmployee)
profileTrainings: ProfileTraining[]; profileTrainings: ProfileTraining[];
@ -782,10 +787,10 @@ export class CreateProfileEmployee {
employeeClass?: string | null; employeeClass?: string | null;
} }
export class CreateInformationProfileEmployee { export class UpdateInformationProfileEmployee {
positionEmployeeGroupId?: string | null; positionEmployeeGroupId: string | null;
positionEmployeeLineId?: string | null; positionEmployeeLineId: string | null;
positionEmployeePositionId?: string | null; positionEmployeePositionId: string | null;
employeeOc?: string | null; employeeOc?: string | null;
employeeTypeIndividual?: string | null; employeeTypeIndividual?: string | null;
employeeWage?: string | null; employeeWage?: string | null;

View file

@ -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 { EntityBase } from "./base/Base";
import { ProfileEmployee } from "./ProfileEmployee"
import { ProfileEmployeeEmploymentHistory } from "./ProfileEmployeeEmploymentHistory" import { ProfileEmployeeEmploymentHistory } from "./ProfileEmployeeEmploymentHistory"
@Entity("profileEmployeeEmployment") @Entity("profileEmployeeEmployment")
@ -18,7 +19,19 @@ export class ProfileEmployeeEmployment extends EntityBase {
default: null, default: null,
}) })
command: string; 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) @OneToMany(() => ProfileEmployeeEmploymentHistory, (v) => v.profileEmployeeEmployment)
histories: ProfileEmployeeEmploymentHistory[]; histories: ProfileEmployeeEmploymentHistory[];