feat(ausstellungen): Ausstellungs-/Auszeichnungsergebnisse je Tier

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-22 22:43:19 +02:00
parent 5e14124322
commit d380a0c2ef
16 changed files with 2520 additions and 2 deletions

View File

@@ -0,0 +1,61 @@
/**
* EXHIBITION: typed API client for show/exhibition results & awards per animal
* (RennmausPro `ausz_tb`). Backend: GET /exhibitions[?gerbilId=], POST, PUT, DELETE.
* Decoupled from gerbils (loose nullable gerbilId, no FK) — rows survive the import wipe.
*/
import { api } from './client'
import type { DateOnlyString } from './types'
const RESOURCE = '/exhibitions'
export interface ExhibitionResult {
id: string
gerbilId: string | null
entityName: string | null
eventName: string
/** ISO date-time string (backend DateTime?), or null. */
date: DateOnlyString | string | null
placement: string | null
award: string | null
note: string | null
createdAt: string
}
/** Payload for POST /exhibitions. */
export interface CreateExhibitionResult {
gerbilId?: string | null
entityName?: string | null
eventName: string
date?: string | null
placement?: string | null
award?: string | null
note?: string | null
}
/** Payload for PUT /exhibitions/{id} (partial). */
export type UpdateExhibitionResult = Partial<CreateExhibitionResult>
/** Alle Ergebnisse eines Tieres (Backend sortiert neueste zuerst). */
export function listExhibitionResults(gerbilId: string): Promise<ExhibitionResult[]> {
return api.get<ExhibitionResult[]>(`${RESOURCE}?gerbilId=${encodeURIComponent(gerbilId)}`)
}
/** Alle Ergebnisse (ungefiltert), für eine künftige Gesamtübersicht. */
export function listAllExhibitionResults(): Promise<ExhibitionResult[]> {
return api.get<ExhibitionResult[]>(RESOURCE)
}
export function createExhibitionResult(body: CreateExhibitionResult): Promise<ExhibitionResult> {
return api.post<ExhibitionResult>(RESOURCE, body)
}
export function updateExhibitionResult(
id: string,
body: UpdateExhibitionResult,
): Promise<ExhibitionResult> {
return api.put<ExhibitionResult>(`${RESOURCE}/${id}`, body)
}
export function deleteExhibitionResult(id: string): Promise<void> {
return api.delete(`${RESOURCE}/${id}`)
}