diff --git a/src/controllers/branch-controller.ts b/src/controllers/branch-controller.ts index 22692e0..6de8699 100644 --- a/src/controllers/branch-controller.ts +++ b/src/controllers/branch-controller.ts @@ -300,7 +300,7 @@ export class BranchController extends Controller { const { provinceId, districtId, subDistrictId, headOfficeId, bank, contact, code, ...rest } = body; - if (headOfficeId && head && head.code.slice(0, -6) !== code) { + if (headOfficeId && head && head.code.slice(0, -5) !== code) { throw new HttpError( HttpStatus.BAD_REQUEST, "Headoffice code not match with branch code", @@ -572,7 +572,7 @@ export class BranchController extends Controller { if (record.isHeadOffice) { await tx.runningNo.delete({ where: { - key: `MAIN_BRANCH_${record.code.slice(0, -6)}`, + key: `MAIN_BRANCH_${record.code.slice(0, -5)}`, }, }); }