fix: resolve all 47 svelte-check errors and 10 a11y warnings

Root cause 1 — OpenAPI types: add @Schema(requiredMode=REQUIRED) to
non-nullable fields on Person, Tag, Document, AppUser, UserGroup;
regenerate api.ts so required fields are no longer optional.

Root cause 2 — Stale types: api.ts regenerated, picking up the Tag
endpoint fix from commit 62189d8 (List<Tag> instead of List<String>).

Root cause 3 — openapi-fetch error pattern: replace `if (apiError)`
(broken when error type is never/undefined) with `if (!result.response.ok)`
across all +page.server.ts files. Cast error via `unknown` to satisfy TS.

Root cause 4 — FormData casts: add `as string` / `as string[]` to
FormData.get() / FormData.getAll() calls in admin/+page.server.ts.

Standalone fixes:
- +page.server.ts: return error field so home page template compiles
- documents/[id]/+page.svelte: type loadFile param, remove invalid iframe `type`
- conversations: type documents as Document[] instead of unknown[]
- persons/[id]: non-null assert person data after ok-check

a11y: aria-label on all icon-only buttons in TagInput and admin page,
replace invalid <label> with <p> for compound controls, remove autofocus.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-03-16 12:08:25 +01:00
parent 5921a10d2e
commit 8a9e7bd9eb
17 changed files with 116 additions and 88 deletions

View File

@@ -6,16 +6,14 @@ export async function load({ params, fetch }) {
const { id } = params;
const api = createApiClient(fetch);
const { data, error: apiError, response } = await api.GET('/api/documents/{id}', {
params: { path: { id } }
});
const result = await api.GET('/api/documents/{id}', { params: { path: { id } } });
if (response.status === 401) throw redirect(302, '/login');
if (result.response.status === 401) throw redirect(302, '/login');
if (apiError) {
const code = (apiError as { code?: string })?.code;
throw error(response.status, getErrorMessage(code));
if (!result.response.ok) {
const code = (result.error as unknown as { code?: string })?.code;
throw error(result.response.status, getErrorMessage(code));
}
return { document: data };
return { document: result.data! };
}

View File

@@ -12,7 +12,7 @@
loadFile(doc.id);
}
async function loadFile(id) {
async function loadFile(id: string) {
isLoading = true;
error = '';
fileUrl = ''; // Reset previous URL
@@ -430,7 +430,6 @@
src={fileUrl}
title="Document Preview"
class="w-full h-full border-none bg-white"
type="application/pdf"
></iframe>
{:else if fileUrl}
<!-- Image with Blob URL -->

View File

@@ -12,16 +12,16 @@ export async function load({ params, fetch }) {
api.GET('/api/persons')
]);
if (docResult.error) {
const code = (docResult.error as { code?: string })?.code;
if (!docResult.response.ok) {
const code = (docResult.error as unknown as { code?: string })?.code;
throw error(docResult.response.status, getErrorMessage(code));
}
if (personsResult.error) {
if (!personsResult.response.ok) {
throw error(personsResult.response.status, getErrorMessage('INTERNAL_ERROR'));
}
return {
document: docResult.data,
document: docResult.data!,
persons: personsResult.data
};
}