fix bug in user, employee, institution,requestList

This commit is contained in:
Kanjana 2025-04-04 14:35:28 +07:00 committed by Methapon Metanipat
parent 116fa02bd9
commit 709c21082a
9 changed files with 230 additions and 17 deletions

View file

@ -70,16 +70,16 @@ type EmployeeCreate = {
nrcNo?: string | null;
dateOfBirth: Date;
dateOfBirth?: Date | null;
gender: string;
nationality: string;
namePrefix?: string | null;
firstName: string;
firstName?: string;
firstNameEN: string;
middleName?: string | null;
middleNameEN?: string | null;
lastName: string;
lastName?: string;
lastNameEN: string;
addressEN: string;
@ -112,11 +112,11 @@ type EmployeeUpdate = {
namePrefix?: string | null;
firstName?: string;
firstNameEN?: string;
firstNameEN: string;
middleName?: string | null;
middleNameEN?: string | null;
lastName?: string;
lastNameEN?: string;
lastNameEN: string;
addressEN?: string;
address?: string;
@ -364,9 +364,10 @@ export class EmployeeController extends Controller {
},
}),
]);
if (body.provinceId !== province?.id) throw relationError("Province");
if (body.districtId !== district?.id) throw relationError("District");
if (body.subDistrictId !== subDistrict?.id) throw relationError("SubDistrict");
if (!!body.provinceId && body.provinceId !== province?.id) throw relationError("Province");
if (!!body.districtId && body.districtId !== district?.id) throw relationError("District");
if (!!body.subDistrictId && body.subDistrictId !== subDistrict?.id)
throw relationError("SubDistrict");
if (!customerBranch) throw relationError("Customer Branch");
await permissionCheck(req.user, customerBranch.customer.registeredBranch);