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

+16 -1
View File
@@ -105,8 +105,18 @@ export async function saveOperation(raw: OperationInput, currentUserId: string):
return { ok: true, id };
}
/** Une occurrence de récurrent est marquée ignorée (sinon la synchro la recréerait) ; le reste est supprimé. */
export async function deleteOperation(id: string): Promise<Result> {
await prisma.operation.delete({ where: { id } });
const op = await prisma.operation.findUnique({ where: { id } });
if (!op) return { ok: true };
if (op.recurringId) {
await prisma.$transaction([
prisma.operation.updateMany({ where: { allocatedToOperationId: id }, data: { allocatedToOperationId: null } }),
prisma.operation.update({ where: { id }, data: { status: "SKIPPED" } }),
]);
} else {
await prisma.operation.delete({ where: { id } });
}
return { ok: true };
}
@@ -152,3 +162,8 @@ export async function saveSettlement(input: {
});
return { ok: true };
}
export async function deleteSettlement(id: string): Promise<Result> {
await prisma.settlement.deleteMany({ where: { id } });
return { ok: true };
}