feat(frontend): Fütterungen-Modul (Modul 9)
Mobile-optimiertes Erfassungsformular unter /feedings/new sowie "Fütterung"-Ansicht mit Mengensumme auf der Volk-Detailseite.
This commit is contained in:
1 parent
cc0aaf0a31
commit
d71785d531
6 files changed
+307
-1
No files matched your search
@@ -0,0 +1,17 @@
|
||||
import { apiFetch } from "@/lib/auth/api-client";
|
||||
import { CreateFeedingInput, Feeding, FeedingSummaryEntry } from "./types";
|
||||
|
||||
export function fetchColonyFeedings(colonyId: string): Promise<Feeding[]> {
|
||||
return apiFetch<Feeding[]>(`/colonies/${colonyId}/feedings`);
|
||||
}
|
||||
|
||||
export function fetchColonyFeedingsSummary(colonyId: string): Promise<FeedingSummaryEntry[]> {
|
||||
return apiFetch<FeedingSummaryEntry[]>(`/colonies/${colonyId}/feedings/summary`);
|
||||
}
|
||||
|
||||
export function createFeeding(input: CreateFeedingInput): Promise<Feeding> {
|
||||
return apiFetch<Feeding>("/feedings", {
|
||||
method: "POST",
|
||||
body: JSON.stringify(input),
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
export type FeedType = "SUGAR_WATER" | "FEED_SYRUP" | "FEED_PASTE" | "OWN_HONEY" | "OTHER";
|
||||
|
||||
export interface Feeding {
|
||||
id: string;
|
||||
colonyId: string;
|
||||
userId: string;
|
||||
date: string;
|
||||
feedType: FeedType;
|
||||
product: string | null;
|
||||
amount: number;
|
||||
unit: string;
|
||||
batchNumber: string | null;
|
||||
notes: string | null;
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
export interface FeedingSummaryEntry {
|
||||
unit: string;
|
||||
totalAmount: number;
|
||||
}
|
||||
|
||||
export interface CreateFeedingInput {
|
||||
colonyId: string;
|
||||
date: string;
|
||||
feedType: FeedType;
|
||||
product?: string;
|
||||
amount: number;
|
||||
unit: string;
|
||||
batchNumber?: string;
|
||||
notes?: string;
|
||||
}
|
||||
Reference in new issue
Block a user