fix: wrong create value
This commit is contained in:
parent
c434b085bc
commit
96298daab2
1 changed files with 3 additions and 3 deletions
|
|
@ -318,9 +318,9 @@ export class CustomerController extends Controller {
|
||||||
},
|
},
|
||||||
create: {
|
create: {
|
||||||
key: `CUSTOMER_${body.code.toLocaleUpperCase()}`,
|
key: `CUSTOMER_${body.code.toLocaleUpperCase()}`,
|
||||||
value: 1,
|
value: body.customerBranch?.length || 0,
|
||||||
},
|
},
|
||||||
update: { value: { increment: (body.customerBranch?.length || 0) + 1 } },
|
update: { value: { increment: body.customerBranch?.length || 0 } },
|
||||||
});
|
});
|
||||||
|
|
||||||
body.code = body.code.toLocaleUpperCase();
|
body.code = body.code.toLocaleUpperCase();
|
||||||
|
|
@ -358,7 +358,7 @@ export class CustomerController extends Controller {
|
||||||
data:
|
data:
|
||||||
customerBranch?.map((v, i) => ({
|
customerBranch?.map((v, i) => ({
|
||||||
...v,
|
...v,
|
||||||
code: `${body.code}${`${last.value - customerBranch?.length + i + 2}`.padStart(6, "0")}`,
|
code: `${body.code}${`${last.value - customerBranch?.length + i + 1}`.padStart(6, "0")}`,
|
||||||
createdByUserId: req.user.sub,
|
createdByUserId: req.user.sub,
|
||||||
updatedByUserId: req.user.sub,
|
updatedByUserId: req.user.sub,
|
||||||
})) || [],
|
})) || [],
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue