Haken „zählt“: Posten dauerhaft aus der Liquidität nehmen (0.41.0)
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:
@@ -429,7 +429,8 @@ export async function baueApp(o: Optionen): Promise<FastifyInstance> {
|
||||
zahlungen: zahlungen.rows,
|
||||
kosten: kosten.rows,
|
||||
laufend: laufend.rows.map((l) => ({
|
||||
bezeichnung: l.bezeichnung, kategorie: l.kategorie, betrag: l.betrag, rhythmus: l.rhythmus, start: l.start, ende: l.ende ?? undefined,
|
||||
id: l.id, bezeichnung: l.bezeichnung, kategorie: l.kategorie, betrag: l.betrag, rhythmus: l.rhythmus, start: l.start, ende: l.ende ?? undefined,
|
||||
ohneTermine: l.ohne_termine ?? [],
|
||||
})),
|
||||
},
|
||||
{ tage: e.arbeitstage },
|
||||
@@ -450,6 +451,32 @@ export async function baueApp(o: Optionen): Promise<FastifyInstance> {
|
||||
|
||||
app.get("/api/liquiditaet", async (req) => berechneLiquiditaet(LiquiAnfrage.parse(req.query)));
|
||||
|
||||
// Haken „zählt“ (Henning, 26.10.2026): Posten bleibt sichtbar, zählt aber in der Liquidität nicht mehr mit; dauerhaft gespeichert
|
||||
const ZaehltAnfrage = z.array(z.object({
|
||||
quelle: z.string().regex(/^(zahlung:[0-9a-f-]{36}|kosten:[0-9a-f-]{36}|pauschale:[0-9a-f-]{36}:(material|fremd|sonstiges)|rest:[0-9a-f-]{36}|lk:[0-9a-f-]{36}:\d{4}-\d{2}-\d{2})$/),
|
||||
zaehlt: z.boolean(),
|
||||
})).min(1).max(500);
|
||||
app.post("/api/liquiditaet/zaehlt", async (req) => {
|
||||
const liste = ZaehltAnfrage.parse(req.body);
|
||||
await transaktion(pool, benutzer(req), async (c) => {
|
||||
for (const { quelle, zaehlt } of liste) {
|
||||
const [art, id, teil] = quelle.split(":") as [string, string, string | undefined];
|
||||
if (art === "zahlung" || art === "kosten") {
|
||||
await c.query(`update ${art} set zaehlt = $2 where id = $1 and zaehlt <> $2`, [id, zaehlt]);
|
||||
} else if (art === "pauschale" || art === "rest") {
|
||||
const was = art === "rest" ? "rest" : teil!;
|
||||
await c.query(zaehlt ? "update projekt set liqui_ohne = array_remove(liqui_ohne, $2) where id = $1 and $2 = any(liqui_ohne)"
|
||||
: "update projekt set liqui_ohne = array_append(liqui_ohne, $2) where id = $1 and not ($2 = any(liqui_ohne))", [id, was]);
|
||||
} else {
|
||||
const datum = quelle.slice(quelle.lastIndexOf(":") + 1);
|
||||
await c.query(zaehlt ? "update laufende_kosten set ohne_termine = array_remove(ohne_termine, $2) where id = $1 and $2 = any(ohne_termine)"
|
||||
: "update laufende_kosten set ohne_termine = array_append(ohne_termine, $2) where id = $1 and not ($2 = any(ohne_termine))", [id, datum]);
|
||||
}
|
||||
}
|
||||
});
|
||||
return { ok: true };
|
||||
});
|
||||
|
||||
// Lage der Liquidität (Henning, 21.10.2026): je Woche ab heute, frei verfügbar, Tiefpunkt und Grund
|
||||
async function liquiLage(heute: string, anzahl: number) {
|
||||
const e = await ladeEinstellungen();
|
||||
|
||||
Reference in New Issue
Block a user