feat: customer type filter

This commit is contained in:
Methapon2001 2024-06-10 14:11:45 +07:00
parent 629805b6f1
commit a8d0d7f45c

View file

@ -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([