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

@@ -80,6 +80,7 @@
<button
type="button"
on:click={() => removeTag(i)}
aria-label="Schlagwort entfernen"
class="text-brand-navy/50 hover:text-red-500 focus:outline-none"
>
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24"
@@ -117,12 +118,15 @@
class="absolute left-0 top-full mt-1 w-full bg-white border border-gray-200 rounded shadow-lg z-50 max-h-48 overflow-y-auto"
>
{#each suggestions as suggestion, i}
<!-- svelte-ignore a11y-click-events-have-key-events -->
<li
role="option"
aria-selected={i === activeIndex}
tabindex="0"
class="px-3 py-2 text-sm cursor-pointer hover:bg-brand-sand/20 {i === activeIndex
? 'bg-brand-sand/20 text-brand-navy font-bold'
: 'text-gray-700'}"
on:click={() => addTag(suggestion)}
on:keydown={(e) => e.key === 'Enter' && addTag(suggestion)}
>
{suggestion}
</li>

View File

@@ -282,14 +282,14 @@ export interface components {
schemas: {
Tag: {
/** Format: uuid */
id?: string;
name?: string;
id: string;
name: string;
};
Person: {
/** Format: uuid */
id?: string;
firstName?: string;
lastName?: string;
id: string;
firstName: string;
lastName: string;
alias?: string;
};
DocumentUpdateDTO: {
@@ -307,13 +307,13 @@ export interface components {
};
Document: {
/** Format: uuid */
id?: string;
title?: string;
id: string;
title: string;
filePath?: string;
contentType?: string;
originalFilename?: string;
originalFilename: string;
/** @enum {string} */
status?: "PLACEHOLDER" | "UPLOADED" | "TRANSCRIBED" | "REVIEWED" | "ARCHIVED";
status: "PLACEHOLDER" | "UPLOADED" | "TRANSCRIBED" | "REVIEWED" | "ARCHIVED";
/** Format: date */
documentDate?: string;
location?: string;
@@ -323,9 +323,9 @@ export interface components {
transcription?: string;
summary?: string;
/** Format: date-time */
createdAt?: string;
createdAt: string;
/** Format: date-time */
updatedAt?: string;
updatedAt: string;
receivers?: components["schemas"]["Person"][];
sender?: components["schemas"]["Person"];
tags?: components["schemas"]["Tag"][];
@@ -338,20 +338,20 @@ export interface components {
};
AppUser: {
/** Format: uuid */
id?: string;
username?: string;
id: string;
username: string;
password?: string;
email?: string;
enabled?: boolean;
groups?: components["schemas"]["UserGroup"][];
enabled: boolean;
groups: components["schemas"]["UserGroup"][];
/** Format: date-time */
createdAt?: string;
createdAt: string;
};
UserGroup: {
/** Format: uuid */
id?: string;
name?: string;
permissions?: string[];
id: string;
name: string;
permissions: string[];
};
GroupDTO: {
name?: string;
@@ -738,7 +738,7 @@ export interface operations {
[name: string]: unknown;
};
content: {
"*/*": string[];
"*/*": components["schemas"]["Tag"][];
};
};
};