feat(10-01): add Tender/TenderSourcePollConfig models + ingestion packages

- Install fast-xml-parser, adm-zip, csv-parse in @tessera/api
- Add global Tender model (no tenantId — D-03 platform-global data)
- Add singleton TenderSourcePollConfig (sourceType @unique)
- Handwritten additive migration for both tables
- Regenerate Prisma client
This commit is contained in:
2026-07-21 10:33:24 +02:00
parent b33213b04b
commit 713b1eb748
4 changed files with 175 additions and 0 deletions
@@ -0,0 +1,54 @@
-- CreateTable
CREATE TABLE IF NOT EXISTS "Tender" (
"id" TEXT NOT NULL,
"sourcePortal" TEXT NOT NULL,
"sourceNoticeId" TEXT NOT NULL,
"ocid" TEXT,
"dedupKey" TEXT NOT NULL,
"title" TEXT NOT NULL,
"buyerName" TEXT,
"cpvCodes" TEXT[] DEFAULT ARRAY[]::TEXT[],
"region" TEXT,
"plz" TEXT,
"bundesland" TEXT,
"deadlineAt" TIMESTAMP(3),
"estimatedValue" DECIMAL(14,2),
"procedureType" TEXT,
"status" TEXT NOT NULL DEFAULT 'active',
"sourceUrl" TEXT,
"contentHash" TEXT NOT NULL,
"rawPayload" JSONB,
"publishedAt" TIMESTAMP(3) NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "Tender_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE IF NOT EXISTS "TenderSourcePollConfig" (
"id" TEXT NOT NULL,
"sourceType" TEXT NOT NULL,
"pollIntervalMin" INTEGER NOT NULL DEFAULT 60,
"isActive" BOOLEAN NOT NULL DEFAULT false,
"lastIngestedDay" TIMESTAMP(3),
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "TenderSourcePollConfig_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX IF NOT EXISTS "Tender_dedupKey_key" ON "Tender"("dedupKey");
-- CreateIndex
CREATE INDEX IF NOT EXISTS "Tender_status_idx" ON "Tender"("status");
-- CreateIndex
CREATE INDEX IF NOT EXISTS "Tender_deadlineAt_idx" ON "Tender"("deadlineAt");
-- CreateIndex
CREATE INDEX IF NOT EXISTS "Tender_publishedAt_idx" ON "Tender"("publishedAt");
-- CreateIndex
CREATE UNIQUE INDEX IF NOT EXISTS "TenderSourcePollConfig_sourceType_key" ON "TenderSourcePollConfig"("sourceType");