From 54b0b88b5bfbb3a1c476bd0867711006c58ec69d Mon Sep 17 00:00:00 2001 From: Kittapath Date: Tue, 23 Apr 2024 13:59:45 +0700 Subject: [PATCH 1/4] no message --- src/controllers/ProfileController.ts | 39 +++++++++++++++++++++------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index 16a1d002..041027fb 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -306,7 +306,7 @@ export class ProfileController extends Controller { bloodGroup: null, posLevel: null, posType: null, - org: null + org: null, }, ], total: 1, @@ -444,32 +444,32 @@ export class ProfileController extends Controller { _data.current_holders.find((x) => x.orgRevisionId == findRevision.id) == null ? null : _data.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild1; - + const child2 = _data.current_holders == null || _data.current_holders.length == 0 || _data.current_holders.find((x) => x.orgRevisionId == findRevision.id) == null ? null : _data.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild2; - + const child3 = _data.current_holders == null || _data.current_holders.length == 0 || _data.current_holders.find((x) => x.orgRevisionId == findRevision.id) == null ? null : _data.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild3; - + const child4 = _data.current_holders == null || _data.current_holders.length == 0 || _data.current_holders.find((x) => x.orgRevisionId == findRevision.id) == null ? null : _data.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild4; - - let _child1 = child1 == null ? "" : `${child1.orgChild1Name}/` - let _child2 = child2 == null ? "" : `${child2.orgChild2Name}/` - let _child3 = child3 == null ? "" : `${child3.orgChild3Name}/` - let _child4 = child4 == null ? "" : `${child4.orgChild4Name}/` + + let _child1 = child1 == null ? "" : `${child1.orgChild1Name}/`; + let _child2 = child2 == null ? "" : `${child2.orgChild2Name}/`; + let _child3 = child3 == null ? "" : `${child3.orgChild3Name}/`; + let _child4 = child4 == null ? "" : `${child4.orgChild4Name}/`; return { id: _data.id, @@ -647,7 +647,7 @@ export class ProfileController extends Controller { throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบแบบร่างโครงสร้าง"); } - const _profile = { + const _profile: any = { profileId: profile.id, prefix: profile.prefix, rank: profile.rank, @@ -731,7 +731,26 @@ export class ProfileController extends Controller { ? null : profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild4 .orgChild4Name, + node: null, + nodeId: null, }; + + if (_profile.child4Id != null) { + _profile.node = 4; + _profile.nodeId = _profile.child4Id; + } else if (_profile.child3Id != null) { + _profile.node = 3; + _profile.nodeId = _profile.child3Id; + } else if (_profile.child2Id != null) { + _profile.node = 2; + _profile.nodeId = _profile.child2Id; + } else if (_profile.child1Id != null) { + _profile.node = 1; + _profile.nodeId = _profile.child1Id; + } else if (_profile.rootId != null) { + _profile.node = 0; + _profile.nodeId = _profile.rootId; + } return new HttpSuccess(_profile); } From a3d501f7d449197f06fe12ad275b2572cc7c060a Mon Sep 17 00:00:00 2001 From: Bright Date: Wed, 24 Apr 2024 14:56:20 +0700 Subject: [PATCH 2/4] fix positionIsSelect --- src/controllers/PositionController.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controllers/PositionController.ts b/src/controllers/PositionController.ts index 773e7799..61649806 100644 --- a/src/controllers/PositionController.ts +++ b/src/controllers/PositionController.ts @@ -1021,7 +1021,7 @@ export class PositionController extends Controller { position.positionExecutiveField = x.posDictExecutiveField; position.positionArea = x.posDictArea; position.isSpecial = x.isSpecial; - position.positionIsSelected = false; + position.positionIsSelected = x.positionIsSelected; position.posMasterId = posMaster.id; position.createdUserId = request.user.sub; position.createdFullName = request.user.name; From 7f53c577b28bf32a864c9008865549ee9f3bbf44 Mon Sep 17 00:00:00 2001 From: Bright Date: Wed, 24 Apr 2024 15:35:12 +0700 Subject: [PATCH 3/4] fix positionIsSelect --- src/entities/PosDict.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/entities/PosDict.ts b/src/entities/PosDict.ts index 9de18e35..3439c2ac 100644 --- a/src/entities/PosDict.ts +++ b/src/entities/PosDict.ts @@ -101,6 +101,9 @@ export class CreatePosDict { @Column() isSpecial: boolean; + + @Column() + positionIsSelected: boolean | null; } export class CreatePosDictExe { From 8689e36292c3ce6110c6652fe551ac5ee53dd198 Mon Sep 17 00:00:00 2001 From: Bright Date: Wed, 24 Apr 2024 15:42:59 +0700 Subject: [PATCH 4/4] fix positionIsSelect --- src/entities/PosDict.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/entities/PosDict.ts b/src/entities/PosDict.ts index 3439c2ac..5488dd2c 100644 --- a/src/entities/PosDict.ts +++ b/src/entities/PosDict.ts @@ -103,7 +103,7 @@ export class CreatePosDict { isSpecial: boolean; @Column() - positionIsSelected: boolean | null; + positionIsSelected?: boolean | null; } export class CreatePosDictExe {