feat: update quotation endpoints with permission

This commit is contained in:
Methapon Metanipat 2024-09-26 14:32:44 +07:00
parent 3ee1f5ed0f
commit 56c2f1d5ed
3 changed files with 158 additions and 128 deletions

View file

@ -0,0 +1,25 @@
/*
Warnings:
- Added the required column `actorName` to the `Quotation` table without a default value. This is not possible if the table is not empty.
- Added the required column `contactName` to the `Quotation` table without a default value. This is not possible if the table is not empty.
- Added the required column `contactTel` to the `Quotation` table without a default value. This is not possible if the table is not empty.
- Added the required column `documentReceivePoint` to the `Quotation` table without a default value. This is not possible if the table is not empty.
- Added the required column `dueDate` to the `Quotation` table without a default value. This is not possible if the table is not empty.
- Added the required column `workName` to the `Quotation` table without a default value. This is not possible if the table is not empty.
*/
-- DropForeignKey
ALTER TABLE "Quotation" DROP CONSTRAINT "Quotation_customerId_fkey";
-- AlterTable
ALTER TABLE "Quotation" ADD COLUMN "actorName" TEXT NOT NULL,
ADD COLUMN "contactName" TEXT NOT NULL,
ADD COLUMN "contactTel" TEXT NOT NULL,
ADD COLUMN "documentReceivePoint" TEXT NOT NULL,
ADD COLUMN "dueDate" DATE NOT NULL,
ADD COLUMN "workName" TEXT NOT NULL,
ALTER COLUMN "customerId" DROP NOT NULL;
-- AddForeignKey
ALTER TABLE "Quotation" ADD CONSTRAINT "Quotation_customerId_fkey" FOREIGN KEY ("customerId") REFERENCES "Customer"("id") ON DELETE SET NULL ON UPDATE CASCADE;

View file

@ -1020,16 +1020,21 @@ enum PayCondition {
model Quotation {
id String @id @default(cuid())
customerId String
customer Customer @relation(fields: [customerId], references: [id])
customerBranchId String
customerBranch CustomerBranch @relation(fields: [customerBranchId], references: [id])
status Status @default(CREATED)
statusOrder Int @default(0)
code String
code String
actorName String
workName String
contactName String
contactTel String
documentReceivePoint String
dueDate DateTime @db.Date
date DateTime @default(now())
payCondition PayCondition
@ -1051,12 +1056,14 @@ model Quotation {
vatExcluded Float
finalPrice Float
createdAt DateTime @default(now())
createdBy User? @relation(name: "QuotationCreatedByUser", fields: [createdByUserId], references: [id], onDelete: SetNull)
createdAt DateTime @default(now())
createdBy User? @relation(name: "QuotationCreatedByUser", fields: [createdByUserId], references: [id], onDelete: SetNull)
createdByUserId String?
updatedAt DateTime @updatedAt
updatedBy User? @relation(name: "QuotationUpdatedByUser", fields: [updatedByUserId], references: [id], onDelete: SetNull)
updatedAt DateTime @updatedAt
updatedBy User? @relation(name: "QuotationUpdatedByUser", fields: [updatedByUserId], references: [id], onDelete: SetNull)
updatedByUserId String?
Customer Customer? @relation(fields: [customerId], references: [id])
customerId String?
}
model QuotationPaySplit {