fix: wrong length slice
This commit is contained in:
parent
c2171c33ad
commit
95d657f7e2
1 changed files with 2 additions and 2 deletions
|
|
@ -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)}`,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue