From c2fb5ab1eca0b13812398e7c66d4fcb309ecccfe Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Thu, 19 Dec 2024 16:56:57 +0700 Subject: [PATCH] feat: search invoice now cover more field --- src/controllers/04-invoice-controller.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/controllers/04-invoice-controller.ts b/src/controllers/04-invoice-controller.ts index 8d4f642..177f27a 100644 --- a/src/controllers/04-invoice-controller.ts +++ b/src/controllers/04-invoice-controller.ts @@ -47,9 +47,30 @@ export class InvoiceController extends Controller { @Request() req: RequestWithUser, @Query() page: number = 1, @Query() pageSize: number = 30, + @Query() query: string = "", @Query() quotationId?: string, ) { const where: Prisma.InvoiceWhereInput = { + OR: [ + { code: { contains: query, mode: "insensitive" } }, + { quotation: { workName: { contains: query } } }, + { + quotation: { + customerBranch: { + OR: [ + { code: { contains: query, mode: "insensitive" } }, + { customerName: { contains: query } }, + { registerName: { contains: query } }, + { registerNameEN: { contains: query } }, + { firstName: { contains: query } }, + { firstNameEN: { contains: query } }, + { lastName: { contains: query } }, + { lastNameEN: { contains: query } }, + ], + }, + }, + }, + ], quotationId, quotation: { registeredBranch: {