/** * 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 /** Alle Ergebnisse eines Tieres (Backend sortiert neueste zuerst). */ export function listExhibitionResults(gerbilId: string): Promise { return api.get(`${RESOURCE}?gerbilId=${encodeURIComponent(gerbilId)}`) } /** Alle Ergebnisse (ungefiltert), für eine künftige Gesamtübersicht. */ export function listAllExhibitionResults(): Promise { return api.get(RESOURCE) } export function createExhibitionResult(body: CreateExhibitionResult): Promise { return api.post(RESOURCE, body) } export function updateExhibitionResult( id: string, body: UpdateExhibitionResult, ): Promise { return api.put(`${RESOURCE}/${id}`, body) } export function deleteExhibitionResult(id: string): Promise { return api.delete(`${RESOURCE}/${id}`) }