refactor: drop field

This commit is contained in:
Methapon Metanipat 2024-08-22 11:42:06 +07:00
parent 42a036c34f
commit c548386b56
3 changed files with 16 additions and 9 deletions

View file

@ -56,7 +56,6 @@ type EmployeeCreate = {
addressEN: string;
address: string;
zipCode: string;
passportType: string;
passportNumber: string;
@ -139,7 +138,6 @@ type EmployeeUpdate = {
addressEN?: string;
address?: string;
zipCode?: string;
passportType?: string;
passportNumber?: string;
@ -275,13 +273,16 @@ export class EmployeeController extends Controller {
const where = {
OR: [
{ firstName: { contains: query }, zipCode, gender, ...filterStatus(status) },
{ firstNameEN: { contains: query }, zipCode, gender, ...filterStatus(status) },
{ lastName: { contains: query }, zipCode, gender, ...filterStatus(status) },
{ lastNameEN: { contains: query }, zipCode, gender, ...filterStatus(status) },
{ firstName: { contains: query } },
{ firstNameEN: { contains: query } },
{ lastName: { contains: query } },
{ lastNameEN: { contains: query } },
],
AND: {
customerBranch: customerId ? { customerId: customerId } : undefined,
...filterStatus(status),
customerBranch: customerId ? { customerId } : undefined,
subDistrict: zipCode ? { zipCode } : undefined,
gender,
},
} satisfies Prisma.EmployeeWhereInput;