feat: Add file upload endpoint

This commit introduces a new API endpoint `/api/upload` for handling
audio file uploads. It supports multipart form data, extracts `case_id`,
`recorded_at`, and `audio` fields. The audio data is saved to a
filesystem path determined by the user and case ID, within either the
`open/` or `done/` directories.

New features include:
- Integration with `axum`'s `Multipart` extractor for parsing form data.
- Validation of `case_id` as a UUID.
- Creation of case directories if they do not exist.
- Handling of late uploads to already closed cases by placing files in
  the `done/` directory and removing any `.remove` marker.
- Logging of received recordings.
- Definition of `AckResponse` and `AckStatus` models for API responses.
- Addition of comprehensive unit tests for various upload scenarios,
  including new case creation, invalid inputs, authentication, and late
  uploads.
This commit is contained in:
2026-04-13 13:01:29 +02:00
parent 08c6e12a74
commit 1051e83da3
7 changed files with 505 additions and 2 deletions
+1
View File
@@ -1,6 +1,7 @@
pub mod auth;
pub mod config;
pub mod error;
pub mod models;
pub mod routes;
use std::sync::Arc;