feat: add POST /web/cases/purge-closed for bulk hard-delete

Iterates the user's data dir and removes every case directory that
carries a .closed marker. Requires form field confirm=yes as a server-
side guard against accidental browser-history re-POSTs. Emits CasePurged
per successfully removed case; per-case failures are logged but do not
abort the sweep.

UI button is deferred to the show-closed step so the endpoint is only
reachable after an explicit navigation. Three integration tests cover
the happy path, missing-confirm, and coexistence with open cases.
This commit is contained in:
2026-04-21 10:46:07 +02:00
parent 396565a571
commit 8173ff2f26
4 changed files with 173 additions and 1 deletions
+4
View File
@@ -54,6 +54,10 @@ pub fn api_router() -> Router<AppState> {
"/web/cases/{case_id}/reset",
post(case_actions::handle_reset_case),
)
.route(
"/web/cases/purge-closed",
post(case_actions::handle_purge_closed),
)
.route("/web/cases/bulk", post(bulk::handle_bulk_action))
.route(
"/web/audio/{user}/{case_id}/{filename}",