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 { ProfileAbilityHistory } from "./ProfileAbilityHistory";
import { ProfileEmployee } from "./ProfileEmployee";
@Entity("profileAbility")
export class ProfileAbility extends EntityBase {
@ -61,6 +62,14 @@ export class ProfileAbility extends EntityBase {
})
field: string;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง ProfileEmployee",
default: null,
})
profileEmployeeId: string;
@OneToMany(
() => ProfileAbilityHistory,
(profileAbilityHistory) => profileAbilityHistory.histories,
@ -70,6 +79,10 @@ export class ProfileAbility extends EntityBase {
@ManyToOne(() => Profile, (profile) => profile.profileAbilities)
@JoinColumn({ name: "profileId" })
profile: Profile;
@ManyToOne(() => ProfileEmployee, (ProfileEmployee) => ProfileEmployee.profileAbilities)
@JoinColumn({ name: "profileEmployeeId" })
profileEmployee: ProfileEmployee;
}
export class CreateProfileAbility {