From a8d0d7f45c9b07f12417e07b30d9034267b02b00 Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Mon, 10 Jun 2024 14:11:45 +0700 Subject: [PATCH] feat: customer type filter --- src/controllers/customer-controller.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/controllers/customer-controller.ts b/src/controllers/customer-controller.ts index ebcd031..4da54e8 100644 --- a/src/controllers/customer-controller.ts +++ b/src/controllers/customer-controller.ts @@ -136,13 +136,17 @@ export class CustomerController extends Controller { @Get() async list( + @Query() customerType?: CustomerType, @Query() query: string = "", @Query() page: number = 1, @Query() pageSize: number = 30, @Query() includeBranch: boolean = false, ) { const where = { - OR: [{ customerName: { contains: query } }, { customerNameEN: { contains: query } }], + OR: [ + { customerName: { contains: query }, customerType }, + { customerNameEN: { contains: query }, customerType }, + ], } satisfies Prisma.CustomerWhereInput; const [result, total] = await prisma.$transaction([