diff --git a/src/controllers/branch-controller.ts b/src/controllers/branch-controller.ts index c5384e3..aa808dc 100644 --- a/src/controllers/branch-controller.ts +++ b/src/controllers/branch-controller.ts @@ -297,7 +297,7 @@ export class BranchController extends Controller { const { provinceId, districtId, subDistrictId, headOfficeId, bank, contact, code, ...rest } = body; - if (head && head.code.slice(0, -6) !== code) { + if (headOfficeId && head && head.code.slice(0, -6) !== code) { throw new HttpError( HttpStatus.BAD_REQUEST, "Headoffice code not match with branch code",