feat: accept param active branch only
This commit is contained in:
parent
cb9c9cef68
commit
9630d02924
2 changed files with 19 additions and 2 deletions
|
|
@ -40,6 +40,7 @@ import {
|
|||
} from "../utils/minio";
|
||||
import { filterStatus } from "../services/prisma";
|
||||
import {
|
||||
branchActiveOnlyCond,
|
||||
branchRelationPermInclude,
|
||||
createPermCheck,
|
||||
createPermCondition,
|
||||
|
|
@ -263,6 +264,7 @@ export class UserController extends Controller {
|
|||
@Query() pageSize: number = 30,
|
||||
@Query() status?: Status,
|
||||
@Query() responsibleDistrictId?: string,
|
||||
@Query() activeBranchOnly?: boolean,
|
||||
) {
|
||||
return this.getUserByCriteria(
|
||||
req,
|
||||
|
|
@ -273,6 +275,7 @@ export class UserController extends Controller {
|
|||
pageSize,
|
||||
status,
|
||||
responsibleDistrictId,
|
||||
activeBranchOnly,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -287,6 +290,7 @@ export class UserController extends Controller {
|
|||
@Query() pageSize: number = 30,
|
||||
@Query() status?: Status,
|
||||
@Query() responsibleDistrictId?: string,
|
||||
@Query() activeBranchOnly?: boolean,
|
||||
@Body()
|
||||
body?: {
|
||||
userId?: string[];
|
||||
|
|
@ -337,11 +341,13 @@ export class UserController extends Controller {
|
|||
userType,
|
||||
...filterStatus(status),
|
||||
branch: isSystem(req.user)
|
||||
? undefined
|
||||
? activeBranchOnly
|
||||
? { some: { branch: branchActiveOnlyCond(activeBranchOnly) } }
|
||||
: undefined
|
||||
: {
|
||||
some: {
|
||||
branch: {
|
||||
OR: permissionCond(req.user),
|
||||
OR: permissionCond(req.user, { activeOnly: activeBranchOnly }),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue