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

@ -2,6 +2,7 @@ import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { Profile } from "./Profile";
import { ProfileEducationHistory } from "./ProfileEducationHistory";
import { ProfileEmployee } from "./ProfileEmployee";
@Entity("profileEducation")
export class ProfileEducation extends EntityBase {
@ -159,6 +160,14 @@ export class ProfileEducation extends EntityBase {
})
isEducation: boolean;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง ProfileEmployee",
default: null,
})
profileEmployeeId: string;
@OneToMany(
() => ProfileEducationHistory,
(profileEducationHistory) => profileEducationHistory.histories,
@ -168,6 +177,10 @@ export class ProfileEducation extends EntityBase {
@ManyToOne(() => Profile, (profile) => profile.profileEducations)
@JoinColumn({ name: "profileId" })
profile: Profile;
@ManyToOne(() => ProfileEmployee, (ProfileEmployee) => ProfileEmployee.profileEducations)
@JoinColumn({ name: "profileEmployeeId" })
profileEmployee: ProfileEmployee;
}
export class CreateProfileEducation {