From 7141ae1e1fb550bbbea322605806b9adc9cb3867 Mon Sep 17 00:00:00 2001 From: Marcel Date: Sun, 29 Mar 2026 19:53:30 +0200 Subject: [PATCH] feat(persons): add birthYear, deathYear, notes fields to /persons/new form Server action passes all 6 fields to POST /api/persons. Co-Authored-By: Claude Sonnet 4.6 --- .../src/routes/persons/new/+page.server.ts | 15 ++++++- frontend/src/routes/persons/new/+page.svelte | 43 +++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) diff --git a/frontend/src/routes/persons/new/+page.server.ts b/frontend/src/routes/persons/new/+page.server.ts index d4f78137..eae1424c 100644 --- a/frontend/src/routes/persons/new/+page.server.ts +++ b/frontend/src/routes/persons/new/+page.server.ts @@ -15,14 +15,27 @@ export const actions = { const firstName = formData.get('firstName')?.toString().trim(); const lastName = formData.get('lastName')?.toString().trim(); const alias = formData.get('alias')?.toString().trim() || undefined; + const birthYearStr = formData.get('birthYear')?.toString().trim(); + const deathYearStr = formData.get('deathYear')?.toString().trim(); + const notes = formData.get('notes')?.toString().trim() || undefined; if (!firstName || !lastName) { return fail(400, { error: 'Vor- und Nachname sind Pflichtfelder.' }); } + const birthYear = birthYearStr ? parseInt(birthYearStr, 10) : undefined; + const deathYear = deathYearStr ? parseInt(deathYearStr, 10) : undefined; + const api = createApiClient(fetch); const result = await api.POST('/api/persons', { - body: { firstName, lastName, ...(alias ? { alias } : {}) } + body: { + firstName, + lastName, + ...(alias ? { alias } : {}), + ...(birthYear ? { birthYear } : {}), + ...(deathYear ? { deathYear } : {}), + ...(notes ? { notes } : {}) + } }); if (!result.response.ok) { diff --git a/frontend/src/routes/persons/new/+page.svelte b/frontend/src/routes/persons/new/+page.svelte index df4380dd..733a17b2 100644 --- a/frontend/src/routes/persons/new/+page.svelte +++ b/frontend/src/routes/persons/new/+page.svelte @@ -77,6 +77,49 @@ let { form } = $props(); class="block w-full rounded border border-line p-2 text-sm shadow-sm focus:border-ink focus:ring-ink" /> + +
+ + +
+ +
+ + +
+ +
+ + +