feat: accept param active branch only
This commit is contained in:
parent
cb9c9cef68
commit
9630d02924
2 changed files with 19 additions and 2 deletions
|
|
@ -18,6 +18,17 @@ export function branchRelationPermInclude(user: RequestWithUser["user"]) {
|
|||
};
|
||||
}
|
||||
|
||||
export function branchActiveOnlyCond(activeOnly?: boolean) {
|
||||
return activeOnly
|
||||
? {
|
||||
OR: [
|
||||
{ headOffice: { status: { not: Status.INACTIVE } } },
|
||||
{ headOffice: null, status: { not: Status.INACTIVE } },
|
||||
],
|
||||
}
|
||||
: undefined;
|
||||
}
|
||||
|
||||
export function createPermCondition(
|
||||
globalAllow: (user: RequestWithUser["user"]) => boolean,
|
||||
): (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue