Werkstatt-App: öffentliche PWA und Redaktions-Backend

Werbefreie, barrierearme Info-App für Werkstätten (WfbM) auf Basis von
SvelteKit, Tailwind, SQLite/Drizzle:

- App: Startseite mit Kacheln, Meldungen, Seitenbaum, Termine inkl.
  Schließzeiten und iCal-Abo, Ansprechpartner, Suche, Kontaktformular,
  Merkliste, Vorlesen, Leichte Sprache, Schriftgrößen, Hell/Dunkel, PWA
- Redaktion: Dashboard, Meldungen, Seiten, Termine, Kacheln,
  Ansprechpartner, Mediathek mit Bildoptimierung, Postfach, Benutzer
  mit Rollen, Einstellungen (Name, Logo, Farbe, Rechtstexte)
- Demo-Seed, CLI zum Anlegen von Benutzern, Dockerfile und Compose

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Friederich Loheide 2026-09-29 20:55:13 +00:00
parent 4f145116d8
commit bef8574e07
143 changed files with 13518 additions and 1 deletions

View file

@ -0,0 +1,40 @@
import { json, error } from '@sveltejs/kit';
import { desc, like, not, and, or } from 'drizzle-orm';
import { db } from '$lib/server/db';
import { media } from '$lib/server/db/schema';
import { toMediaItem } from '$lib/server/content';
import { storeUpload, UploadError } from '$lib/server/uploads';
/** Mediathek für die Auswahl-Dialoge im Admin */
export const GET = ({ url }) => {
const type = url.searchParams.get('type');
const q = url.searchParams.get('q')?.trim();
const conditions = [];
if (type === 'image') conditions.push(like(media.mimeType, 'image/%'));
if (type === 'document') conditions.push(not(like(media.mimeType, 'image/%')));
if (q) conditions.push(or(like(media.originalName, `%${q}%`), like(media.alt, `%${q}%`)));
const rows = db
.select()
.from(media)
.where(conditions.length ? and(...conditions) : undefined)
.orderBy(desc(media.id))
.limit(200)
.all();
return json(rows.map(toMediaItem));
};
export const POST = async ({ request }) => {
const form = await request.formData();
const files = form.getAll('files').filter((f): f is File => f instanceof File && f.size > 0);
if (!files.length) error(400, 'Keine Datei ausgewählt.');
const items = [];
for (const file of files) {
try {
items.push(toMediaItem(await storeUpload(file)));
} catch (e) {
if (e instanceof UploadError) error(400, e.message);
throw e;
}
}
return json(items);
};