From 9ebbb5260f7ce309b3c53f54eea332ff7e40f708 Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Wed, 19 Jun 2024 16:11:02 +0700 Subject: [PATCH] feat: make field optional --- src/controllers/employee-controller.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/controllers/employee-controller.ts b/src/controllers/employee-controller.ts index ab43b07..a4800fd 100644 --- a/src/controllers/employee-controller.ts +++ b/src/controllers/employee-controller.ts @@ -182,7 +182,7 @@ type EmployeeUpdate = { coverageExpireDate?: Date | null; }[]; - employeeOtherInfo: { + employeeOtherInfo?: { citizenId?: string | null; fatherFirstName?: string | null; fatherLastName?: string | null; @@ -656,11 +656,7 @@ export class EmployeeController extends Controller { } if (record.status !== Status.CREATED) { - throw new HttpError( - HttpStatus.FORBIDDEN, - "Employee is in used.", - "employeeInUsed", - ); + throw new HttpError(HttpStatus.FORBIDDEN, "Employee is in used.", "employeeInUsed"); } return await prisma.employee.delete({ where: { id: employeeId } });