diff --git a/frontend/src/lib/generated/api.ts b/frontend/src/lib/generated/api.ts index efe723b4..526e51aa 100644 --- a/frontend/src/lib/generated/api.ts +++ b/frontend/src/lib/generated/api.ts @@ -2016,7 +2016,6 @@ export interface components { /** @enum {string} */ status?: "DRAFT" | "PUBLISHED"; personIds?: string[]; - documentIds?: string[]; }; Geschichte: { /** Format: uuid */ @@ -2025,9 +2024,11 @@ export interface components { body?: string; /** @enum {string} */ status: "DRAFT" | "PUBLISHED"; + /** @enum {string} */ + type: "STORY" | "JOURNEY"; author?: components["schemas"]["AppUser"]; persons?: components["schemas"]["Person"][]; - documents?: components["schemas"]["Document"][]; + items?: components["schemas"]["JourneyItem"][]; /** Format: date-time */ createdAt: string; /** Format: date-time */ @@ -2035,6 +2036,32 @@ export interface components { /** Format: date-time */ publishedAt?: string; }; + JourneyItem: { + /** Format: uuid */ + id: string; + /** Format: int32 */ + position: number; + /** Format: uuid */ + documentId?: string; + note?: string; + }; + GeschichteSummary: { + /** Format: uuid */ + id: string; + title: string; + /** @enum {string} */ + status: "DRAFT" | "PUBLISHED"; + /** @enum {string} */ + type: "STORY" | "JOURNEY"; + author?: { + firstName?: string; + lastName?: string; + email: string; + }; + body?: string; + /** Format: date-time */ + publishedAt?: string; + }; CreateTranscriptionBlockDTO: { /** Format: int32 */ pageNumber?: number; @@ -3576,7 +3603,6 @@ export interface operations { query?: { status?: "DRAFT" | "PUBLISHED"; personId?: string[]; - documentId?: string; limit?: number; }; header?: never; @@ -3591,7 +3617,7 @@ export interface operations { [name: string]: unknown; }; content: { - "*/*": components["schemas"]["Geschichte"][]; + "*/*": components["schemas"]["GeschichteSummary"][]; }; }; }; diff --git a/frontend/src/lib/geschichte/GeschichteEditor.svelte b/frontend/src/lib/geschichte/GeschichteEditor.svelte index 1df78c03..1448b73c 100644 --- a/frontend/src/lib/geschichte/GeschichteEditor.svelte +++ b/frontend/src/lib/geschichte/GeschichteEditor.svelte @@ -6,33 +6,23 @@ import StarterKit from '@tiptap/starter-kit'; import { m } from '$lib/paraglide/messages.js'; import type { components } from '$lib/generated/api'; import PersonMultiSelect from '$lib/person/PersonMultiSelect.svelte'; -import DocumentMultiSelect from '$lib/document/DocumentMultiSelect.svelte'; type Geschichte = components['schemas']['Geschichte']; type Person = components['schemas']['Person']; -type Document = components['schemas']['Document']; interface Props { geschichte?: Geschichte | null; initialPersons?: Person[]; - initialDocuments?: Document[]; onSubmit: (payload: { title: string; body: string; status: 'DRAFT' | 'PUBLISHED'; personIds: string[]; - documentIds: string[]; }) => Promise; submitting?: boolean; } -let { - geschichte = null, - initialPersons = [], - initialDocuments = [], - onSubmit, - submitting = false -}: Props = $props(); +let { geschichte = null, initialPersons = [], onSubmit, submitting = false }: Props = $props(); // Initial-state snapshot from incoming props. The editor owns these values // after mount; the parent should re-mount the component with a different @@ -44,9 +34,6 @@ let status: 'DRAFT' | 'PUBLISHED' = $state(geschichte?.status ?? 'DRAFT'); let selectedPersons: Person[] = $state( geschichte?.persons ? Array.from(geschichte.persons) : initialPersons ); -let selectedDocuments: Document[] = $state( - geschichte?.documents ? Array.from(geschichte.documents) : initialDocuments -); let dirty = $state(false); let titleTouched = $state(false); @@ -122,8 +109,7 @@ async function save(nextStatus: 'DRAFT' | 'PUBLISHED') { title: title.trim(), body, status: nextStatus, - personIds: selectedPersons.map((p) => p.id!).filter(Boolean), - documentIds: selectedDocuments.map((d) => d.id!).filter(Boolean) + personIds: selectedPersons.map((p) => p.id!).filter(Boolean) }); dirty = false; } @@ -269,14 +255,6 @@ function exec(action: () => void) {

{m.geschichte_editor_personen_hint()}

- -
-

- {m.geschichte_editor_dokumente_heading()} -

-

{m.geschichte_editor_dokumente_hint()}

- -
diff --git a/frontend/src/routes/geschichten/+page.server.ts b/frontend/src/routes/geschichten/+page.server.ts index 6d802e8e..ce2b33d8 100644 --- a/frontend/src/routes/geschichten/+page.server.ts +++ b/frontend/src/routes/geschichten/+page.server.ts @@ -9,15 +9,13 @@ type Person = components['schemas']['Person']; export const load: PageServerLoad = async ({ url, fetch }) => { const api = createApiClient(fetch); const personIds = url.searchParams.getAll('personId'); - const documentId = url.searchParams.get('documentId') ?? undefined; const [listResult, ...personResults] = await Promise.all([ api.GET('/api/geschichten', { params: { query: { status: 'PUBLISHED', - personId: personIds.length ? personIds : undefined, - documentId + personId: personIds.length ? personIds : undefined } } }), @@ -34,7 +32,6 @@ export const load: PageServerLoad = async ({ url, fetch }) => { return { geschichten: listResult.data ?? [], - personFilters, - documentFilter: documentId ?? null + personFilters }; }; diff --git a/frontend/src/routes/geschichten/+page.svelte b/frontend/src/routes/geschichten/+page.svelte index 7ced4ade..3149d9e2 100644 --- a/frontend/src/routes/geschichten/+page.svelte +++ b/frontend/src/routes/geschichten/+page.svelte @@ -11,12 +11,11 @@ let { data }: { data: PageData } = $props(); let showPersonPicker = $state(false); const selectedPersonIds = $derived(data.personFilters.map((p) => p.id!)); -const hasFilters = $derived(data.personFilters.length > 0 || !!data.documentFilter); +const hasFilters = $derived(data.personFilters.length > 0); function rebuildUrl(personIds: string[]) { const url = new URL(window.location.href); url.searchParams.delete('personId'); - url.searchParams.delete('documentId'); for (const id of personIds) url.searchParams.append('personId', id); return url.pathname + url.search; } diff --git a/frontend/src/routes/geschichten/[id]/+page.svelte b/frontend/src/routes/geschichten/[id]/+page.svelte index 6a48ec91..d3028fae 100644 --- a/frontend/src/routes/geschichten/[id]/+page.svelte +++ b/frontend/src/routes/geschichten/[id]/+page.svelte @@ -96,25 +96,20 @@ async function handleDelete() { {/if} - - {#if g.documents && g.documents.length > 0} + + {#if g.items && g.items.some((i) => i.documentId)}

{m.geschichten_documents_section()}

    - {#each g.documents as d (d.id)} + {#each g.items.filter((i) => i.documentId) as item (item.id)}
  • - {d.title} - {#if d.documentDate} - - {formatDate(d.documentDate, 'short')} - - {/if} + {item.note ?? item.documentId}
  • {/each} diff --git a/frontend/src/routes/geschichten/[id]/edit/+page.svelte b/frontend/src/routes/geschichten/[id]/edit/+page.svelte index b35f5a35..dede091b 100644 --- a/frontend/src/routes/geschichten/[id]/edit/+page.svelte +++ b/frontend/src/routes/geschichten/[id]/edit/+page.svelte @@ -17,7 +17,6 @@ async function handleSubmit(payload: { body: string; status: 'DRAFT' | 'PUBLISHED'; personIds: string[]; - documentIds: string[]; }) { submitting = true; errorMessage = null; diff --git a/frontend/src/routes/geschichten/new/+page.server.ts b/frontend/src/routes/geschichten/new/+page.server.ts index 3983d924..4763555d 100644 --- a/frontend/src/routes/geschichten/new/+page.server.ts +++ b/frontend/src/routes/geschichten/new/+page.server.ts @@ -10,24 +10,14 @@ export const load: PageServerLoad = async ({ url, fetch, parent }) => { const api = createApiClient(fetch); const personId = url.searchParams.get('personId'); - const documentId = url.searchParams.get('documentId'); - const [personResult, documentResult] = await Promise.all([ - personId - ? api.GET('/api/persons/{id}', { params: { path: { id: personId } } }) - : Promise.resolve(null), - documentId - ? api.GET('/api/documents/{id}', { params: { path: { id: documentId } } }) - : Promise.resolve(null) - ]); + const personResult = personId + ? await api.GET('/api/persons/{id}', { params: { path: { id: personId } } }) + : null; // Silently ignore 404/403 to avoid leaking entity existence on unknown IDs. const initialPersons = personResult && personResult.response.ok && personResult.data ? [personResult.data] : []; - const initialDocuments = - documentResult && documentResult.response.ok && documentResult.data - ? [documentResult.data] - : []; - return { initialPersons, initialDocuments }; + return { initialPersons }; }; diff --git a/frontend/src/routes/geschichten/new/+page.svelte b/frontend/src/routes/geschichten/new/+page.svelte index 70ec081e..ad80d87b 100644 --- a/frontend/src/routes/geschichten/new/+page.svelte +++ b/frontend/src/routes/geschichten/new/+page.svelte @@ -17,7 +17,6 @@ async function handleSubmit(payload: { body: string; status: 'DRAFT' | 'PUBLISHED'; personIds: string[]; - documentIds: string[]; }) { submitting = true; errorMessage = null; @@ -58,7 +57,6 @@ async function handleSubmit(payload: {