feat: remove unused code generator
This commit is contained in:
parent
816bda07b8
commit
0894a64c9e
1 changed files with 3 additions and 14 deletions
|
|
@ -312,21 +312,10 @@ export class CustomerController extends Controller {
|
||||||
|
|
||||||
const record = await prisma.$transaction(
|
const record = await prisma.$transaction(
|
||||||
async (tx) => {
|
async (tx) => {
|
||||||
const last = await tx.runningNo.upsert({
|
|
||||||
where: {
|
|
||||||
key: `CUSTOMER_${body.code.toLocaleUpperCase()}`,
|
|
||||||
},
|
|
||||||
create: {
|
|
||||||
key: `CUSTOMER_${body.code.toLocaleUpperCase()}`,
|
|
||||||
value: body.customerBranch?.length || 0,
|
|
||||||
},
|
|
||||||
update: { value: { increment: body.customerBranch?.length || 0 } },
|
|
||||||
});
|
|
||||||
|
|
||||||
body.code = body.code.toLocaleUpperCase();
|
body.code = body.code.toLocaleUpperCase();
|
||||||
|
|
||||||
const exist = await tx.customer.findFirst({
|
const exist = await tx.customer.findFirst({
|
||||||
where: { code: `${body.code}000000` },
|
where: { code: body.code },
|
||||||
});
|
});
|
||||||
|
|
||||||
if (exist) {
|
if (exist) {
|
||||||
|
|
@ -356,9 +345,9 @@ export class CustomerController extends Controller {
|
||||||
branch: {
|
branch: {
|
||||||
createMany: {
|
createMany: {
|
||||||
data:
|
data:
|
||||||
customerBranch?.map((v, i) => ({
|
customerBranch?.map((v) => ({
|
||||||
...v,
|
...v,
|
||||||
code: `${body.code}${`${last.value - customerBranch?.length + i + 1}`.padStart(6, "0")}`,
|
code: body.code,
|
||||||
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