feat: add query string

This commit is contained in:
Methapon2001 2024-06-13 17:21:22 +07:00
parent 0747fca92e
commit 5b6c7e7ac8
3 changed files with 23 additions and 18 deletions

View file

@ -138,14 +138,15 @@ export class CustomerController extends Controller {
async list(
@Query() customerType?: CustomerType,
@Query() query: string = "",
@Query() status?: Status,
@Query() page: number = 1,
@Query() pageSize: number = 30,
@Query() includeBranch: boolean = false,
) {
const where = {
OR: [
{ customerName: { contains: query }, customerType },
{ customerNameEN: { contains: query }, customerType },
{ customerName: { contains: query }, customerType, status },
{ customerNameEN: { contains: query }, customerType, status },
],
} satisfies Prisma.CustomerWhereInput;