Testversion im Browser und Sicherung einspielen

Die Testversion bündelt Oberfläche und Server-Logik mit PGlite (Postgres als
WebAssembly). POST /api/import/stand spielt einen kompletten Stand mit allen IDs
in ein leeres Programm ein; damit ziehen die Daten später auf den Server um.

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 04:18:42 +00:00
parent e406c5a842
commit 9bd88bb7ec
17 changed files with 510 additions and 8 deletions

View File

@@ -16,6 +16,7 @@ import { liquiditaet } from "../domain/liquiditaet.js";
import { liquiditaetsDaten } from "../domain/projektplan.js";
import { uebernimmV70 } from "../domain/v70.js";
import { speichereUebernahme } from "./v70import.js";
import { pruefeStand, speichereStand } from "./stand.js";
import { VERSION } from "./version.js";
export interface Optionen {
@@ -248,6 +249,18 @@ export async function baueApp(o: Optionen): Promise<FastifyInstance> {
return reply.status(201).send({ anzahl, hinweise: u.hinweise });
});
// D1: Sicherung aus GET /api/export in ein leeres Programm einspielen (Umzug aus der Testversion)
app.post("/api/import/stand", async (req, reply) => {
let s;
try {
s = pruefeStand(req.body);
} catch (err) {
return reply.status(400).send({ fehler: (err as Error).message });
}
const anzahl = await transaktion(pool, benutzer(req), (c) => speichereStand(c, s));
return reply.status(201).send({ anzahl });
});
// D1: kompletter Stand als JSON-Datei
app.get("/api/export", async (_req, reply) => {
const daten: Record<string, unknown[]> = {};