feat: customer type filter
This commit is contained in:
parent
629805b6f1
commit
a8d0d7f45c
1 changed files with 5 additions and 1 deletions
|
|
@ -136,13 +136,17 @@ export class CustomerController extends Controller {
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
async list(
|
async list(
|
||||||
|
@Query() customerType?: CustomerType,
|
||||||
@Query() query: string = "",
|
@Query() query: string = "",
|
||||||
@Query() page: number = 1,
|
@Query() page: number = 1,
|
||||||
@Query() pageSize: number = 30,
|
@Query() pageSize: number = 30,
|
||||||
@Query() includeBranch: boolean = false,
|
@Query() includeBranch: boolean = false,
|
||||||
) {
|
) {
|
||||||
const where = {
|
const where = {
|
||||||
OR: [{ customerName: { contains: query } }, { customerNameEN: { contains: query } }],
|
OR: [
|
||||||
|
{ customerName: { contains: query }, customerType },
|
||||||
|
{ customerNameEN: { contains: query }, customerType },
|
||||||
|
],
|
||||||
} satisfies Prisma.CustomerWhereInput;
|
} satisfies Prisma.CustomerWhereInput;
|
||||||
|
|
||||||
const [result, total] = await prisma.$transaction([
|
const [result, total] = await prisma.$transaction([
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue