diff --git a/src/controllers/ProfileSalaryEmployeeController.ts b/src/controllers/ProfileSalaryEmployeeController.ts index 3a5e3133..6ffecd18 100644 --- a/src/controllers/ProfileSalaryEmployeeController.ts +++ b/src/controllers/ProfileSalaryEmployeeController.ts @@ -23,6 +23,7 @@ import HttpError from "../interfaces/http-error"; import { ProfileSalaryHistory } from "../entities/ProfileSalaryHistory"; import { RequestWithUser } from "../middlewares/user"; import { ProfileEmployee } from "../entities/ProfileEmployee"; +import { Profile } from "../entities/Profile"; import { In, LessThan, MoreThan } from "typeorm"; import permission from "../interfaces/permission"; import { setLogDataDiff } from "../interfaces/utils"; @@ -32,6 +33,7 @@ import { Command } from "../entities/Command"; @Security("bearerAuth") export class ProfileSalaryEmployeeController extends Controller { private profileRepo = AppDataSource.getRepository(ProfileEmployee); + private profileGovementRepo = AppDataSource.getRepository(Profile); private salaryRepo = AppDataSource.getRepository(ProfileSalary); private salaryHistoryRepo = AppDataSource.getRepository(ProfileSalaryHistory); private commandRepository = AppDataSource.getRepository(Command); @@ -363,7 +365,7 @@ export class ProfileSalaryEmployeeController extends Controller { if (_command?.isBangkok == "OFFICE") _posNumCodeSit = "สำนักปลัดกรุงเทพมหานคร" else if (_command?.isBangkok == "BANGKOK") _posNumCodeSit = "กรุงเทพมหานคร" else { - let _profileAdmin = await this.profileRepo.findOne({ + let _profileAdmin = await this.profileGovementRepo.findOne({ where: { keycloak: _command?.createdUserId.toString()}, relations: ["current_holders", "current_holders.orgRoot",] });