From 9b186108225bd33e0734e778cd347d6657791374 Mon Sep 17 00:00:00 2001 From: Bright Date: Tue, 19 Aug 2025 17:03:16 +0700 Subject: [PATCH] relation --- src/entities/Profile.ts | 4 ++++ src/entities/ProfileChangeName.ts | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/src/entities/Profile.ts b/src/entities/Profile.ts index c553eb62..f82bd7d2 100644 --- a/src/entities/Profile.ts +++ b/src/entities/Profile.ts @@ -49,6 +49,7 @@ import { ProfileActposition } from "./ProfileActposition"; import { ProfileAssistance } from "./ProfileAssistance"; import { ProfileSalaryTemp } from "./ProfileSalaryTemp"; import { PositionSalaryEditHistory } from "./PositionSalaryEditHistory"; +import { ProfileChangeName } from "./ProfileChangeName"; @Entity("profile") export class Profile extends EntityBase { @@ -522,6 +523,9 @@ export class Profile extends EntityBase { @OneToMany(() => PositionSalaryEditHistory, (v) => v.profile) positionSalaryEditHistory: PositionSalaryEditHistory[]; + @OneToMany(() => ProfileChangeName, (v) => v.profile) + profileChangeNames: ProfileChangeName[]; + @ManyToOne(() => PosLevel, (posLevel) => posLevel.profiles) @JoinColumn({ name: "posLevelId" }) posLevel: PosLevel; diff --git a/src/entities/ProfileChangeName.ts b/src/entities/ProfileChangeName.ts index d07f995b..74767fa2 100644 --- a/src/entities/ProfileChangeName.ts +++ b/src/entities/ProfileChangeName.ts @@ -2,6 +2,7 @@ import { Entity, Column, OneToMany, ManyToOne, JoinColumn } from "typeorm"; import { EntityBase } from "./base/Base"; import { ProfileChangeNameHistory } from "./ProfileChangeNameHistory"; import { ProfileEmployee } from "./ProfileEmployee"; +import { Profile } from "./Profile"; // import { ProfileChangeNameHistory } from "./ProfileChangeNameHistory"; @Entity("profileChangeName") @@ -85,6 +86,10 @@ export class ProfileChangeName extends EntityBase { @ManyToOne(() => ProfileEmployee, (ProfileEmployee) => ProfileEmployee.profileChangeNames) @JoinColumn({ name: "profileEmployeeId" }) profileEmployee: ProfileEmployee; + + @ManyToOne(() => Profile, (Profile) => Profile.profileChangeNames) + @JoinColumn({ name: "profileId" }) + profile: Profile; } export class CreateProfileChangeName {