relation profileEmployee

This commit is contained in:
Bright 2024-05-13 15:06:52 +07:00
parent a2d3e95641
commit 59607aafd1
6 changed files with 85 additions and 1 deletions

View file

@ -1,6 +1,7 @@
import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { Profile } from "./Profile";
import { ProfileEmployee } from "./ProfileEmployee";
import { ProfileHonorHistory } from "./ProfileHonorHistory";
@Entity("profileHonor")
@ -13,6 +14,14 @@ export class ProfileHonor extends EntityBase {
})
profileId: string;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง ProfileEmployee",
default: null,
})
profileEmployeeId: string;
@Column({
nullable: true,
length: 2000,
@ -66,6 +75,10 @@ export class ProfileHonor extends EntityBase {
@ManyToOne(() => Profile, (profile) => profile.profileHonors)
@JoinColumn({ name: "profileId" })
profile: Profile;
@ManyToOne(() => ProfileEmployee, (ProfileEmployee) => ProfileEmployee.profileHonors)
@JoinColumn({ name: "profileEmployeeId" })
profileEmployee: ProfileEmployee;
}
export class CreateProfileHonor {