feat: add active only parameter
This commit is contained in:
parent
9d6fd2d8d0
commit
3f04f3c727
1 changed files with 2 additions and 1 deletions
|
|
@ -246,6 +246,7 @@ export class BranchController extends Controller {
|
|||
@Query() withHead?: boolean, // List cover head
|
||||
@Query() tree?: boolean,
|
||||
@Query() status?: Status,
|
||||
@Query() activeOnly?: boolean,
|
||||
@Query() query: string = "",
|
||||
@Query() page: number = 1,
|
||||
@Query() pageSize: number = 30,
|
||||
|
|
@ -255,7 +256,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, { alwaysIncludeHead: withHead }),
|
||||
OR: permissionCond(req.user, { alwaysIncludeHead: withHead, activeOnly }),
|
||||
},
|
||||
OR: queryOrNot<Prisma.BranchWhereInput[]>(query, [
|
||||
{ code: { contains: query, mode: "insensitive" } },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue