From 0ae9ea4ddf24a3668aba550b8786972db7b81633 Mon Sep 17 00:00:00 2001 From: Methapon Metanipat Date: Wed, 16 Oct 2024 11:47:43 +0700 Subject: [PATCH] feat: search also cover code --- src/controllers/04-product-controller.ts | 8 +++++++- src/controllers/04-service-controller.ts | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/controllers/04-product-controller.ts b/src/controllers/04-product-controller.ts index cd0b52c..01095d2 100644 --- a/src/controllers/04-product-controller.ts +++ b/src/controllers/04-product-controller.ts @@ -134,7 +134,13 @@ export class ProductController extends Controller { @Query() pageSize: number = 30, ) { const where = { - OR: query ? [{ name: { contains: query } }, { detail: { contains: query } }] : undefined, + OR: query + ? [ + { name: { contains: query } }, + { detail: { contains: query } }, + { code: { contains: query } }, + ] + : undefined, AND: { ...filterStatus(status), productGroupId, diff --git a/src/controllers/04-service-controller.ts b/src/controllers/04-service-controller.ts index 5e5c335..a60fd31 100644 --- a/src/controllers/04-service-controller.ts +++ b/src/controllers/04-service-controller.ts @@ -123,7 +123,13 @@ export class ServiceController extends Controller { @Query() fullDetail?: boolean, ) { const where = { - OR: query ? [{ name: { contains: query } }, { detail: { contains: query } }] : undefined, + OR: query + ? [ + { name: { contains: query } }, + { detail: { contains: query } }, + { code: { contains: query } }, + ] + : undefined, AND: { ...filterStatus(status), productGroupId,