feat: complete reporting and filing workflows

This commit is contained in:
hectorzhao
2026-07-28 20:28:47 +08:00
parent 352a6293b4
commit 99c8c7c68b
52 changed files with 3490 additions and 376 deletions
@@ -0,0 +1,35 @@
ALTER TABLE "ReportMaterialImportBatch"
ADD COLUMN "reviewedById" TEXT,
ADD COLUMN "reviewedAt" TIMESTAMP(3);
CREATE TABLE "ReportMaterialImportItem" (
"id" TEXT NOT NULL,
"batchId" TEXT NOT NULL,
"rowNumber" INTEGER NOT NULL,
"reportType" TEXT NOT NULL,
"operation" TEXT NOT NULL,
"targetId" TEXT,
"status" TEXT NOT NULL DEFAULT 'pending_review',
"payload" JSONB NOT NULL,
"originalSnapshot" JSONB,
"errorMessage" TEXT,
"reviewReason" TEXT,
"reviewedById" TEXT,
"reviewedAt" TIMESTAMP(3),
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "ReportMaterialImportItem_pkey" PRIMARY KEY ("id"),
CONSTRAINT "ReportMaterialImportItem_batchId_fkey"
FOREIGN KEY ("batchId") REFERENCES "ReportMaterialImportBatch"("id")
ON DELETE CASCADE ON UPDATE CASCADE
);
CREATE UNIQUE INDEX "ReportMaterialImportItem_batchId_rowNumber_key"
ON "ReportMaterialImportItem"("batchId", "rowNumber");
CREATE INDEX "ReportMaterialImportItem_batchId_status_idx"
ON "ReportMaterialImportItem"("batchId", "status");
CREATE INDEX "ReportMaterialImportItem_reportType_status_createdAt_idx"
ON "ReportMaterialImportItem"("reportType", "status", "createdAt");
CREATE INDEX "ReportMaterialImportItem_targetId_idx"
ON "ReportMaterialImportItem"("targetId");