feat: Bearbeiten für alle Log-Einträge (Aufgaben, Durchsichten, Behandlungen, Fütterungen, Varroa-Messungen, Ernten, Schleuderungen, Abfüllungen)

Bisher liessen sich diese acht Objekttypen nur anlegen, nie nachträglich
korrigieren – Aufgaben hatten zwar schon einen PATCH-Endpunkt, aber
keine Bearbeiten-UI, die übrigen sieben hatten weder Backend- noch
Frontend-Unterstützung. Jetzt bekommt jeder Typ einen PATCH :id
Endpunkt (UpdateXDto per PartialType(PickType(...)) nach demselben
Muster wie UpdateColonyDto/UpdateApiaryDto, mit Audit-Log-Eintrag
inkl. Vorher-/Nachher-Stand) sowie eine Bearbeiten-UI:

- Aufgaben: Dialog auf der Aufgabenliste
- Durchsichten/Behandlungen/Fütterungen/Varroa-Messungen: Dialog pro
  Listeneintrag auf der Volk-Detailseite
- Ernten: Dialog auf der eigenen Ernte-Detailseite
- Schleuderungen: Dialog direkt in der Rückverfolgbarkeits-Karte der
  Honigcharge (keine eigene Detailseite nötig); Erntezeilen dort
  verlinken jetzt zur Ernte-Detailseite statt sie zu duplizieren
- Abfüllungen: Dialog auf der Abfüllungs-Detailseite, bewusst nur
  Datum/MHD/Losnummer editierbar – Glasgröße/-anzahl bleiben
  unveränderlich, weil sie bereits unumkehrbar die Honigcharge-Menge
  reduziert haben

Relationsstiftende Fremdschlüssel (colonyId, apiaryId/colonyIds,
harvestIds, honeyBatchId) bleiben überall bewusst nicht editierbar,
konsistent mit dem bestehenden apiaryId-Ausschluss bei UpdateColonyDto.
This commit is contained in:
Nick Szaunig committed 2026-08-25 04:28:37 +02:00
1 parent 63ab0e842d
commit 68f459001a
58 files changed
+1909 -60

No files matched your search

