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() @Get()
async list( async list(
@Query() customerType?: CustomerType,
@Query() query: string = "", @Query() query: string = "",
@Query() page: number = 1, @Query() page: number = 1,
@Query() pageSize: number = 30, @Query() pageSize: number = 30,
@Query() includeBranch: boolean = false, @Query() includeBranch: boolean = false,
) { ) {
const where = { const where = {
OR: [{ customerName: { contains: query } }, { customerNameEN: { contains: query } }], OR: [
{ customerName: { contains: query }, customerType },
{ customerNameEN: { contains: query }, customerType },
],
} satisfies Prisma.CustomerWhereInput; } satisfies Prisma.CustomerWhereInput;
const [result, total] = await prisma.$transaction([ const [result, total] = await prisma.$transaction([