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 { 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;

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 { 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[];