get profile by keycloak

This commit is contained in:
Kittapath 2024-05-17 17:14:41 +07:00
parent 71cbecdce0
commit 2cfef7abd6

View file

@ -847,6 +847,36 @@ export class ProfileController extends Controller {
? null ? null
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id); : profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id);
const root =
profile.current_holders == null ||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgRoot == null
? null
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgRoot;
const child1 =
profile.current_holders == null ||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild1 ==
null
? null
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild1;
const child2 =
profile.current_holders == null ||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild2 ==
null
? null
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild2;
const child3 =
profile.current_holders == null ||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild3 ==
null
? null
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild3;
const child4 =
profile.current_holders == null ||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild4 ==
null
? null
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild4;
const position = await this.positionRepository.findOne({ const position = await this.positionRepository.findOne({
relations: ["posExecutive"], relations: ["posExecutive"],
where: { where: {
@ -861,8 +891,10 @@ export class ProfileController extends Controller {
firstName: profile.firstName, firstName: profile.firstName,
lastName: profile.lastName, lastName: profile.lastName,
citizenId: profile.citizenId, citizenId: profile.citizenId,
birthDate: profile.birthDate,
position: profile.position, position: profile.position,
posMaster: posMaster == null ? null : posMaster.posMasterNo, posMaster: posMaster == null ? null : posMaster.posMasterNo,
posMasterNo: posMaster == null ? null : posMaster.posMasterNo,
posLevelName: profile.posLevel == null ? null : profile.posLevel.posLevelName, posLevelName: profile.posLevel == null ? null : profile.posLevel.posLevelName,
posLevelRank: profile.posLevel == null ? null : profile.posLevel.posLevelRank, posLevelRank: profile.posLevel == null ? null : profile.posLevel.posLevelRank,
posLevelId: profile.posLevel == null ? null : profile.posLevel.id, posLevelId: profile.posLevel == null ? null : profile.posLevel.id,
@ -879,76 +911,21 @@ export class ProfileController extends Controller {
: position.posExecutive.posExecutivePriority, : position.posExecutive.posExecutivePriority,
posExecutiveId: posExecutiveId:
position == null || position.posExecutive == null ? null : position.posExecutive.id, position == null || position.posExecutive == null ? null : position.posExecutive.id,
rootId: rootId: root == null ? null : root.id,
profile.current_holders == null || root: root == null ? null : root.orgRootName,
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgRoot == rootShortName: root == null ? null : root.orgRootShortName,
null child1Id: child1 == null ? null : child1.id,
? null child1: child1 == null ? null : child1.orgChild1Name,
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id) child1ShortName: child1 == null ? null : child1.orgChild1ShortName,
?.orgRootId, child2Id: child2 == null ? null : child2.id,
root: child2: child2 == null ? null : child2.orgChild2Name,
profile.current_holders == null || child2ShortName: child2 == null ? null : child2.orgChild2ShortName,
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgRoot == child3Id: child3 == null ? null : child3.id,
null child3: child3 == null ? null : child3.orgChild3Name,
? null child3ShortName: child3 == null ? null : child3.orgChild3ShortName,
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgRoot child4Id: child4 == null ? null : child4.id,
.orgRootName, child4: child4 == null ? null : child4.orgChild4Name,
child1Id: child4ShortName: child4 == null ? null : child4.orgChild4ShortName,
profile.current_holders == null ||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild1 ==
null
? null
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)
?.orgChild1Id,
child1:
profile.current_holders == null ||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild1 ==
null
? null
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild1
.orgChild1Name,
child2Id:
profile.current_holders == null ||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild2 ==
null
? null
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)
?.orgChild2Id,
child2:
profile.current_holders == null ||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild2 ==
null
? null
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild2
.orgChild2Name,
child3Id:
profile.current_holders == null ||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild3 ==
null
? null
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)
?.orgChild3Id,
child3:
profile.current_holders == null ||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild3 ==
null
? null
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild3
.orgChild3Name,
child4Id:
profile.current_holders == null ||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild4 ==
null
? null
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)
?.orgChild4Id,
child4:
profile.current_holders == null ||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild4 ==
null
? null
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild4
.orgChild4Name,
node: null, node: null,
nodeId: null, nodeId: null,
}; };