Merge branch 'adiDev' into develop
This commit is contained in:
commit
ccb9a56423
1 changed files with 72 additions and 1 deletions
|
|
@ -1265,6 +1265,7 @@ export class WorkflowController extends Controller {
|
||||||
refId: string[];
|
refId: string[];
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
|
|
||||||
const _posMaster = await this.posMasterRepo.find({
|
const _posMaster = await this.posMasterRepo.find({
|
||||||
where: {
|
where: {
|
||||||
orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true },
|
orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true },
|
||||||
|
|
@ -1272,6 +1273,7 @@ export class WorkflowController extends Controller {
|
||||||
},
|
},
|
||||||
select: ["orgRootId", "orgChild1Id", "orgChild2Id", "orgChild3Id", "orgChild4Id"],
|
select: ["orgRootId", "orgChild1Id", "orgChild2Id", "orgChild3Id", "orgChild4Id"],
|
||||||
});
|
});
|
||||||
|
|
||||||
const _data: any = _posMaster.map((x) => ({
|
const _data: any = _posMaster.map((x) => ({
|
||||||
orgRootId: x.orgRootId,
|
orgRootId: x.orgRootId,
|
||||||
// orgChild1Id: x.orgChild1Id,
|
// orgChild1Id: x.orgChild1Id,
|
||||||
|
|
@ -1282,6 +1284,7 @@ export class WorkflowController extends Controller {
|
||||||
current_holder: Not(IsNull()),
|
current_holder: Not(IsNull()),
|
||||||
posMasterAssigns: { assignId: system.trim().toUpperCase() },
|
posMasterAssigns: { assignId: system.trim().toUpperCase() },
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const posMaster = await this.posMasterRepo.find({
|
const posMaster = await this.posMasterRepo.find({
|
||||||
where: _data,
|
where: _data,
|
||||||
relations: ["current_holder"],
|
relations: ["current_holder"],
|
||||||
|
|
@ -1294,6 +1297,74 @@ export class WorkflowController extends Controller {
|
||||||
firstName: x.current_holder.firstName,
|
firstName: x.current_holder.firstName,
|
||||||
lastName: x.current_holder.lastName,
|
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);
|
return new HttpSuccess(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue