Merge branch 'develop' of github.com:Frappet/hrms-api-org into develop

This commit is contained in:
mamoss 2025-04-23 09:33:33 +07:00
commit 9d435b34b1
2 changed files with 76 additions and 1 deletions

View file

@ -2018,6 +2018,8 @@ export class ProfileEmployeeController extends Controller {
// let _child4 = child4?.orgChild4Name;
return {
id: _data.id,
avatar: _data.avatar,
avatarName: _data.avatarName,
prefix: _data.prefix,
rank: _data.rank,
firstName: _data.firstName,
@ -2431,6 +2433,8 @@ export class ProfileEmployeeController extends Controller {
let _child4 = child4?.orgChild4Name;
return {
id: _data.id,
avatar: _data.avatar,
avatarName: _data.avatarName,
prefix: _data.prefix,
rank: _data.rank,
firstName: _data.firstName,

View file

@ -1265,6 +1265,7 @@ export class WorkflowController extends Controller {
refId: string[];
},
) {
const _posMaster = await this.posMasterRepo.find({
where: {
orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true },
@ -1272,6 +1273,7 @@ export class WorkflowController extends Controller {
},
select: ["orgRootId", "orgChild1Id", "orgChild2Id", "orgChild3Id", "orgChild4Id"],
});
const _data: any = _posMaster.map((x) => ({
orgRootId: x.orgRootId,
// orgChild1Id: x.orgChild1Id,
@ -1282,11 +1284,12 @@ export class WorkflowController extends Controller {
current_holder: Not(IsNull()),
posMasterAssigns: { assignId: system.trim().toUpperCase() },
}));
const posMaster = await this.posMasterRepo.find({
where: _data,
relations: ["current_holder"],
});
const data = posMaster.map((x) => ({
id: x.current_holder.id,
citizenId: x.current_holder.citizenId,
@ -1294,6 +1297,74 @@ export class WorkflowController extends Controller {
firstName: x.current_holder.firstName,
lastName: x.current_holder.lastName,
}));
return new HttpSuccess(data);
}
/**
* API keycloak
*
* @summary keycloak
*
*/
@Post("find/director-with-keycloak/{system}")
async getProfileDirectorByKeycloakIdSystem(
@Request() req: RequestWithUser,
@Path() system: string,
@Body()
body: {
refId: string[];
},
) {
const profileWithKc = await this.profileRepo.find({
where:{
keycloak: In(body.refId)
}
})
const profileIds = profileWithKc.map((p) => p.id);
const _posMaster = await this.posMasterRepo.find({
where: {
orgRevision: {
orgRevisionIsDraft: false,
orgRevisionIsCurrent: true,
},
current_holderId: In(profileIds),
},
select: [
"orgRootId",
"orgChild1Id",
"orgChild2Id",
"orgChild3Id",
"orgChild4Id",
],
})
const _data: any = _posMaster.map((x) => ({
orgRootId: x.orgRootId,
// orgChild1Id: x.orgChild1Id,
// orgChild2Id: x.orgChild2Id,
// orgChild3Id: x.orgChild3Id,
// orgChild4Id: x.orgChild4Id,
// isDirector: true,
current_holder: Not(IsNull()),
posMasterAssigns: { assignId: system.trim().toUpperCase() },
}));
const posMaster = await this.posMasterRepo.find({
where: _data,
relations: ["current_holder"],
});
const data = posMaster.map((x) => ({
id: x.current_holder.id,
citizenId: x.current_holder.citizenId,
prefix: x.current_holder.prefix,
firstName: x.current_holder.firstName,
lastName: x.current_holder.lastName,
}));
return new HttpSuccess(data);
}
}