From e9a589675d4e9ec3133de19ff5bf1c6dfe43f483 Mon Sep 17 00:00:00 2001 From: AdisakKanthawilang Date: Thu, 3 Jul 2025 10:55:05 +0700 Subject: [PATCH 1/3] update res next_holderId --- src/controllers/PositionController.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/controllers/PositionController.ts b/src/controllers/PositionController.ts index 5d4bcca3..7ea9c45b 100644 --- a/src/controllers/PositionController.ts +++ b/src/controllers/PositionController.ts @@ -1919,6 +1919,7 @@ export class PositionController extends Controller { return { id: posMaster.id, current_holderId: posMaster.current_holderId, + next_holderId: posMaster.next_holderId, isDirector: posMaster.isDirector, orgRootId: posMaster.orgRootId, orgChild1Id: posMaster.orgChild1Id, @@ -2354,6 +2355,7 @@ export class PositionController extends Controller { return { id: posMaster.id, current_holderId: posMaster.current_holderId, + next_holderId: posMaster.next_holderId, isDirector: posMaster.isDirector, orgRootId: posMaster.orgRootId, orgChild1Id: posMaster.orgChild1Id, From 2b53e433ba6591c55790497915b33780fa6bb762 Mon Sep 17 00:00:00 2001 From: Bright Date: Thu, 3 Jul 2025 13:04:35 +0700 Subject: [PATCH 2/3] add field avatarUrl --- src/controllers/ProfileController.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index d95bdf1a..9cc51e44 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -8112,6 +8112,7 @@ export class ProfileController extends Controller { ? `${profile.profileEducations[0].degree ?? ""} ${profile.profileEducations[0].field ?? ""}` : "", dateAppoint: profile.dateAppoint, + avatarUrl: profile.avatar && profile.avatarName ? `${profile.avatar}/${profile.avatarName}` : null }; if (_profile.child4Id != null) { From c6829ed14fd080c635d477ef3bc3378868ea4ae7 Mon Sep 17 00:00:00 2001 From: mamoss <> Date: Sat, 5 Jul 2025 00:31:12 +0700 Subject: [PATCH 3/3] search org --- src/controllers/OrganizationController.ts | 878 +++++++++++----------- 1 file changed, 439 insertions(+), 439 deletions(-) diff --git a/src/controllers/OrganizationController.ts b/src/controllers/OrganizationController.ts index f8f431bd..c37625f3 100644 --- a/src/controllers/OrganizationController.ts +++ b/src/controllers/OrganizationController.ts @@ -2232,91 +2232,91 @@ export class OrganizationController extends Controller { responsibility: orgRoot.responsibility, labelName: orgRoot.orgRootName + " " + orgRoot.orgRootCode + "00" + " " + orgRoot.orgRootShortName, - totalPosition: await this.posMasterRepository.count({ - where: { orgRevisionId: orgRoot.orgRevisionId, orgRootId: orgRoot.id }, - }), - totalPositionCurrentUse: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgRootId: orgRoot.id, - current_holderId: Not(IsNull()) || Not(""), - }, - }), - totalPositionCurrentVacant: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgRootId: orgRoot.id, - current_holderId: IsNull() || "", - }, - }), - totalPositionNextUse: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgRootId: orgRoot.id, - next_holderId: Not(IsNull()) || Not(""), - }, - }), - totalPositionNextVacant: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgRootId: orgRoot.id, - next_holderId: IsNull() || "", - }, - }), - totalRootPosition: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgRootId: orgRoot.id, - orgChild1Id: IsNull() || "", - orgChild2Id: IsNull() || "", - orgChild3Id: IsNull() || "", - orgChild4Id: IsNull() || "", - }, - }), - totalRootPositionCurrentUse: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgRootId: orgRoot.id, - orgChild1Id: IsNull() || "", - orgChild2Id: IsNull() || "", - orgChild3Id: IsNull() || "", - orgChild4Id: IsNull() || "", - current_holderId: Not(IsNull()) || Not(""), - }, - }), - totalRootPositionCurrentVacant: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgRootId: orgRoot.id, - orgChild1Id: IsNull() || "", - orgChild2Id: IsNull() || "", - orgChild3Id: IsNull() || "", - orgChild4Id: IsNull() || "", - current_holderId: IsNull() || "", - }, - }), - totalRootPositionNextUse: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgRootId: orgRoot.id, - orgChild1Id: IsNull() || "", - orgChild2Id: IsNull() || "", - orgChild3Id: IsNull() || "", - orgChild4Id: IsNull() || "", - next_holderId: Not(IsNull()) || Not(""), - }, - }), - totalRootPositionNextVacant: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgRootId: orgRoot.id, - orgChild1Id: IsNull() || "", - orgChild2Id: IsNull() || "", - orgChild3Id: IsNull() || "", - orgChild4Id: IsNull() || "", - next_holderId: IsNull() || "", - }, - }), + // totalPosition: await this.posMasterRepository.count({ + // where: { orgRevisionId: orgRoot.orgRevisionId, orgRootId: orgRoot.id }, + // }), + // totalPositionCurrentUse: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgRootId: orgRoot.id, + // current_holderId: Not(IsNull()) || Not(""), + // }, + // }), + // totalPositionCurrentVacant: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgRootId: orgRoot.id, + // current_holderId: IsNull() || "", + // }, + // }), + // totalPositionNextUse: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgRootId: orgRoot.id, + // next_holderId: Not(IsNull()) || Not(""), + // }, + // }), + // totalPositionNextVacant: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgRootId: orgRoot.id, + // next_holderId: IsNull() || "", + // }, + // }), + // totalRootPosition: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgRootId: orgRoot.id, + // orgChild1Id: IsNull() || "", + // orgChild2Id: IsNull() || "", + // orgChild3Id: IsNull() || "", + // orgChild4Id: IsNull() || "", + // }, + // }), + // totalRootPositionCurrentUse: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgRootId: orgRoot.id, + // orgChild1Id: IsNull() || "", + // orgChild2Id: IsNull() || "", + // orgChild3Id: IsNull() || "", + // orgChild4Id: IsNull() || "", + // current_holderId: Not(IsNull()) || Not(""), + // }, + // }), + // totalRootPositionCurrentVacant: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgRootId: orgRoot.id, + // orgChild1Id: IsNull() || "", + // orgChild2Id: IsNull() || "", + // orgChild3Id: IsNull() || "", + // orgChild4Id: IsNull() || "", + // current_holderId: IsNull() || "", + // }, + // }), + // totalRootPositionNextUse: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgRootId: orgRoot.id, + // orgChild1Id: IsNull() || "", + // orgChild2Id: IsNull() || "", + // orgChild3Id: IsNull() || "", + // orgChild4Id: IsNull() || "", + // next_holderId: Not(IsNull()) || Not(""), + // }, + // }), + // totalRootPositionNextVacant: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgRootId: orgRoot.id, + // orgChild1Id: IsNull() || "", + // orgChild2Id: IsNull() || "", + // orgChild3Id: IsNull() || "", + // orgChild4Id: IsNull() || "", + // next_holderId: IsNull() || "", + // }, + // }), children: await Promise.all( orgChild1Data @@ -2361,91 +2361,91 @@ export class OrganizationController extends Controller { "00" + " " + orgRoot.orgRootShortName, - totalPosition: await this.posMasterRepository.count({ - where: { orgRevisionId: orgRoot.orgRevisionId, orgChild1Id: orgChild1.id }, - }), - totalPositionCurrentUse: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgChild1Id: orgChild1.id, - current_holderId: Not(IsNull()) || Not(""), - }, - }), - totalPositionCurrentVacant: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgChild1Id: orgChild1.id, - current_holderId: IsNull() || "", - }, - }), - totalPositionNextUse: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgChild1Id: orgChild1.id, - next_holderId: Not(IsNull()) || Not(""), - }, - }), - totalPositionNextVacant: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgChild1Id: orgChild1.id, - next_holderId: IsNull() || "", - }, - }), - totalRootPosition: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgRootId: orgRoot.id, - orgChild1Id: orgChild1.id, - orgChild2Id: IsNull() || "", - orgChild3Id: IsNull() || "", - orgChild4Id: IsNull() || "", - }, - }), - totalRootPositionCurrentUse: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgRootId: orgRoot.id, - orgChild1Id: orgChild1.id, - orgChild2Id: IsNull() || "", - orgChild3Id: IsNull() || "", - orgChild4Id: IsNull() || "", - current_holderId: Not(IsNull()) || Not(""), - }, - }), - totalRootPositionCurrentVacant: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgRootId: orgRoot.id, - orgChild1Id: orgChild1.id, - orgChild2Id: IsNull() || "", - orgChild3Id: IsNull() || "", - orgChild4Id: IsNull() || "", - current_holderId: IsNull() || "", - }, - }), - totalRootPositionNextUse: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgRootId: orgRoot.id, - orgChild1Id: orgChild1.id, - orgChild2Id: IsNull() || "", - orgChild3Id: IsNull() || "", - orgChild4Id: IsNull() || "", - next_holderId: Not(IsNull()) || Not(""), - }, - }), - totalRootPositionNextVacant: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgRootId: orgRoot.id, - orgChild1Id: orgChild1.id, - orgChild2Id: IsNull() || "", - orgChild3Id: IsNull() || "", - orgChild4Id: IsNull() || "", - next_holderId: IsNull() || "", - }, - }), + // totalPosition: await this.posMasterRepository.count({ + // where: { orgRevisionId: orgRoot.orgRevisionId, orgChild1Id: orgChild1.id }, + // }), + // totalPositionCurrentUse: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgChild1Id: orgChild1.id, + // current_holderId: Not(IsNull()) || Not(""), + // }, + // }), + // totalPositionCurrentVacant: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgChild1Id: orgChild1.id, + // current_holderId: IsNull() || "", + // }, + // }), + // totalPositionNextUse: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgChild1Id: orgChild1.id, + // next_holderId: Not(IsNull()) || Not(""), + // }, + // }), + // totalPositionNextVacant: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgChild1Id: orgChild1.id, + // next_holderId: IsNull() || "", + // }, + // }), + // totalRootPosition: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgRootId: orgRoot.id, + // orgChild1Id: orgChild1.id, + // orgChild2Id: IsNull() || "", + // orgChild3Id: IsNull() || "", + // orgChild4Id: IsNull() || "", + // }, + // }), + // totalRootPositionCurrentUse: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgRootId: orgRoot.id, + // orgChild1Id: orgChild1.id, + // orgChild2Id: IsNull() || "", + // orgChild3Id: IsNull() || "", + // orgChild4Id: IsNull() || "", + // current_holderId: Not(IsNull()) || Not(""), + // }, + // }), + // totalRootPositionCurrentVacant: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgRootId: orgRoot.id, + // orgChild1Id: orgChild1.id, + // orgChild2Id: IsNull() || "", + // orgChild3Id: IsNull() || "", + // orgChild4Id: IsNull() || "", + // current_holderId: IsNull() || "", + // }, + // }), + // totalRootPositionNextUse: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgRootId: orgRoot.id, + // orgChild1Id: orgChild1.id, + // orgChild2Id: IsNull() || "", + // orgChild3Id: IsNull() || "", + // orgChild4Id: IsNull() || "", + // next_holderId: Not(IsNull()) || Not(""), + // }, + // }), + // totalRootPositionNextVacant: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgRootId: orgRoot.id, + // orgChild1Id: orgChild1.id, + // orgChild2Id: IsNull() || "", + // orgChild3Id: IsNull() || "", + // orgChild4Id: IsNull() || "", + // next_holderId: IsNull() || "", + // }, + // }), children: await Promise.all( orgChild2Data @@ -2495,94 +2495,94 @@ export class OrganizationController extends Controller { "00" + " " + orgRoot.orgRootShortName, - totalPosition: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgChild2Id: orgChild2.id, - }, - }), - totalPositionCurrentUse: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgChild2Id: orgChild2.id, - current_holderId: Not(IsNull()) || Not(""), - }, - }), - totalPositionCurrentVacant: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgChild2Id: orgChild2.id, - current_holderId: IsNull() || "", - }, - }), - totalPositionNextUse: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgChild2Id: orgChild2.id, - next_holderId: Not(IsNull()) || Not(""), - }, - }), - totalPositionNextVacant: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgChild2Id: orgChild2.id, - next_holderId: IsNull() || "", - }, - }), - totalRootPosition: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgRootId: orgRoot.id, - orgChild1Id: orgChild1.id, - orgChild2Id: orgChild2.id, - orgChild3Id: IsNull() || "", - orgChild4Id: IsNull() || "", - }, - }), - totalRootPositionCurrentUse: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgRootId: orgRoot.id, - orgChild1Id: orgChild1.id, - orgChild2Id: orgChild2.id, - orgChild3Id: IsNull() || "", - orgChild4Id: IsNull() || "", - current_holderId: Not(IsNull()) || Not(""), - }, - }), - totalRootPositionCurrentVacant: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgRootId: orgRoot.id, - orgChild1Id: orgChild1.id, - orgChild2Id: orgChild2.id, - orgChild3Id: IsNull() || "", - orgChild4Id: IsNull() || "", - current_holderId: IsNull() || "", - }, - }), - totalRootPositionNextUse: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgRootId: orgRoot.id, - orgChild1Id: orgChild1.id, - orgChild2Id: orgChild2.id, - orgChild3Id: IsNull() || "", - orgChild4Id: IsNull() || "", - next_holderId: Not(IsNull()) || Not(""), - }, - }), - totalRootPositionNextVacant: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgRootId: orgRoot.id, - orgChild1Id: orgChild1.id, - orgChild2Id: orgChild2.id, - orgChild3Id: IsNull() || "", - orgChild4Id: IsNull() || "", - next_holderId: IsNull() || "", - }, - }), + // totalPosition: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgChild2Id: orgChild2.id, + // }, + // }), + // totalPositionCurrentUse: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgChild2Id: orgChild2.id, + // current_holderId: Not(IsNull()) || Not(""), + // }, + // }), + // totalPositionCurrentVacant: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgChild2Id: orgChild2.id, + // current_holderId: IsNull() || "", + // }, + // }), + // totalPositionNextUse: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgChild2Id: orgChild2.id, + // next_holderId: Not(IsNull()) || Not(""), + // }, + // }), + // totalPositionNextVacant: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgChild2Id: orgChild2.id, + // next_holderId: IsNull() || "", + // }, + // }), + // totalRootPosition: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgRootId: orgRoot.id, + // orgChild1Id: orgChild1.id, + // orgChild2Id: orgChild2.id, + // orgChild3Id: IsNull() || "", + // orgChild4Id: IsNull() || "", + // }, + // }), + // totalRootPositionCurrentUse: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgRootId: orgRoot.id, + // orgChild1Id: orgChild1.id, + // orgChild2Id: orgChild2.id, + // orgChild3Id: IsNull() || "", + // orgChild4Id: IsNull() || "", + // current_holderId: Not(IsNull()) || Not(""), + // }, + // }), + // totalRootPositionCurrentVacant: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgRootId: orgRoot.id, + // orgChild1Id: orgChild1.id, + // orgChild2Id: orgChild2.id, + // orgChild3Id: IsNull() || "", + // orgChild4Id: IsNull() || "", + // current_holderId: IsNull() || "", + // }, + // }), + // totalRootPositionNextUse: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgRootId: orgRoot.id, + // orgChild1Id: orgChild1.id, + // orgChild2Id: orgChild2.id, + // orgChild3Id: IsNull() || "", + // orgChild4Id: IsNull() || "", + // next_holderId: Not(IsNull()) || Not(""), + // }, + // }), + // totalRootPositionNextVacant: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgRootId: orgRoot.id, + // orgChild1Id: orgChild1.id, + // orgChild2Id: orgChild2.id, + // orgChild3Id: IsNull() || "", + // orgChild4Id: IsNull() || "", + // next_holderId: IsNull() || "", + // }, + // }), children: await Promise.all( orgChild3Data @@ -2639,94 +2639,94 @@ export class OrganizationController extends Controller { "00" + " " + orgRoot.orgRootShortName, - totalPosition: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgChild3Id: orgChild3.id, - }, - }), - totalPositionCurrentUse: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgChild3Id: orgChild3.id, - current_holderId: Not(IsNull()) || Not(""), - }, - }), - totalPositionCurrentVacant: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgChild3Id: orgChild3.id, - current_holderId: IsNull() || "", - }, - }), - totalPositionNextUse: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgChild3Id: orgChild3.id, - next_holderId: Not(IsNull()) || Not(""), - }, - }), - totalPositionNextVacant: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgChild3Id: orgChild3.id, - next_holderId: IsNull() || "", - }, - }), - totalRootPosition: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgRootId: orgRoot.id, - orgChild1Id: orgChild1.id, - orgChild2Id: orgChild2.id, - orgChild3Id: orgChild3.id, - orgChild4Id: IsNull() || "", - }, - }), - totalRootPositionCurrentUse: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgRootId: orgRoot.id, - orgChild1Id: orgChild1.id, - orgChild2Id: orgChild2.id, - orgChild3Id: orgChild3.id, - orgChild4Id: IsNull() || "", - current_holderId: Not(IsNull()) || Not(""), - }, - }), - totalRootPositionCurrentVacant: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgRootId: orgRoot.id, - orgChild1Id: orgChild1.id, - orgChild2Id: orgChild2.id, - orgChild3Id: orgChild3.id, - orgChild4Id: IsNull() || "", - current_holderId: IsNull() || "", - }, - }), - totalRootPositionNextUse: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgRootId: orgRoot.id, - orgChild1Id: orgChild1.id, - orgChild2Id: orgChild2.id, - orgChild3Id: orgChild3.id, - orgChild4Id: IsNull() || "", - next_holderId: Not(IsNull()) || Not(""), - }, - }), - totalRootPositionNextVacant: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgRootId: orgRoot.id, - orgChild1Id: orgChild1.id, - orgChild2Id: orgChild2.id, - orgChild3Id: orgChild3.id, - orgChild4Id: IsNull() || "", - next_holderId: IsNull() || "", - }, - }), + // totalPosition: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgChild3Id: orgChild3.id, + // }, + // }), + // totalPositionCurrentUse: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgChild3Id: orgChild3.id, + // current_holderId: Not(IsNull()) || Not(""), + // }, + // }), + // totalPositionCurrentVacant: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgChild3Id: orgChild3.id, + // current_holderId: IsNull() || "", + // }, + // }), + // totalPositionNextUse: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgChild3Id: orgChild3.id, + // next_holderId: Not(IsNull()) || Not(""), + // }, + // }), + // totalPositionNextVacant: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgChild3Id: orgChild3.id, + // next_holderId: IsNull() || "", + // }, + // }), + // totalRootPosition: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgRootId: orgRoot.id, + // orgChild1Id: orgChild1.id, + // orgChild2Id: orgChild2.id, + // orgChild3Id: orgChild3.id, + // orgChild4Id: IsNull() || "", + // }, + // }), + // totalRootPositionCurrentUse: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgRootId: orgRoot.id, + // orgChild1Id: orgChild1.id, + // orgChild2Id: orgChild2.id, + // orgChild3Id: orgChild3.id, + // orgChild4Id: IsNull() || "", + // current_holderId: Not(IsNull()) || Not(""), + // }, + // }), + // totalRootPositionCurrentVacant: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgRootId: orgRoot.id, + // orgChild1Id: orgChild1.id, + // orgChild2Id: orgChild2.id, + // orgChild3Id: orgChild3.id, + // orgChild4Id: IsNull() || "", + // current_holderId: IsNull() || "", + // }, + // }), + // totalRootPositionNextUse: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgRootId: orgRoot.id, + // orgChild1Id: orgChild1.id, + // orgChild2Id: orgChild2.id, + // orgChild3Id: orgChild3.id, + // orgChild4Id: IsNull() || "", + // next_holderId: Not(IsNull()) || Not(""), + // }, + // }), + // totalRootPositionNextVacant: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgRootId: orgRoot.id, + // orgChild1Id: orgChild1.id, + // orgChild2Id: orgChild2.id, + // orgChild3Id: orgChild3.id, + // orgChild4Id: IsNull() || "", + // next_holderId: IsNull() || "", + // }, + // }), children: await Promise.all( orgChild4Data @@ -2790,99 +2790,99 @@ export class OrganizationController extends Controller { "00" + " " + orgRoot.orgRootShortName, - totalPosition: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgChild4Id: orgChild4.id, - }, - }), - totalPositionCurrentUse: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgChild4Id: orgChild4.id, - current_holderId: Not(IsNull()) || Not(""), - }, - }), - totalPositionCurrentVacant: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgChild4Id: orgChild4.id, - current_holderId: IsNull() || "", - }, - }), - totalPositionNextUse: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgChild4Id: orgChild4.id, - next_holderId: Not(IsNull()) || Not(""), - }, - }), - totalPositionNextVacant: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgChild4Id: orgChild4.id, - next_holderId: IsNull() || "", - }, - }), - totalRootPosition: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgRootId: orgRoot.id, - orgChild1Id: orgChild1.id, - orgChild2Id: orgChild2.id, - orgChild3Id: orgChild3.id, - orgChild4Id: orgChild4.id, - }, - }), - totalRootPositionCurrentUse: await this.posMasterRepository.count( - { - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgRootId: orgRoot.id, - orgChild1Id: orgChild1.id, - orgChild2Id: orgChild2.id, - orgChild3Id: orgChild3.id, - orgChild4Id: orgChild4.id, - current_holderId: Not(IsNull()) || Not(""), - }, - }, - ), - totalRootPositionCurrentVacant: - await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgRootId: orgRoot.id, - orgChild1Id: orgChild1.id, - orgChild2Id: orgChild2.id, - orgChild3Id: orgChild3.id, - orgChild4Id: orgChild4.id, - current_holderId: IsNull() || "", - }, - }), - totalRootPositionNextUse: await this.posMasterRepository.count({ - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgRootId: orgRoot.id, - orgChild1Id: orgChild1.id, - orgChild2Id: orgChild2.id, - orgChild3Id: orgChild3.id, - orgChild4Id: orgChild4.id, - next_holderId: Not(IsNull()) || Not(""), - }, - }), - totalRootPositionNextVacant: await this.posMasterRepository.count( - { - where: { - orgRevisionId: orgRoot.orgRevisionId, - orgRootId: orgRoot.id, - orgChild1Id: orgChild1.id, - orgChild2Id: orgChild2.id, - orgChild3Id: orgChild3.id, - orgChild4Id: orgChild4.id, - next_holderId: IsNull() || "", - }, - }, - ), + // totalPosition: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgChild4Id: orgChild4.id, + // }, + // }), + // totalPositionCurrentUse: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgChild4Id: orgChild4.id, + // current_holderId: Not(IsNull()) || Not(""), + // }, + // }), + // totalPositionCurrentVacant: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgChild4Id: orgChild4.id, + // current_holderId: IsNull() || "", + // }, + // }), + // totalPositionNextUse: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgChild4Id: orgChild4.id, + // next_holderId: Not(IsNull()) || Not(""), + // }, + // }), + // totalPositionNextVacant: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgChild4Id: orgChild4.id, + // next_holderId: IsNull() || "", + // }, + // }), + // totalRootPosition: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgRootId: orgRoot.id, + // orgChild1Id: orgChild1.id, + // orgChild2Id: orgChild2.id, + // orgChild3Id: orgChild3.id, + // orgChild4Id: orgChild4.id, + // }, + // }), + // totalRootPositionCurrentUse: await this.posMasterRepository.count( + // { + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgRootId: orgRoot.id, + // orgChild1Id: orgChild1.id, + // orgChild2Id: orgChild2.id, + // orgChild3Id: orgChild3.id, + // orgChild4Id: orgChild4.id, + // current_holderId: Not(IsNull()) || Not(""), + // }, + // }, + // ), + // totalRootPositionCurrentVacant: + // await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgRootId: orgRoot.id, + // orgChild1Id: orgChild1.id, + // orgChild2Id: orgChild2.id, + // orgChild3Id: orgChild3.id, + // orgChild4Id: orgChild4.id, + // current_holderId: IsNull() || "", + // }, + // }), + // totalRootPositionNextUse: await this.posMasterRepository.count({ + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgRootId: orgRoot.id, + // orgChild1Id: orgChild1.id, + // orgChild2Id: orgChild2.id, + // orgChild3Id: orgChild3.id, + // orgChild4Id: orgChild4.id, + // next_holderId: Not(IsNull()) || Not(""), + // }, + // }), + // totalRootPositionNextVacant: await this.posMasterRepository.count( + // { + // where: { + // orgRevisionId: orgRoot.orgRevisionId, + // orgRootId: orgRoot.id, + // orgChild1Id: orgChild1.id, + // orgChild2Id: orgChild2.id, + // orgChild3Id: orgChild3.id, + // orgChild4Id: orgChild4.id, + // next_holderId: IsNull() || "", + // }, + // }, + // ), })), ), })),