แก้ สิทธิ์

This commit is contained in:
kittapath 2024-11-14 11:41:52 +07:00
parent 98a1d2d4dc
commit 19ffc8f084

View file

@ -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,
});
}