feat(frontend): Ernten- und Schleuderungs-Ansichten (Modul 10)
/harvests/new (Bienenstand + Mehrfachauswahl Völker), /harvests/[id] und /extractions/new (Mehrfachauswahl Ernten). Bienenstand- und Ernte-Detailseiten verlinken direkt in die Kette.
This commit is contained in:
1 parent
340397b34d
commit
5c2c0608d1
9 files changed
+526
-2
No files matched your search
@@ -0,0 +1,13 @@
|
||||
import { apiFetch } from "@/lib/auth/api-client";
|
||||
import { CreateExtractionInput, Extraction } from "./types";
|
||||
|
||||
export function fetchExtractions(): Promise<Extraction[]> {
|
||||
return apiFetch<Extraction[]>("/extractions");
|
||||
}
|
||||
|
||||
export function createExtraction(input: CreateExtractionInput): Promise<Extraction> {
|
||||
return apiFetch<Extraction>("/extractions", {
|
||||
method: "POST",
|
||||
body: JSON.stringify(input),
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
export interface ExtractionHarvestEntry {
|
||||
id: string;
|
||||
harvestId: string;
|
||||
harvest: {
|
||||
id: string;
|
||||
date: string;
|
||||
colonies: {
|
||||
colonyId: string;
|
||||
colony: { id: string; code: string };
|
||||
}[];
|
||||
};
|
||||
}
|
||||
|
||||
export interface Extraction {
|
||||
id: string;
|
||||
date: string;
|
||||
userId: string;
|
||||
amount: number | null;
|
||||
room: string | null;
|
||||
waterContent: number | null;
|
||||
temperature: number | null;
|
||||
notes: string | null;
|
||||
createdAt: string;
|
||||
harvests: ExtractionHarvestEntry[];
|
||||
}
|
||||
|
||||
export interface CreateExtractionInput {
|
||||
date: string;
|
||||
harvestIds: string[];
|
||||
amount?: number;
|
||||
room?: string;
|
||||
waterContent?: number;
|
||||
temperature?: number;
|
||||
notes?: string;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import { apiFetch } from "@/lib/auth/api-client";
|
||||
import { CreateHarvestInput, Harvest } from "./types";
|
||||
|
||||
export function fetchHarvests(): Promise<Harvest[]> {
|
||||
return apiFetch<Harvest[]>("/harvests");
|
||||
}
|
||||
|
||||
export function fetchHarvest(id: string): Promise<Harvest> {
|
||||
return apiFetch<Harvest>(`/harvests/${id}`);
|
||||
}
|
||||
|
||||
export function createHarvest(input: CreateHarvestInput): Promise<Harvest> {
|
||||
return apiFetch<Harvest>("/harvests", {
|
||||
method: "POST",
|
||||
body: JSON.stringify(input),
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
export interface HarvestColonyEntry {
|
||||
id: string;
|
||||
colonyId: string;
|
||||
colony: {
|
||||
id: string;
|
||||
code: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface Harvest {
|
||||
id: string;
|
||||
apiaryId: string;
|
||||
userId: string;
|
||||
date: string;
|
||||
honeyType: string | null;
|
||||
honeySuperCount: number | null;
|
||||
grossWeight: number | null;
|
||||
netWeight: number | null;
|
||||
notes: string | null;
|
||||
createdAt: string;
|
||||
colonies: HarvestColonyEntry[];
|
||||
}
|
||||
|
||||
export interface CreateHarvestInput {
|
||||
apiaryId: string;
|
||||
date: string;
|
||||
colonyIds: string[];
|
||||
honeyType?: string;
|
||||
honeySuperCount?: number;
|
||||
grossWeight?: number;
|
||||
netWeight?: number;
|
||||
notes?: string;
|
||||
}
|
||||
Reference in new issue
Block a user