refactor: move include head to opts
This commit is contained in:
parent
1124a040c8
commit
57397cc894
2 changed files with 8 additions and 4 deletions
|
|
@ -157,7 +157,7 @@ export class BranchController extends Controller {
|
|||
async getStats(@Request() req: RequestWithUser, @Query() headOfficeId?: string) {
|
||||
const where = {
|
||||
AND: {
|
||||
OR: permissionCond(req.user, true),
|
||||
OR: permissionCond(req.user, { alwaysIncludeHead: true }),
|
||||
},
|
||||
};
|
||||
|
||||
|
|
@ -255,7 +255,7 @@ export class BranchController extends Controller {
|
|||
...filterStatus(status),
|
||||
headOfficeId: headOfficeId ?? (filter === "head" || tree ? null : undefined),
|
||||
NOT: { headOfficeId: filter === "sub" && !headOfficeId ? null : undefined },
|
||||
OR: permissionCond(req.user, withHead),
|
||||
OR: permissionCond(req.user, { alwaysIncludeHead: withHead }),
|
||||
},
|
||||
OR: queryOrNot<Prisma.BranchWhereInput[]>(query, [
|
||||
{ code: { contains: query, mode: "insensitive" } },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue