feat(frontend): update generated API types and Geschichte routes for JourneyItem model
- api.ts: add GeschichteType, JourneyItem, GeschichteSummary schemas; remove documentId param from list endpoint; change list response to GeschichteSummary[]; add type + items to Geschichte; remove documents field - GeschichteEditor: remove DocumentMultiSelect + documentIds from payload (journey items are managed via the future Lesereisen editor, not here) - GET /geschichten page: remove documentId filter from server load + URL logic - geschichten/new: remove documentId pre-population from server load - geschichten/[id]: replace g.documents with g.items (document-backed JourneyItems) - geschichten/new + [id]/edit: remove documentIds from submit payload type Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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 };
|
||||
};
|
||||
|
||||
@@ -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: {
|
||||
|
||||
<GeschichteEditor
|
||||
initialPersons={data.initialPersons}
|
||||
initialDocuments={data.initialDocuments}
|
||||
onSubmit={handleSubmit}
|
||||
submitting={submitting}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user