feat: search also cover code

This commit is contained in:
Methapon Metanipat 2024-10-16 11:47:43 +07:00
parent 9e38fac8a7
commit 0ae9ea4ddf
2 changed files with 14 additions and 2 deletions

View file

@ -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,

View file

@ -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,