From 70b9180d28031842b2e92ff45adb8f808f24adf8 Mon Sep 17 00:00:00 2001 From: kittapath Date: Mon, 3 Feb 2025 14:55:26 +0700 Subject: [PATCH] position add dna --- src/controllers/ProfileController.ts | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index 2c234b72..4370e327 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -1153,7 +1153,7 @@ export class ProfileController extends Controller { where: { keycloak: request.user.sub }, }); const posMaster = await this.posMasterRepo.findOne({ - where: { + where: { current_holderId: profile?.id, orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true }, }, @@ -1872,9 +1872,9 @@ export class ProfileController extends Controller { }); const posMaster = await this.posMasterRepo.findOne({ - where: { + where: { current_holderId: profile?.id, - orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true }, + orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true }, }, }); if (!posMaster) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลการครองตำแหน่ง"); @@ -4752,7 +4752,7 @@ export class ProfileController extends Controller { : isRetire == true && retireType != undefined && retireType != null ? `profile.dateLeave IS NOT NULL AND profile.leaveType = '${retireType}'` : `profile.dateLeave IS NOT NULL` - : "1=1" + : "1=1", ) .andWhere(nodeCondition, { nodeId: nodeId, @@ -5351,6 +5351,7 @@ export class ProfileController extends Controller { child4ShortName: child4 == null ? null : child4.orgChild4ShortName, node: null, nodeId: null, + nodeDnaId: null, type: profile.employeeClass, salary: profile.amount, posNo: @@ -5361,22 +5362,27 @@ export class ProfileController extends Controller { if (_profile.child4Id != null) { _profile.node = 4; _profile.nodeId = _profile.child4Id; + _profile.nodeDnaId = _profile.child4DnaId; _profile.nodeShortName = _profile.child4ShortName; } else if (_profile.child3Id != null) { _profile.node = 3; _profile.nodeId = _profile.child3Id; + _profile.nodeDnaId = _profile.child3DnaId; _profile.nodeShortName = _profile.child3ShortName; } else if (_profile.child2Id != null) { _profile.node = 2; _profile.nodeId = _profile.child2Id; + _profile.nodeDnaId = _profile.child2DnaId; _profile.nodeShortName = _profile.child2ShortName; } else if (_profile.child1Id != null) { _profile.node = 1; _profile.nodeId = _profile.child1Id; + _profile.nodeDnaId = _profile.child1DnaId; _profile.nodeShortName = _profile.child1ShortName; } else if (_profile.rootId != null) { _profile.node = 0; _profile.nodeId = _profile.rootId; + _profile.nodeDnaId = _profile.rootDnaId; _profile.nodeShortName = _profile.rootShortName; } return new HttpSuccess(_profile); @@ -5502,6 +5508,7 @@ export class ProfileController extends Controller { child4ShortName: child4 == null ? null : child4.orgChild4ShortName, node: null, nodeId: null, + nodeDnaId: null, salary: profile ? profile.amount : null, amountSpecial: profile ? profile.amountSpecial : null, posNo: @@ -5513,22 +5520,27 @@ export class ProfileController extends Controller { if (_profile.child4Id != null) { _profile.node = 4; _profile.nodeId = _profile.child4Id; + _profile.nodeDnaId = _profile.child4DnaId; _profile.nodeShortName = _profile.child4ShortName; } else if (_profile.child3Id != null) { _profile.node = 3; _profile.nodeId = _profile.child3Id; + _profile.nodeDnaId = _profile.child3DnaId; _profile.nodeShortName = _profile.child3ShortName; } else if (_profile.child2Id != null) { _profile.node = 2; _profile.nodeId = _profile.child2Id; + _profile.nodeDnaId = _profile.child2DnaId; _profile.nodeShortName = _profile.child2ShortName; } else if (_profile.child1Id != null) { _profile.node = 1; _profile.nodeId = _profile.child1Id; + _profile.nodeDnaId = _profile.child1DnaId; _profile.nodeShortName = _profile.child1ShortName; } else if (_profile.rootId != null) { _profile.node = 0; _profile.nodeId = _profile.rootId; + _profile.nodeDnaId = _profile.rootDnaId; _profile.nodeShortName = _profile.rootShortName; } return new HttpSuccess(_profile);