Files
familienarchiv/frontend/src/routes/enrich/+page.server.ts
Marcel 27e3d290e7 feat(bulk-edit): add canWrite-gated row checkboxes on /documents and /enrich
Each row in the document search list and the enrichment queue gets a
WCAG-compliant (44px touch target) checkbox bound to bulkSelectionStore.
Checkbox click does not trigger the row's stretched-link navigation —
it sits inside the z-10 content sibling, the link is in the z-0 sibling,
so click events do not bubble between them.

Refs #225

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-25 15:03:59 +02:00

24 lines
579 B
TypeScript

import { redirect } from '@sveltejs/kit';
import { createApiClient } from '$lib/api.server';
export async function load({
fetch,
locals
}: {
fetch: typeof globalThis.fetch;
locals: App.Locals;
}) {
const canWrite =
locals.user?.groups?.some((g: { permissions: string[] }) =>
g.permissions.includes('WRITE_ALL')
) ?? false;
if (!canWrite) throw redirect(303, '/');
const api = createApiClient(fetch);
const result = await api.GET('/api/documents/incomplete');
const documents = result.response.ok ? (result.data ?? []) : [];
return { documents, canWrite };
}