From a24bf4fb4b1689aacad4abc0b8cad63e3522f922 Mon Sep 17 00:00:00 2001 From: Methapon Metanipat Date: Tue, 15 Oct 2024 09:42:16 +0700 Subject: [PATCH] refactor: adjust field --- .../20241015022632_add_flag_field/migration.sql | 2 ++ .../migrations/20241015024201_remove_field/migration.sql | 8 ++++++++ prisma/schema.prisma | 3 ++- src/controllers/04-product-controller.ts | 2 ++ src/controllers/05-quotation-controller.ts | 2 -- 5 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 prisma/migrations/20241015022632_add_flag_field/migration.sql create mode 100644 prisma/migrations/20241015024201_remove_field/migration.sql diff --git a/prisma/migrations/20241015022632_add_flag_field/migration.sql b/prisma/migrations/20241015022632_add_flag_field/migration.sql new file mode 100644 index 0000000..d561a67 --- /dev/null +++ b/prisma/migrations/20241015022632_add_flag_field/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE "Product" ADD COLUMN "calcVat" BOOLEAN NOT NULL DEFAULT true; diff --git a/prisma/migrations/20241015024201_remove_field/migration.sql b/prisma/migrations/20241015024201_remove_field/migration.sql new file mode 100644 index 0000000..65bfc4a --- /dev/null +++ b/prisma/migrations/20241015024201_remove_field/migration.sql @@ -0,0 +1,8 @@ +/* + Warnings: + + - You are about to drop the column `actorName` on the `Quotation` table. All the data in the column will be lost. + +*/ +-- AlterTable +ALTER TABLE "Quotation" DROP COLUMN "actorName"; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 4173445..0d842a6 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -976,6 +976,8 @@ model Product { vatIncluded Boolean? expenseType String? + calcVat Boolean @default(true) + status Status @default(CREATED) statusOrder Int @default(0) @@ -1097,7 +1099,6 @@ model Quotation { code String - actorName String workName String contactName String contactTel String diff --git a/src/controllers/04-product-controller.ts b/src/controllers/04-product-controller.ts index c173db0..cd0b52c 100644 --- a/src/controllers/04-product-controller.ts +++ b/src/controllers/04-product-controller.ts @@ -70,6 +70,7 @@ type ProductCreate = { agentPrice: number; serviceCharge: number; vatIncluded?: boolean; + calcVat?: boolean; expenseType?: string; selectedImage?: string; shared?: boolean; @@ -87,6 +88,7 @@ type ProductUpdate = { serviceCharge?: number; remark?: string; vatIncluded?: boolean; + calcVat?: boolean; expenseType?: string; selectedImage?: string; shared?: boolean; diff --git a/src/controllers/05-quotation-controller.ts b/src/controllers/05-quotation-controller.ts index c45a8bc..f27db62 100644 --- a/src/controllers/05-quotation-controller.ts +++ b/src/controllers/05-quotation-controller.ts @@ -28,7 +28,6 @@ import { precisionRound } from "../utils/arithmetic"; type QuotationCreate = { status?: Status; - actorName: string; workName: string; contactName: string; contactTel: string; @@ -83,7 +82,6 @@ type QuotationCreate = { type QuotationUpdate = { status?: "ACTIVE" | "INACTIVE"; - actorName?: string; workName?: string; contactName?: string; contactTel?: string;