fix: opening balance direction, safe return paths, backup failure detection, review fixes

- opening balance: "person 2 owes person 1" was stored the wrong way round
- retour param: reject backslash/control chars (open redirect)
- backup: pipefail + check dump completeness, failed dumps no longer logged OK
- deleting a recurring occurrence marks it skipped so sync does not recreate it
- editing a charge regenerates future occurrences of incomes allocated to it
- settlements (incl. opening balance) listed in settings and deletable

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
YugonitoandClaude Opus 5.5 committed 2026-10-27 18:51:49 +01:00
1 parent a0bcea4eb1
commit 5b402691f0
15 files changed
+222 -15

No files matched your search

+2 -1
View File
@@ -7,6 +7,7 @@ import { fromIsoDate, todayParis, toIsoDate } from "@/lib/dates";
import { prisma } from "../db";
import { splitRows } from "../mappers";
import { syncRecurrings } from "../sync";
import { dropPlannedWithAllocations } from "./recurrings";
import type { Result } from "./operations";
const isoDate = z.string().regex(/^\d{4}-\d{2}-\d{2}$/, "Date invalide.");
@@ -137,7 +138,7 @@ export async function saveLoan(input: LoanFormInput, today: string = todayParis(
return { loanId, recurringId: rec.id };
});
await prisma.operation.deleteMany({ where: { recurringId, status: "PLANNED", date: { gte: fromIsoDate(today) } } });
await dropPlannedWithAllocations(recurringId, today);
await syncRecurrings(today);
return { ok: true, id: loanId };
}