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