Merge branch 'worktree-agent-ae59040b377a324cb'

# Conflicts:
#	GerbilManagerWebAPI/ApplicationContext.cs
#	GerbilManagerWebAPI/Program.cs
#	gerbil-manager-web/e2e/mock-data.ts
#	gerbil-manager-web/src/pages/GerbilDetailPage.tsx
#	gerbil-manager-web/src/strings/de.ts
This commit is contained in:
2026-06-22 23:10:18 +02:00
16 changed files with 2520 additions and 2 deletions

View File

@@ -742,6 +742,59 @@ export async function installMockApi(page: Page): Promise<MockDb> {
return json(route, 405)
}
// EXHIBITION: Ausstellungs-/Show-Ergebnisse je Tier (POST/GET ?gerbilId=, PUT, DELETE).
// Plain-Liste (kein Gridify), gefiltert per ?gerbilId, neueste zuerst.
if (path === '/exhibitions') {
if (method === 'GET') {
const gerbilId = url.searchParams.get('gerbilId')
const rows = (db.exhibitions as Row[]).filter(
(r) => !gerbilId || r.gerbilId === gerbilId,
)
const sorted = [...rows].sort((a, b) =>
String(b.date ?? '').localeCompare(String(a.date ?? '')),
)
return json(route, 200, sorted)
}
if (method === 'POST') {
const body = request.postDataJSON() as Row
if (!String(body.eventName ?? '').trim())
return json(route, 400, 'EventName darf nicht leer sein.')
const created = {
id: newId('exhibition'),
gerbilId: body.gerbilId ?? null,
entityName: body.entityName ?? null,
eventName: String(body.eventName).trim(),
date: body.date ?? null,
placement: body.placement ?? null,
award: body.award ?? null,
note: body.note ?? null,
createdAt: new Date().toISOString(),
}
;(db.exhibitions as Row[]).push(created)
return json(route, 201, created)
}
return json(route, 405)
}
const em = path.match(/^\/exhibitions\/([^/]+)$/)
if (em) {
const eid = decodeURIComponent(em[1])
const idx = (db.exhibitions as Row[]).findIndex((r) => r.id === eid)
if (idx < 0) return json(route, 404, { title: 'Not Found' })
if (method === 'GET') return json(route, 200, db.exhibitions[idx])
if (method === 'PUT') {
const body = request.postDataJSON() as Row
if ('eventName' in body && !String(body.eventName ?? '').trim())
return json(route, 400, 'EventName darf nicht leer sein.')
Object.assign(db.exhibitions[idx], body)
return json(route, 200, db.exhibitions[idx])
}
if (method === 'DELETE') {
;(db.exhibitions as Row[]).splice(idx, 1)
return json(route, 204)
}
return json(route, 405)
}
// Generische Kollektionen: /<resource> und /<resource>/<id>
m = path.match(/^\/([a-z-]+)(?:\/([^/]+))?$/)
const col = m ? collections[m[1]] : undefined