fix: branch under headquarter display condition

This commit is contained in:
Methapon Metanipat 2024-09-25 14:44:41 +07:00
parent 2151123897
commit 0d41f60829

View file

@ -285,7 +285,7 @@ export class BranchController extends Controller {
branch: tree
? {
where: {
AND: { OR: permissionCond(req.user, true) },
AND: { OR: permissionCond(req.user) },
OR: [
{ nameEN: { contains: query } },
{ name: { contains: query } },
@ -321,6 +321,7 @@ export class BranchController extends Controller {
@Get("{branchId}")
@Security("keycloak")
async getBranchById(
@Request() req: RequestWithUser,
@Path() branchId: string,
@Query() includeSubBranch?: boolean,
@Query() includeContact?: boolean,
@ -333,6 +334,7 @@ export class BranchController extends Controller {
createdBy: true,
updatedBy: true,
branch: includeSubBranch && {
where: { AND: { OR: permissionCond(req.user) } },
include: {
province: true,
district: true,