diff --git a/src/controllers/ProfileSalaryEmployeeController.ts b/src/controllers/ProfileSalaryEmployeeController.ts index fe23df2b..ceeb0110 100644 --- a/src/controllers/ProfileSalaryEmployeeController.ts +++ b/src/controllers/ProfileSalaryEmployeeController.ts @@ -67,7 +67,7 @@ export class ProfileSalaryEmployeeController extends Controller { } const dest_item = await this.salaryRepo.findOne({ - where: { profileId: body.profileEmployeeId }, + where: { profileEmployeeId: body.profileEmployeeId }, order: { order: "DESC" }, }); diff --git a/src/entities/ProfileSalary.ts b/src/entities/ProfileSalary.ts index 1f568f7d..3feac6ac 100644 --- a/src/entities/ProfileSalary.ts +++ b/src/entities/ProfileSalary.ts @@ -148,6 +148,10 @@ export class ProfileSalary extends EntityBase { @ManyToOne(() => Profile, (profile) => profile.profileSalary) @JoinColumn({ name: "profileId" }) profile: Profile; + + @ManyToOne(() => ProfileEmployee, (ProfileEmployee) => ProfileEmployee.profileSalarys) + @JoinColumn({ name: "profileEmployeeId" }) + profileEmployee: ProfileEmployee; } export class CreateProfileSalary { diff --git a/src/entities/ProfileSalaryHistory.ts b/src/entities/ProfileSalaryHistory.ts index b1101d07..6cfdb49a 100644 --- a/src/entities/ProfileSalaryHistory.ts +++ b/src/entities/ProfileSalaryHistory.ts @@ -14,13 +14,6 @@ import { ProfileSalary } from "./ProfileSalary"; @Entity("profileSalaryHistory") export class ProfileSalaryHistory extends EntityBase { - @Column({ - length: 40, - comment: "คีย์นอก(FK)ของตาราง profile", - type: "uuid", - }) - profileId: string; - @Column({ comment: "วันที่", type: "datetime",