From 134f1f43ee1063c09618cb6cbe634869961e14c1 Mon Sep 17 00:00:00 2001 From: mamoss <> Date: Thu, 17 Apr 2025 23:10:20 +0700 Subject: [PATCH] search root dna --- .../OrganizationDotnetController.ts | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/src/controllers/OrganizationDotnetController.ts b/src/controllers/OrganizationDotnetController.ts index a0cf74a7..adabac98 100644 --- a/src/controllers/OrganizationDotnetController.ts +++ b/src/controllers/OrganizationDotnetController.ts @@ -639,6 +639,36 @@ export class OrganizationDotnetController extends Controller { x.orgRevision?.orgRevisionIsDraft == false && x.orgRevision?.orgRevisionIsCurrent == true, )?.orgChild4Id ?? null, + rootDnaId: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.orgRoot?.ancestorDNA ?? null, + child1DnaId: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.orgChild1?.ancestorDNA ?? null, + child2DnaId: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.orgChild2?.ancestorDNA ?? null, + child3DnaId: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.orgChild3?.ancestorDNA ?? null, + child4DnaId: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.orgChild4?.ancestorDNA ?? null, commander: fullname, commanderPositionName, commanderId, @@ -965,6 +995,36 @@ export class OrganizationDotnetController extends Controller { x.orgRevision?.orgRevisionIsDraft == false && x.orgRevision?.orgRevisionIsCurrent == true, )?.orgChild4Id ?? null, + rootDnaId: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.orgRoot?.ancestorDNA ?? null, + child1DnaId: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.orgChild1?.ancestorDNA ?? null, + child2DnaId: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.orgChild2?.ancestorDNA ?? null, + child3DnaId: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.orgChild3?.ancestorDNA ?? null, + child4DnaId: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.orgChild4?.ancestorDNA ?? null, commander: fullname, commanderPositionName, commanderId, @@ -2875,6 +2935,7 @@ export class OrganizationDotnetController extends Controller { rootId: root == null ? null : root.id, root: root == null ? null : root.orgRootName, rootShortName: root == null ? null : root.orgRootShortName, + rootDnaId: root == null ? null : root.ancestorDNA, }; return new HttpSuccess(_profile); }