diff --git a/src/controllers/WorkflowController.ts b/src/controllers/WorkflowController.ts index cf7cbd36..e48bb86a 100644 --- a/src/controllers/WorkflowController.ts +++ b/src/controllers/WorkflowController.ts @@ -922,13 +922,24 @@ export class WorkflowController extends Controller { }, relations: ["orgChild1"], }); + const profileDirector = await this.posMasterRepo.findOne({ + where: { + orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true }, + current_holderId: profile.id, + }, + select: ["isDirector"], + }); if (!profileOfficer) - return new HttpSuccess({ isOfficer: false, isStaff: false, isDirector: false }); + return new HttpSuccess({ + isOfficer: false, + isStaff: false, + isDirector: profileDirector?.isDirector ?? false, + }); let isOfficer = profileOfficer.orgChild1 == null ? false : profileOfficer.orgChild1.isOfficer; return new HttpSuccess({ isOfficer: isOfficer, isStaff: !isOfficer, - isDirector: profileOfficer.isDirector, + isDirector: profileDirector?.isDirector ?? false, }); } @@ -955,14 +966,28 @@ export class WorkflowController extends Controller { }, relations: ["orgChild1"], }); + const profileDirector = await this.posMasterRepo.findOne({ + where: { + orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true }, + current_holderId: profile.id, + }, + select: ["isDirector"], + }); if (!profileOfficer) - return new HttpSuccess({ isOfficer: false, isStaff: false, isDirector: false }); + return new HttpSuccess({ + isOfficer: false, + isStaff: false, + isDirector: profileDirector?.isDirector ?? false, + }); let isOfficer = profileOfficer.orgChild1 == null ? false : profileOfficer.orgChild1.isOfficer; return new HttpSuccess({ isOfficer: isOfficer, isStaff: !isOfficer, - isDirector: - !profileOfficer.orgChild1Id && profileOfficer.orgRootId ? profileOfficer.isDirector : false, + isDirector: profileDirector + ? !profileDirector.orgChild1Id && profileDirector.orgRootId + ? profileDirector.isDirector + : false + : false, }); }