feat: also consider code from head office
This commit is contained in:
parent
8d446113da
commit
c7f7713cbd
1 changed files with 5 additions and 1 deletions
|
|
@ -316,9 +316,13 @@ export class CustomerBranchController extends Controller {
|
||||||
|
|
||||||
const record = await prisma.$transaction(
|
const record = await prisma.$transaction(
|
||||||
async (tx) => {
|
async (tx) => {
|
||||||
|
const headofficeCode = customer.branch.at(0)?.code.slice(0, -3);
|
||||||
|
|
||||||
let runningKey = "";
|
let runningKey = "";
|
||||||
|
|
||||||
if ("citizenId" in body) {
|
if (headofficeCode) {
|
||||||
|
runningKey = `CUSTOMER_BRANCH_${headofficeCode}`;
|
||||||
|
} else if ("citizenId" in body) {
|
||||||
runningKey = `CUSTOMER_BRANCH_${body.citizenId}`;
|
runningKey = `CUSTOMER_BRANCH_${body.citizenId}`;
|
||||||
} else {
|
} else {
|
||||||
runningKey = `CUSTOMER_BRANCH_${body.legalPersonNo}`;
|
runningKey = `CUSTOMER_BRANCH_${body.legalPersonNo}`;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue