diff --git a/src/controllers/01-branch-controller.ts b/src/controllers/01-branch-controller.ts index e64e1c0..f6fc788 100644 --- a/src/controllers/01-branch-controller.ts +++ b/src/controllers/01-branch-controller.ts @@ -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(query, [ { code: { contains: query, mode: "insensitive" } },