From 1dddc387ba3830282bd46a53fcfe0e50fbde62a1 Mon Sep 17 00:00:00 2001 From: Nick Szaunig Date: Mon, 7 Sep 2026 12:20:18 +0200 Subject: [PATCH] fix: expose every backend-supported field in all edit forms Audit requested by the user after finding queens couldn't set hatchYear: many edit dialogs (and some create forms) were missing fields the backend DTOs already accept, so that data could never be entered or corrected anywhere in the UI. Fixes per entity: - Colony: status (WEAK/QUEENLESS/CONSPICUOUS) was never settable anywhere, so the COLONY_ATTENTION dashboard alert could never fire. Added as a dropdown restricted to the non-terminal statuses; DISSOLVED/SOLD/DECEASED/MERGED stay on their dedicated confirm actions, which also set deactivatedAt. - Apiary: description was missing from the edit form. - Inspection: 10 fields (weather, temperature, broodAmount, broodPattern, openBroodPresent, cappedBroodPresent, queenCellsPresent, swarmMood, gentleness, combBehavior, honeySuperStatus) existed in the schema/DTOs but nowhere in the UI - added to both the create and edit forms. - Varroa measurement: durationMinutes was on the create form but missing from edit. - Feeding: batchNumber missing from both create and edit. - Treatment: startDate, endDate, activeIngredient, batchNumber missing from both create and edit. - Task: assignedUserId had no UI anywhere; added to create/edit, degrading gracefully if the current user's role lacks users:read. - Extraction (honey-batch traceability variant): amount was missing, while the other edit dialog for the same entity already had it. - Bottling: productId missing from edit. - Harvest: grossWeight missing from edit; grossWeight and honeySuperCount missing from create. - Queen: breeder, matingType, matingStatus, inseminationData, motherLine, fatherLine added to the edit form (hatchYear/ markingColor/markingNumber were already fixed in a prior commit). Left alone deliberately: fields the backend DTO itself excludes via PickType (e.g. HoneyBatch's jarSize/jarCount/totalAmount, Bottling's quantities) since mutating those post-hoc would desync inventory deduction, and Colony's terminal statuses/code which have dedicated lifecycle actions. Co-Authored-By: Claude Sonnet 5 --- .../(app)/apiaries/[id]/apiary-edit-card.tsx | 10 ++ .../bottling/[id]/bottling-edit-dialog.tsx | 32 +++- .../(app)/colonies/[id]/colony-edit-card.tsx | 20 ++- .../colonies/[id]/feeding-edit-dialog.tsx | 10 ++ .../colonies/[id]/inspection-edit-dialog.tsx | 140 ++++++++++++++++++ .../colonies/[id]/treatment-edit-dialog.tsx | 42 ++++++ .../colonies/[id]/varroa-edit-dialog.tsx | 13 ++ .../src/app/(app)/feedings/new/page.tsx | 11 ++ .../harvests/[id]/harvest-edit-dialog.tsx | 11 ++ .../src/app/(app)/harvests/new/page.tsx | 26 ++++ .../[id]/extraction-edit-dialog.tsx | 11 ++ .../src/app/(app)/inspections/new/page.tsx | 132 +++++++++++++++++ .../app/(app)/queens/[id]/queen-edit-card.tsx | 60 ++++++++ .../src/app/(app)/tasks/new/page.tsx | 41 ++++- .../src/app/(app)/tasks/task-edit-dialog.tsx | 39 ++++- .../src/app/(app)/treatments/new/page.tsx | 46 ++++++ ApiCore-Frontend/src/lib/colonies/labels.ts | 12 ++ ApiCore-Frontend/src/lib/inspections/types.ts | 16 ++ ApiCore-Frontend/src/lib/queens/types.ts | 12 ++ ApiCore-Frontend/src/lib/tasks/types.ts | 2 + 20 files changed, 682 insertions(+), 4 deletions(-) diff --git a/ApiCore-Frontend/src/app/(app)/apiaries/[id]/apiary-edit-card.tsx b/ApiCore-Frontend/src/app/(app)/apiaries/[id]/apiary-edit-card.tsx index b137948..a3e8df4 100644 --- a/ApiCore-Frontend/src/app/(app)/apiaries/[id]/apiary-edit-card.tsx +++ b/ApiCore-Frontend/src/app/(app)/apiaries/[id]/apiary-edit-card.tsx @@ -22,6 +22,7 @@ import { export function ApiaryEditCard({ apiary }: { apiary: Apiary }) { const queryClient = useQueryClient(); const [name, setName] = useState(apiary.name); + const [description, setDescription] = useState(apiary.description ?? ""); const [location, setLocation] = useState(apiary.location ?? ""); const [latitude, setLatitude] = useState(apiary.latitude?.toString() ?? ""); const [longitude, setLongitude] = useState(apiary.longitude?.toString() ?? ""); @@ -32,6 +33,7 @@ export function ApiaryEditCard({ apiary }: { apiary: Apiary }) { mutationFn: () => updateApiary(apiary.id, { name, + description: description || undefined, location: location || undefined, latitude: latitude ? Number(latitude) : undefined, longitude: longitude ? Number(longitude) : undefined, @@ -95,6 +97,14 @@ export function ApiaryEditCard({ apiary }: { apiary: Apiary }) { onChange={(event) => setName(event.target.value)} /> +
+ +