Add functions to commission form

This commit is contained in:
2026-01-01 09:47:04 +01:00
parent 61421aa487
commit 42f23dddcf
12 changed files with 982 additions and 3 deletions

View File

@ -0,0 +1,24 @@
-- AlterTable
ALTER TABLE "CommissionRequest" ADD COLUMN "customFields" JSONB,
ADD COLUMN "customerSocials" TEXT,
ADD COLUMN "ipAddress" TEXT,
ADD COLUMN "status" TEXT NOT NULL DEFAULT 'NEW',
ADD COLUMN "userAgent" TEXT;
-- CreateTable
CREATE TABLE "CommissionRequestFile" (
"id" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
"sortIndex" INTEGER NOT NULL DEFAULT 0,
"objectKey" TEXT NOT NULL,
"originalName" TEXT NOT NULL,
"mimeType" TEXT NOT NULL,
"sizeBytes" INTEGER NOT NULL,
"requestId" TEXT NOT NULL,
CONSTRAINT "CommissionRequestFile_pkey" PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "CommissionRequestFile" ADD CONSTRAINT "CommissionRequestFile_requestId_fkey" FOREIGN KEY ("requestId") REFERENCES "CommissionRequest"("id") ON DELETE CASCADE ON UPDATE CASCADE;

View File

@ -0,0 +1,30 @@
/*
Warnings:
- You are about to drop the column `mimeType` on the `CommissionRequestFile` table. All the data in the column will be lost.
- You are about to drop the column `objectKey` on the `CommissionRequestFile` table. All the data in the column will be lost.
- You are about to drop the column `originalName` on the `CommissionRequestFile` table. All the data in the column will be lost.
- You are about to drop the column `sizeBytes` on the `CommissionRequestFile` table. All the data in the column will be lost.
- You are about to drop the column `sortIndex` on the `CommissionRequestFile` table. All the data in the column will be lost.
- A unique constraint covering the columns `[fileKey]` on the table `CommissionRequestFile` will be added. If there are existing duplicate values, this will fail.
- Added the required column `fileKey` to the `CommissionRequestFile` table without a default value. This is not possible if the table is not empty.
- Added the required column `fileSize` to the `CommissionRequestFile` table without a default value. This is not possible if the table is not empty.
- Added the required column `fileType` to the `CommissionRequestFile` table without a default value. This is not possible if the table is not empty.
- Added the required column `originalFile` to the `CommissionRequestFile` table without a default value. This is not possible if the table is not empty.
- Added the required column `uploadDate` to the `CommissionRequestFile` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "CommissionRequestFile" DROP COLUMN "mimeType",
DROP COLUMN "objectKey",
DROP COLUMN "originalName",
DROP COLUMN "sizeBytes",
DROP COLUMN "sortIndex",
ADD COLUMN "fileKey" TEXT NOT NULL,
ADD COLUMN "fileSize" INTEGER NOT NULL,
ADD COLUMN "fileType" TEXT NOT NULL,
ADD COLUMN "originalFile" TEXT NOT NULL,
ADD COLUMN "uploadDate" TIMESTAMP(3) NOT NULL;
-- CreateIndex
CREATE UNIQUE INDEX "CommissionRequestFile_fileKey_key" ON "CommissionRequestFile"("fileKey");

View File

@ -360,6 +360,12 @@ model CommissionRequest {
customerName String
customerEmail String
message String
status String @default("NEW") // NEW | REVIEWING | ACCEPTED | REJECTED | SPAM
customerSocials String?
ipAddress String?
userAgent String?
customFields Json?
optionId String?
typeId String?
@ -367,6 +373,7 @@ model CommissionRequest {
type CommissionType? @relation(fields: [typeId], references: [id])
extras CommissionExtra[]
files CommissionRequestFile[]
}
model CommissionGuidelines {
@ -380,6 +387,21 @@ model CommissionGuidelines {
@@index([isActive])
}
model CommissionRequestFile {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
fileKey String @unique
originalFile String
fileType String
fileSize Int
uploadDate DateTime
requestId String
request CommissionRequest @relation(fields: [requestId], references: [id], onDelete: Cascade)
}
model TermsOfService {
id String @id @default(cuid())
createdAt DateTime @default(now())