feat: add option to get list with head
This commit is contained in:
parent
a26188cbb3
commit
4036a36236
1 changed files with 3 additions and 2 deletions
|
|
@ -222,7 +222,8 @@ export class BranchController extends Controller {
|
|||
@Request() req: RequestWithUser,
|
||||
@Query() filter?: "head" | "sub",
|
||||
@Query() headOfficeId?: string,
|
||||
@Query() includeHead?: boolean,
|
||||
@Query() includeHead?: boolean, // Include relation
|
||||
@Query() withHead?: boolean, // List cover head
|
||||
@Query() tree?: boolean,
|
||||
@Query() status?: Status,
|
||||
@Query() query: string = "",
|
||||
|
|
@ -234,7 +235,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, true),
|
||||
OR: permissionCond(req.user, withHead),
|
||||
},
|
||||
OR: [
|
||||
{ nameEN: { contains: query } },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue