feat: filter by customerId

This commit is contained in:
Methapon Metanipat 2024-08-19 11:18:57 +07:00
parent a028d8f9b3
commit ba74eccec7

View file

@ -260,6 +260,7 @@ export class EmployeeController extends Controller {
@Query() zipCode?: string,
@Query() gender?: string,
@Query() status?: Status,
@Query() customerId?: string,
@Query() query: string = "",
@Query() page: number = 1,
@Query() pageSize: number = 30,
@ -279,6 +280,9 @@ export class EmployeeController extends Controller {
{ lastName: { contains: query }, zipCode, gender, ...filterStatus(status) },
{ lastNameEN: { contains: query }, zipCode, gender, ...filterStatus(status) },
],
AND: {
customerBranch: customerId ? { id: customerId } : undefined,
},
} satisfies Prisma.EmployeeWhereInput;
const [result, total] = await prisma.$transaction([