Sortieren und Filtern wie in Excel in jeder Tabelle, Ansichten je Benutzer (0.13.0)
Some checks failed
Prüfung / tests (push) Has been cancelled
Prüfung / container (push) Has been cancelled

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmyPfuNc4sCRfaF3oURXZz
This commit is contained in:
Claude
2026-10-20 07:47:06 +00:00
parent d5f861318b
commit 6d0c5f238b
19 changed files with 966 additions and 157 deletions

View File

@@ -36,4 +36,18 @@ export function registriereIch(app: FastifyInstance, pool: Pool, einstellungen:
.map(({ start: _s, dauer: _d, ...v }) => v);
return { heute, bis, arbeitstage: woche.tage, einsaetze };
});
// Ansichten der Tabellen (Sortierung, Filter, ausgeblendete Zeilen, gespeicherte Ansichten), je Benutzer
app.get("/api/ich/ansichten", async (req) => {
const r = await pool.query("select tabelle, daten from ansicht where anmeldename = $1", [req.wer!.anmeldename]);
return Object.fromEntries(r.rows.map((z) => [z.tabelle, z.daten]));
});
app.put("/api/ich/ansichten/:tabelle", async (req, reply) => {
const { tabelle } = z.object({ tabelle: z.string().regex(/^[a-z0-9-]{1,40}$/) }).parse(req.params);
const daten = z.record(z.string(), z.unknown()).parse(req.body);
if (JSON.stringify(daten).length > 100_000) return reply.status(413).send({ fehler: "Die Ansicht ist zu groß." });
await pool.query(`insert into ansicht (anmeldename, tabelle, daten) values ($1, $2, $3)
on conflict (anmeldename, tabelle) do update set daten = excluded.daten, geaendert_am = now()`, [req.wer!.anmeldename, tabelle, daten]);
return reply.status(204).send();
});
}