diff --git a/src/controllers/01-branch-controller.ts b/src/controllers/01-branch-controller.ts index 4545b22..b040fb6 100644 --- a/src/controllers/01-branch-controller.ts +++ b/src/controllers/01-branch-controller.ts @@ -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 } },