fix: not all user return when pass responsibleDistrictArea
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 15s

This commit is contained in:
Methapon2001 2025-04-08 08:48:36 +07:00
parent afca10983d
commit d961ab086b

View file

@ -178,6 +178,7 @@ type UserUpdate = {
branchId?: string | string[];
};
const permissionCondCompany = createPermCondition((_) => true);
const permissionCond = createPermCondition(globalAllow);
const permissionCheck = createPermCheck(globalAllow);
@ -348,7 +349,9 @@ export class UserController extends Controller {
: {
some: {
branch: {
OR: permissionCond(req.user, { activeOnly: activeBranchOnly }),
OR: responsibleDistrictId
? permissionCondCompany(req.user, { activeOnly: activeBranchOnly }) // NOTE: when pass responsibleDistrictId should see all user not only to current branch
: permissionCond(req.user, { activeOnly: activeBranchOnly }),
},
},
},