feat: Schwarmkontrolle-Protokoll

Neues SwarmControlCheck-Modul: strukturierte Weiselzellenkontrollen pro
Volk mit Zahl/Verdeckelungsstatus der Zellen, Schwarmstimmung, ergriffener
Maßnahme und optionalem naechsten Kontrolltermin.

Frontend: neue Karte auf der Volk-Detailseite, Erfassungsformular unter
/swarm-control/new sowie Quick-Add-Eintrag.
This commit is contained in:
Nick Szaunig committed 2026-08-25 09:12:50 +02:00
1 parent 4609a0f9ec
commit 1a7331b6b2
19 files changed
+1076

No files matched your search

@@ -0,0 +1,29 @@
import { apiFetch } from "@/lib/auth/api-client";
import {
CreateSwarmControlCheckInput,
SwarmControlCheck,
UpdateSwarmControlCheckInput,
} from "./types";
export function fetchColonySwarmControlChecks(colonyId: string): Promise<SwarmControlCheck[]> {
return apiFetch<SwarmControlCheck[]>(`/colonies/${colonyId}/swarm-control-checks`);
}
export function createSwarmControlCheck(
input: CreateSwarmControlCheckInput,
): Promise<SwarmControlCheck> {
return apiFetch<SwarmControlCheck>("/swarm-control-checks", {
method: "POST",
body: JSON.stringify(input),
});
}
export function updateSwarmControlCheck(
id: string,
input: UpdateSwarmControlCheckInput,
): Promise<SwarmControlCheck> {
return apiFetch<SwarmControlCheck>(`/swarm-control-checks/${id}`, {
method: "PATCH",
body: JSON.stringify(input),
});
}
@@ -0,0 +1,15 @@
import { SwarmControlAction, SwarmMood } from "./types";
export const SWARM_MOOD_LABELS: Record<SwarmMood, string> = {
NONE: "Keine",
LOW: "Gering",
HIGH: "Hoch",
};
export const SWARM_ACTION_LABELS: Record<SwarmControlAction, string> = {
NONE: "Keine",
QUEEN_CELLS_REMOVED: "Weiselzellen gebrochen",
ARTIFICIAL_SWARM: "Kunstschwarm gebildet",
COLONY_DIVIDED: "Volk geteilt",
OTHER: "Sonstiges",
};
@@ -0,0 +1,42 @@
export type SwarmMood = "NONE" | "LOW" | "HIGH";
export type SwarmControlAction =
| "NONE"
| "QUEEN_CELLS_REMOVED"
| "ARTIFICIAL_SWARM"
| "COLONY_DIVIDED"
| "OTHER";
export interface SwarmControlCheck {
id: string;
colonyId: string;
userId: string;
date: string;
queenCellsFound: number | null;
queenCellsCapped: boolean;
swarmMood: SwarmMood;
actionTaken: SwarmControlAction;
notes: string | null;
nextCheckDate: string | null;
createdAt: string;
}
export interface CreateSwarmControlCheckInput {
colonyId: string;
date: string;
queenCellsFound?: number;
queenCellsCapped?: boolean;
swarmMood?: SwarmMood;
actionTaken?: SwarmControlAction;
notes?: string;
nextCheckDate?: string;
}
export interface UpdateSwarmControlCheckInput {
date?: string;
queenCellsFound?: number;
queenCellsCapped?: boolean;
swarmMood?: SwarmMood;
actionTaken?: SwarmControlAction;
notes?: string;
nextCheckDate?: string;
}