refactor: only query if have

This commit is contained in:
Methapon Metanipat 2024-09-09 14:59:15 +07:00
parent 7bd9756e5d
commit 213ec28565

View file

@ -152,7 +152,8 @@ export class CustomerBranchController extends Controller {
@Query() pageSize: number = 30,
) {
const where = {
OR: [
OR: query
? [
{ registerName: { contains: query } },
{ registerNameEN: { contains: query } },
{ email: { contains: query } },
@ -175,7 +176,8 @@ export class CustomerBranchController extends Controller {
],
},
},
],
]
: undefined,
AND: {
customer: isSystem(req.user)
? undefined