diff --git a/prisma/migrations/20240614095339_update_product_fields/migration.sql b/prisma/migrations/20240614095339_update_product_fields/migration.sql new file mode 100644 index 0000000..94cf800 --- /dev/null +++ b/prisma/migrations/20240614095339_update_product_fields/migration.sql @@ -0,0 +1,10 @@ +/* + Warnings: + + - Changed the type of `process` on the `Product` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. + +*/ +-- AlterTable +ALTER TABLE "Product" ADD COLUMN "remark" TEXT, +DROP COLUMN "process", +ADD COLUMN "process" INTEGER NOT NULL; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index b731ce5..549218b 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -631,13 +631,15 @@ model Product { code String name String detail String - process String + process Int price Int agentPrice Int serviceCharge Int status Status @default(CREATED) + remark String? + productType ProductType? @relation(fields: [productTypeId], references: [id], onDelete: SetNull) productTypeId String? diff --git a/src/controllers/product/product-controller.ts b/src/controllers/product/product-controller.ts index 954f1a4..49a5092 100644 --- a/src/controllers/product/product-controller.ts +++ b/src/controllers/product/product-controller.ts @@ -30,19 +30,21 @@ type ProductCreate = { code: "AC" | "DO" | "ac" | "do"; name: string; detail: string; - process: string; + process: number; price: number; agentPrice: number; serviceCharge: number; + remark?: string; }; type ProductUpdate = { - name: string; - detail: string; - process?: string; - price: number; - agentPrice: number; - serviceCharge: number; + name?: string; + detail?: string; + process?: number; + price?: number; + agentPrice?: number; + serviceCharge?: number; + remark?: string; }; function imageLocation(id: string) {