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, OneToMany, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base";
import { Profile } from "./Profile";
import { ProfileChangeNameHistory } from "./ProfileChangeNameHistory";
import { ProfileEmployee } from "./ProfileEmployee";
// import { ProfileChangeNameHistory } from "./ProfileChangeNameHistory";
@Entity("profileChangeName")
@ -62,15 +63,23 @@ export class ProfileChangeName extends EntityBase {
})
documentId: string;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง ProfileEmployee",
default: null,
})
profileEmployeeId: string;
@OneToMany(
() => ProfileChangeNameHistory,
(profileChangeNameHistory) => profileChangeNameHistory.histories,
)
profileChangeNameHistories: ProfileChangeNameHistory[];
// @ManyToOne(() => Profile, (profile) => profile.profileChangeName)
// @JoinColumn({ name: "profileId" })
// profile: Profile;
@ManyToOne(() => ProfileEmployee, (ProfileEmployee) => ProfileEmployee.profileChangeNames)
@JoinColumn({ name: "profileEmployeeId" })
profileEmployee: ProfileEmployee;
}
export class CreateProfileChangeName {