fix and relation emp

This commit is contained in:
AdisakKanthawilang 2024-05-13 17:21:19 +07:00
parent 497db161c4
commit c441df3dc9
5 changed files with 72 additions and 4 deletions

View file

@ -1,6 +1,7 @@
import { Column, Entity, ManyToOne, OneToMany } from "typeorm";
import { Column, Entity, ManyToOne, OneToMany, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base";
import { Profile } from "./Profile";
import { ProfileEmployee } from "./ProfileEmployee";
@Entity("profileFamilyHistory")
export class ProfileFamilyHistory extends EntityBase {
@ -155,11 +156,23 @@ export class ProfileFamilyHistory extends EntityBase {
})
profileId: string;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง ProfileEmployee",
default: null,
})
profileEmployeeId: string;
@ManyToOne(() => Profile, (v) => v.profileFamily)
profile: Profile;
@OneToMany(() => ProfileChildrenHistory, (v) => v.profileFamilyHistory)
profileChildrenHistories: ProfileChildrenHistory[];
@ManyToOne(() => ProfileEmployee, (ProfileEmployee) => ProfileEmployee.profileFamilys)
@JoinColumn({ name: "profileEmployeeId" })
profileEmployee: ProfileEmployee;
}
@Entity("profileChildren")