fix: customer code come from wrong data

This commit is contained in:
Methapon Metanipat 2024-08-22 10:14:40 +07:00
parent 0c3084cdbf
commit 92aaee2584

View file

@ -349,7 +349,7 @@ export class CustomerBranchController extends Controller {
},
data: {
...rest,
code: `${"citizenId" in body ? body.citizenId : body.legalPersonNo}-${last.value - 1}`,
code: `${runningKey.replace("CUSTOMER_BRANCH_", "")}-${last.value - 1}`,
customer: { connect: { id: customerId } },
province: { connect: provinceId ? { id: provinceId } : undefined },
district: { connect: districtId ? { id: districtId } : undefined },