feat: add payment post process

This commit is contained in:
Methapon Metanipat 2024-10-09 15:04:59 +07:00
parent 80a407ba61
commit 07742732ac
5 changed files with 133 additions and 6 deletions

View file

@ -0,0 +1,29 @@
-- CreateTable
CREATE TABLE "RequestData" (
"id" TEXT NOT NULL,
"employeeId" TEXT NOT NULL,
"quotationId" TEXT NOT NULL,
CONSTRAINT "RequestData_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "RequestWork" (
"id" TEXT NOT NULL,
"requestDataId" TEXT NOT NULL,
"productServiceId" TEXT NOT NULL,
CONSTRAINT "RequestWork_pkey" PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "RequestData" ADD CONSTRAINT "RequestData_employeeId_fkey" FOREIGN KEY ("employeeId") REFERENCES "Employee"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "RequestData" ADD CONSTRAINT "RequestData_quotationId_fkey" FOREIGN KEY ("quotationId") REFERENCES "Quotation"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "RequestWork" ADD CONSTRAINT "RequestWork_requestDataId_fkey" FOREIGN KEY ("requestDataId") REFERENCES "RequestData"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "RequestWork" ADD CONSTRAINT "RequestWork_productServiceId_fkey" FOREIGN KEY ("productServiceId") REFERENCES "QuotationProductServiceList"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

View file

@ -734,6 +734,7 @@ model Employee {
editHistory EmployeeHistory[]
quotationWorker QuotationWorker[]
quotationProductServiceWorker QuotationProductServiceWorker[]
requestData RequestData[]
}
model EmployeeHistory {
@ -1119,6 +1120,8 @@ model Quotation {
discount Float @default(0)
finalPrice Float
requestData RequestData[]
createdAt DateTime @default(now())
createdBy User? @relation(name: "QuotationCreatedByUser", fields: [createdByUserId], references: [id], onDelete: SetNull)
createdByUserId String?
@ -1170,7 +1173,8 @@ model QuotationProductServiceList {
serviceId String?
service Service? @relation(fields: [serviceId], references: [id])
worker QuotationProductServiceWorker[]
worker QuotationProductServiceWorker[]
RequestWork RequestWork[]
}
model QuotationProductServiceWorker {
@ -1182,3 +1186,25 @@ model QuotationProductServiceWorker {
@@id([productServiceId, employeeId])
}
model RequestData {
id String @id @default(cuid())
employee Employee @relation(fields: [employeeId], references: [id])
employeeId String
quotation Quotation @relation(fields: [quotationId], references: [id])
quotationId String
requestWork RequestWork[]
}
model RequestWork {
id String @id @default(cuid())
request RequestData @relation(fields: [requestDataId], references: [id])
requestDataId String
productService QuotationProductServiceList @relation(fields: [productServiceId], references: [id])
productServiceId String
}