Refactor: Simplify case directory structure
The distinction between `open/` and `done/` directories for cases has been removed. All cases for a user now reside directly under the user's directory (e.g., `<data_path>/<slug>/<case_id>/`). This simplifies path management and eliminates redundant directory traversals. Key changes include: - Removed `open/` and `done/` subdirectories in path resolution. - Introduced a `paths::case_dir` function as a single source of truth for case directory layout. - Updated various modules (`recovery`, `auth`, `routes`, `transcribe`, `tests`) to use the new path structure. - Adjusted templates to reflect the simplified case status representation.
This commit is contained in:
@@ -4,7 +4,7 @@ use tracing::{info, warn};
|
||||
|
||||
use super::{TranscribeJob, TranscribeSender};
|
||||
|
||||
/// Walk `data_path/*/open/*/*.m4a` and enqueue every recording that does not
|
||||
/// Walk `data_path/*/*/*.m4a` and enqueue every recording that does not
|
||||
/// yet have a `.transcript.txt` sibling.
|
||||
///
|
||||
/// Intended to run once at startup (spawn as a task — sends may back-pressure
|
||||
@@ -29,7 +29,7 @@ pub async fn scan_and_enqueue(data_path: &Path, tx: &TranscribeSender) {
|
||||
}
|
||||
}
|
||||
|
||||
/// Walks `$data_path/<slug>/open/<case>/*.m4a` and returns `(slug, audio_path)`
|
||||
/// Walks `$data_path/<slug>/<case>/*.m4a` and returns `(slug, audio_path)`
|
||||
/// tuples for every recording without a `.transcript.txt` sibling. The slug
|
||||
/// comes from the top-level user directory name — that's the only ownership
|
||||
/// signal after a restart (auth context is gone).
|
||||
@@ -45,8 +45,7 @@ async fn collect_pending(data_path: &Path) -> Vec<(String, PathBuf)> {
|
||||
let Some(slug) = user_entry.file_name().to_str().map(str::to_owned) else {
|
||||
continue;
|
||||
};
|
||||
let open_dir = user_entry.path().join("open");
|
||||
let mut cases = match tokio::fs::read_dir(&open_dir).await {
|
||||
let mut cases = match tokio::fs::read_dir(user_entry.path()).await {
|
||||
Ok(r) => r,
|
||||
Err(_) => continue,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user