feat(backend): Koeniginnenbewertung (Modul 31)

QueenEvaluation-Modell (Volksstaerke, Sanftmut, Wabensitz, Schwarm-
trieb, Brutbild, Honigertrag je Skala 1-5) als Sub-Ressource der
Queens-API: GET/POST /queens/:id/evaluations. Vorgezogen vor Modul
27 (Statistik), da dessen Koeniginnen-Auswertungen auf diesen Daten
aufbauen.
This commit is contained in:
Nick Szaunig committed 2026-08-22 22:55:36 +02:00
1 parent 0fc13952fb
commit 50268fa591
8 files changed
+245 -1

No files matched your search

@@ -0,0 +1,33 @@
-- CreateTable
CREATE TABLE "QueenEvaluation" (
"id" TEXT NOT NULL,
"queenId" TEXT NOT NULL,
"colonyId" TEXT,
"date" TIMESTAMP(3) NOT NULL,
"colonyStrength" INTEGER NOT NULL,
"gentleness" INTEGER NOT NULL,
"combBuild" INTEGER NOT NULL,
"swarmingTendency" INTEGER NOT NULL,
"broodPattern" INTEGER NOT NULL,
"honeyYield" INTEGER NOT NULL,
"notes" TEXT,
"userId" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "QueenEvaluation_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE INDEX "QueenEvaluation_queenId_idx" ON "QueenEvaluation"("queenId");
-- CreateIndex
CREATE INDEX "QueenEvaluation_colonyId_idx" ON "QueenEvaluation"("colonyId");
-- AddForeignKey
ALTER TABLE "QueenEvaluation" ADD CONSTRAINT "QueenEvaluation_queenId_fkey" FOREIGN KEY ("queenId") REFERENCES "Queen"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "QueenEvaluation" ADD CONSTRAINT "QueenEvaluation_colonyId_fkey" FOREIGN KEY ("colonyId") REFERENCES "Colony"("id") ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "QueenEvaluation" ADD CONSTRAINT "QueenEvaluation_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
+29
View File
@@ -51,6 +51,7 @@ model User {
auditLogs AuditLog[]
bottlingBatches BottlingBatch[]
notifications Notification[]
queenEvaluations QueenEvaluation[]
@@index([role])
}
@@ -172,6 +173,7 @@ model Colony {
treatments Treatment[]
feedings Feeding[]
harvests HarvestColony[]
queenEvaluations QueenEvaluation[]
@@index([apiaryId])
@@index([status])
@@ -252,10 +254,37 @@ model Queen {
colony Colony? @relation("ColonyCurrentQueen")
colonyHistory QueenColonyHistory[]
evaluations QueenEvaluation[]
@@index([status])
}
// ---------------------------------------------------------------------------
// Königinnenbewertung (Abschnitt 4.7) – v1.x Modul 31
// ---------------------------------------------------------------------------
model QueenEvaluation {
id String @id @default(cuid())
queenId String
queen Queen @relation(fields: [queenId], references: [id])
colonyId String?
colony Colony? @relation(fields: [colonyId], references: [id])
date DateTime
colonyStrength Int
gentleness Int
combBuild Int
swarmingTendency Int
broodPattern Int
honeyYield Int
notes String?
userId String?
user User? @relation(fields: [userId], references: [id])
createdAt DateTime @default(now())
@@index([queenId])
@@index([colonyId])
}
// Königinnenwechsel historisch nachvollziehbar (Abschnitt 4.5)
model QueenColonyHistory {
id String @id @default(cuid())