+16 -1
View File
@@ -1,5 +1,10 @@
import { apiFetch } from "@/lib/auth/api-client";
import { BottlingBatch, BottlingBatchFilter, CreateBottlingBatchInput } from "./types";
import {
BottlingBatch,
BottlingBatchFilter,
CreateBottlingBatchInput,
UpdateBottlingBatchInput,
} from "./types";
export function fetchBottlingBatches(
filter: BottlingBatchFilter = {},
@@ -22,3 +27,13 @@ export function createBottlingBatch(
body: JSON.stringify(input),
});
}
export function updateBottlingBatch(
id: string,
input: UpdateBottlingBatchInput,
): Promise<BottlingBatch> {
return apiFetch<BottlingBatch>(`/bottling-batches/${id}`, {
method: "PATCH",
body: JSON.stringify(input),
});
}
@@ -23,6 +23,13 @@ export interface CreateBottlingBatchInput {
lotNumber: string;
}
export interface UpdateBottlingBatchInput {
productId?: string;
date?: string;
bestBeforeDate?: string;
lotNumber?: string;
}
export interface BottlingBatchFilter {
honeyBatchId?: string;
}
+15 -1
View File
@@ -1,13 +1,27 @@
import { apiFetch } from "@/lib/auth/api-client";
import { CreateExtractionInput, Extraction } from "./types";
import { CreateExtractionInput, Extraction, UpdateExtractionInput } from "./types";
export function fetchExtractions(): Promise<Extraction[]> {
return apiFetch<Extraction[]>("/extractions");
}
export function fetchExtraction(id: string): Promise<Extraction> {
return apiFetch<Extraction>(`/extractions/${id}`);
}
export function createExtraction(input: CreateExtractionInput): Promise<Extraction> {
return apiFetch<Extraction>("/extractions", {
method: "POST",
body: JSON.stringify(input),
});
}
export function updateExtraction(
id: string,
input: UpdateExtractionInput,
): Promise<Extraction> {
return apiFetch<Extraction>(`/extractions/${id}`, {
method: "PATCH",
body: JSON.stringify(input),
});
}
@@ -33,3 +33,12 @@ export interface CreateExtractionInput {
temperature?: number;
notes?: string;
}
export interface UpdateExtractionInput {
date?: string;
amount?: number;
room?: string;
waterContent?: number;
temperature?: number;
notes?: string;
}
+16 -1
View File
@@ -1,5 +1,10 @@
import { apiFetch } from "@/lib/auth/api-client";
import { CreateFeedingInput, Feeding, FeedingSummaryEntry } from "./types";
import {
CreateFeedingInput,
Feeding,
FeedingSummaryEntry,
UpdateFeedingInput,
} from "./types";
export function fetchColonyFeedings(colonyId: string): Promise<Feeding[]> {
return apiFetch<Feeding[]>(`/colonies/${colonyId}/feedings`);
@@ -15,3 +20,13 @@ export function createFeeding(input: CreateFeedingInput): Promise<Feeding> {
body: JSON.stringify(input),
});
}
export function updateFeeding(
id: string,
input: UpdateFeedingInput,
): Promise<Feeding> {
return apiFetch<Feeding>(`/feedings/${id}`, {
method: "PATCH",
body: JSON.stringify(input),
});
}
@@ -29,3 +29,13 @@ export interface CreateFeedingInput {
batchNumber?: string;
notes?: string;
}
export interface UpdateFeedingInput {
date?: string;
feedType?: FeedType;
product?: string;
amount?: number;
unit?: string;
batchNumber?: string;
notes?: string;
}
+8 -1
View File
@@ -1,5 +1,5 @@
import { apiFetch } from "@/lib/auth/api-client";
import { CreateHarvestInput, Harvest } from "./types";
import { CreateHarvestInput, Harvest, UpdateHarvestInput } from "./types";
export function fetchHarvests(): Promise<Harvest[]> {
return apiFetch<Harvest[]>("/harvests");
@@ -15,3 +15,10 @@ export function createHarvest(input: CreateHarvestInput): Promise<Harvest> {
body: JSON.stringify(input),
});
}
export function updateHarvest(id: string, input: UpdateHarvestInput): Promise<Harvest> {
return apiFetch<Harvest>(`/harvests/${id}`, {
method: "PATCH",
body: JSON.stringify(input),
});
}
@@ -31,3 +31,12 @@ export interface CreateHarvestInput {
netWeight?: number;
notes?: string;
}
export interface UpdateHarvestInput {
date?: string;
honeyType?: string;
honeySuperCount?: number;
grossWeight?: number;
netWeight?: number;
notes?: string;
}
@@ -4,6 +4,7 @@ import {
CreateTaskFromInspectionInput,
Inspection,
InspectionTask,
UpdateInspectionInput,
} from "./types";
export function fetchColonyInspections(colonyId: string): Promise<Inspection[]> {
@@ -17,6 +18,16 @@ export function createInspection(input: CreateInspectionInput): Promise<Inspecti
});
}
export function updateInspection(
id: string,
input: UpdateInspectionInput,
): Promise<Inspection> {
return apiFetch<Inspection>(`/inspections/${id}`, {
method: "PATCH",
body: JSON.stringify(input),
});
}
export function createTaskFromInspection(
id: string,
input: CreateTaskFromInspectionInput,
@@ -41,6 +41,21 @@ export interface CreateInspectionInput {
notes?: string;
}
export interface UpdateInspectionInput {
date?: string;
weather?: string;
temperature?: number;
colonyStrength?: number;
queenSeen?: boolean;
eggsPresent?: boolean;
queenCellsPresent?: boolean;
feedStatus?: string;
healthIssues?: string;
varroaIssues?: string;
measures?: string;
notes?: string;
}
export interface CreateTaskFromInspectionInput {
title: string;
description?: string;
+11 -1
View File
@@ -1,5 +1,5 @@
import { apiFetch } from "@/lib/auth/api-client";
import { CreateTreatmentInput, Treatment } from "./types";
import { CreateTreatmentInput, Treatment, UpdateTreatmentInput } from "./types";
export function fetchColonyTreatments(colonyId: string): Promise<Treatment[]> {
return apiFetch<Treatment[]>(`/colonies/${colonyId}/treatments`);
@@ -11,3 +11,13 @@ export function createTreatment(input: CreateTreatmentInput): Promise<Treatment>
body: JSON.stringify(input),
});
}
export function updateTreatment(
id: string,
input: UpdateTreatmentInput,
): Promise<Treatment> {
return apiFetch<Treatment>(`/treatments/${id}`, {
method: "PATCH",
body: JSON.stringify(input),
});
}
@@ -28,3 +28,16 @@ export interface CreateTreatmentInput {
batchNumber?: string;
notes?: string;
}
export interface UpdateTreatmentInput {
date?: string;
startDate?: string;
endDate?: string;
product?: string;
activeIngredient?: string;
amount?: string;
method?: string;
reason?: string;
batchNumber?: string;
notes?: string;
}
+15 -1
View File
@@ -1,5 +1,9 @@
import { apiFetch } from "@/lib/auth/api-client";
import { CreateVarroaMeasurementInput, VarroaMeasurement } from "./types";
import {
CreateVarroaMeasurementInput,
UpdateVarroaMeasurementInput,
VarroaMeasurement,
} from "./types";
export function fetchColonyVarroaMeasurements(colonyId: string): Promise<VarroaMeasurement[]> {
return apiFetch<VarroaMeasurement[]>(`/colonies/${colonyId}/varroa-measurements`);
@@ -13,3 +17,13 @@ export function createVarroaMeasurement(
body: JSON.stringify(input),
});
}
export function updateVarroaMeasurement(
id: string,
input: UpdateVarroaMeasurementInput,
): Promise<VarroaMeasurement> {
return apiFetch<VarroaMeasurement>(`/varroa-measurements/${id}`, {
method: "PATCH",
body: JSON.stringify(input),
});
}
+10
View File
@@ -28,3 +28,13 @@ export interface CreateVarroaMeasurementInput {
assessment?: string;
notes?: string;
}
export interface UpdateVarroaMeasurementInput {
date?: string;
method?: VarroaMethod;
durationMinutes?: number;
miteCount?: number;
calculatedValue?: number;
assessment?: string;
notes?: string;
}