From 73ec9bd323c8580a00e4df05545b5f4ff76dacdf Mon Sep 17 00:00:00 2001 From: Methapon Metanipat Date: Fri, 25 Oct 2024 09:01:32 +0700 Subject: [PATCH] feat: add installment no to quotation data This is for when issue invoice. --- prisma/migrations/20241025020102_add_field/migration.sql | 2 ++ prisma/schema.prisma | 2 ++ src/controllers/05-quotation-controller.ts | 4 ++++ 3 files changed, 8 insertions(+) create mode 100644 prisma/migrations/20241025020102_add_field/migration.sql diff --git a/prisma/migrations/20241025020102_add_field/migration.sql b/prisma/migrations/20241025020102_add_field/migration.sql new file mode 100644 index 0000000..729d660 --- /dev/null +++ b/prisma/migrations/20241025020102_add_field/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE "QuotationProductServiceList" ADD COLUMN "installmentNo" INTEGER; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 19ca1a7..ce5b029 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -1208,6 +1208,8 @@ model QuotationProductServiceList { discount Float pricePerUnit Float + installmentNo Int? + productId String product Product @relation(fields: [productId], references: [id]) diff --git a/src/controllers/05-quotation-controller.ts b/src/controllers/05-quotation-controller.ts index 045d6ce..300481d 100644 --- a/src/controllers/05-quotation-controller.ts +++ b/src/controllers/05-quotation-controller.ts @@ -76,6 +76,7 @@ type QuotationCreate = { productId: string; amount: number; discount?: number; + installmentNo?: number; workerIndex?: number[]; }[]; }; @@ -130,6 +131,7 @@ type QuotationUpdate = { productId: string; amount: number; discount?: number; + installmentNo?: number; workerIndex?: number[]; }[]; }; @@ -412,6 +414,7 @@ export class QuotationController extends Controller { pricePerUnit, amount: v.amount, discount: v.discount || 0, + installmentNo: v.installmentNo, vat, worker: { create: sortedEmployeeId @@ -667,6 +670,7 @@ export class QuotationController extends Controller { pricePerUnit, amount: v.amount, discount: v.discount || 0, + installmentNo: v.installmentNo, vat, worker: { create: sortedEmployeeId