feat: remove unused code generator

This commit is contained in:
Methapon Metanipat 2024-08-20 09:35:14 +07:00
parent 816bda07b8
commit 0894a64c9e

View file

@ -312,21 +312,10 @@ export class CustomerController extends Controller {
const record = await prisma.$transaction(
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();
const exist = await tx.customer.findFirst({
where: { code: `${body.code}000000` },
where: { code: body.code },
});
if (exist) {
@ -356,9 +345,9 @@ export class CustomerController extends Controller {
branch: {
createMany: {
data:
customerBranch?.map((v, i) => ({
customerBranch?.map((v) => ({
...v,
code: `${body.code}${`${last.value - customerBranch?.length + i + 1}`.padStart(6, "0")}`,
code: body.code,
createdByUserId: req.user.sub,
updatedByUserId: req.user.sub,
})) || [],