diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index 1b1d3a86..b39fea16 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -31,9 +31,15 @@ import { OrgRevision } from "../entities/OrgRevision"; import { PosMaster } from "../entities/PosMaster"; import { PosLevel } from "../entities/PosLevel"; import { PosType } from "../entities/PosType"; -import { calculateAge, calculateRetireDate, calculateRetireLaw, calculateRetireYear } from "../interfaces/utils"; +import { + calculateAge, + calculateRetireDate, + calculateRetireLaw, + calculateRetireYear, +} from "../interfaces/utils"; import { RequestWithUser } from "../middlewares/user"; import { Position } from "../entities/Position"; +import { ProfileEmployee } from "../entities/ProfileEmployee"; @Route("api/v1/org/profile") @Tags("Profile") @@ -47,6 +53,7 @@ export class ProfileController extends Controller { private orgRevisionRepo = AppDataSource.getRepository(OrgRevision); private posMasterRepo = AppDataSource.getRepository(PosMaster); private profileRepo = AppDataSource.getRepository(Profile); + private profileEmpRepo = AppDataSource.getRepository(ProfileEmployee); private profileHistoryRepo = AppDataSource.getRepository(ProfileHistory); private posLevelRepo = AppDataSource.getRepository(PosLevel); private posTypeRepo = AppDataSource.getRepository(PosType); @@ -1214,7 +1221,7 @@ export class ProfileController extends Controller { @Request() request: { user: Record }, @Path() id: string, ) { - const profile = await this.profileRepo.findOne({ + const profile = await this.profileEmpRepo.findOne({ where: { id: id }, relations: ["posLevel", "posType", "current_holders", "current_holders.orgRoot"], });