diff --git a/src/controllers/OrganizationDotnetController.ts b/src/controllers/OrganizationDotnetController.ts index ed9473f6..e0a4a8e9 100644 --- a/src/controllers/OrganizationDotnetController.ts +++ b/src/controllers/OrganizationDotnetController.ts @@ -1208,6 +1208,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, + )?.ancestorDNA ?? null, + child1DnaId: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.ancestorDNA ?? null, + child2DnaId: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.ancestorDNA ?? null, + child3DnaId: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.ancestorDNA ?? null, + child4DnaId: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.ancestorDNA ?? null, commander: fullname, posLevel: profile.posLevel?.posLevelName ?? null, posType: profile.posType?.posTypeName ?? null, @@ -1475,6 +1505,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, + )?.ancestorDNA ?? null, + child1DnaId: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.ancestorDNA ?? null, + child2DnaId: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.ancestorDNA ?? null, + child3DnaId: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.ancestorDNA ?? null, + child4DnaId: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.ancestorDNA ?? null, commander: fullname, posLevel: profile.posLevel?.posLevelName ?? null, posType: profile.posType?.posTypeName ?? null, @@ -2211,6 +2271,84 @@ export class OrganizationDotnetController extends Controller { x.orgRevision?.orgRevisionIsDraft == false && x.orgRevision?.orgRevisionIsCurrent == true, )?.orgRootId ?? null, + rootDnaId: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.ancestorDNA ?? null, + child1: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.orgChild1?.orgChild1Name ?? null, + child1Id: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.orgChild1Id ?? null, + child1DnaId: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.ancestorDNA ?? null, + child2: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.orgChild2?.orgChild2Name ?? null, + child2Id: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.orgChild2Id ?? null, + child2DnaId: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.ancestorDNA ?? null, + child3: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.orgChild3?.orgChild3Name ?? null, + child3Id: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.orgChild3Id ?? null, + child3DnaId: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.ancestorDNA ?? null, + child4: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.orgChild4?.orgChild4Name ?? null, + child4Id: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.orgChild4Id ?? null, + child4DnaId: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.ancestorDNA ?? null, posNo: shortName ?? "", }; }); @@ -2500,6 +2638,84 @@ export class OrganizationDotnetController extends Controller { x.orgRevision?.orgRevisionIsDraft == false && x.orgRevision?.orgRevisionIsCurrent == true, )?.orgRootId ?? null, + rootDnaId: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.ancestorDNA ?? null, + child1: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.orgChild1?.orgChild1Name ?? null, + child1Id: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.orgChild1Id ?? null, + child1DnaId: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.ancestorDNA ?? null, + child2: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.orgChild2?.orgChild2Name ?? null, + child2Id: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.orgChild2Id ?? null, + child2DnaId: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.ancestorDNA ?? null, + child3: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.orgChild3?.orgChild3Name ?? null, + child3Id: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.orgChild3Id ?? null, + child3DnaId: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.ancestorDNA ?? null, + child4: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.orgChild4?.orgChild4Name ?? null, + child4Id: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.orgChild4Id ?? null, + child4DnaId: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.ancestorDNA ?? null, posNo: shortName ?? "", }; }); @@ -3078,9 +3294,14 @@ export class OrganizationDotnetController extends Controller { "current_holders.orgChild4", ], }); - if(body.isRetirement){ - profile = await this.profileRepo.find({ - where: { keycloak: Not(IsNull()) || Not(""), isLeave: false, current_holders: typeCondition, isRetirement: true }, + if (body.isRetirement) { + profile = await this.profileRepo.find({ + where: { + keycloak: Not(IsNull()) || Not(""), + isLeave: false, + current_holders: typeCondition, + isRetirement: true, + }, relations: [ "posType", "posLevel", @@ -3093,7 +3314,7 @@ export class OrganizationDotnetController extends Controller { ], }); } - + const findRevision = await this.orgRevisionRepo.findOne({ where: { orgRevisionIsCurrent: true }, }); @@ -3292,7 +3513,9 @@ export class OrganizationDotnetController extends Controller { keycloak: item.keycloak, posNo: shortName, position: item.position, - positionLevel: item.posLevel ? `${item.posType.posTypeShortName} ${item.posLevel.posLevelName}` : "-", + positionLevel: item.posLevel + ? `${item.posType.posTypeShortName} ${item.posLevel.posLevelName}` + : "-", positionType: item.posType?.posTypeName ?? null, oc: Oc, };