feat: Add case closing and document viewing routes

Adds API endpoints for closing a case, which triggers an analysis job,
and for viewing the generated document.

This also includes:
- New `AppError` variants: `Conflict` and `ServiceUnavailable`.
- Helper functions for file handling, date parsing, and document
  searching.
- Unit tests for helper functions.
This commit is contained in:
2026-04-15 19:22:25 +02:00
parent aa6b8fd798
commit aed4cd59d3
4 changed files with 312 additions and 2 deletions
+7
View File
@@ -6,6 +6,11 @@ pub enum AppError {
Unauthorized,
BadRequest(String),
NotFound(String),
/// 409 — request is valid but conflicts with current state (e.g. an
/// analysis is already running for this case).
Conflict(String),
/// 503 — the feature is unavailable right now (e.g. no LLM configured).
ServiceUnavailable(String),
Internal(String),
/// 302 redirect. Used by web auth to send unauthenticated users to login.
Redirect(String),
@@ -25,6 +30,8 @@ impl IntoResponse for AppError {
Self::Unauthorized => (StatusCode::UNAUTHORIZED, "Unauthorized".to_owned()),
Self::BadRequest(msg) => (StatusCode::BAD_REQUEST, msg.clone()),
Self::NotFound(msg) => (StatusCode::NOT_FOUND, msg.clone()),
Self::Conflict(msg) => (StatusCode::CONFLICT, msg.clone()),
Self::ServiceUnavailable(msg) => (StatusCode::SERVICE_UNAVAILABLE, msg.clone()),
Self::Internal(msg) => (StatusCode::INTERNAL_SERVER_ERROR, msg.clone()),
Self::Redirect(_) => unreachable!(),
};