refactor: only query if have
This commit is contained in:
parent
7bd9756e5d
commit
213ec28565
1 changed files with 26 additions and 24 deletions
|
|
@ -152,7 +152,8 @@ export class CustomerBranchController extends Controller {
|
||||||
@Query() pageSize: number = 30,
|
@Query() pageSize: number = 30,
|
||||||
) {
|
) {
|
||||||
const where = {
|
const where = {
|
||||||
OR: [
|
OR: query
|
||||||
|
? [
|
||||||
{ registerName: { contains: query } },
|
{ registerName: { contains: query } },
|
||||||
{ registerNameEN: { contains: query } },
|
{ registerNameEN: { contains: query } },
|
||||||
{ email: { contains: query } },
|
{ email: { contains: query } },
|
||||||
|
|
@ -175,7 +176,8 @@ export class CustomerBranchController extends Controller {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
]
|
||||||
|
: undefined,
|
||||||
AND: {
|
AND: {
|
||||||
customer: isSystem(req.user)
|
customer: isSystem(req.user)
|
||||||
? undefined
|
? undefined
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue