fix: ASRX duplication, TKG edges, trace ingest, and add pipeline progress publishing

- ASRX handler no longer stores duplicate 'asr' pre_chunks
- Pre_chunks storage made idempotent (delete-before-insert)
- Rule 1 + trace_ingest changed to query 'asrx' not 'asr'
- Trace chunks removed (dynamic from TKG/Qdrant)
- TKG scroll_face_points fixed: trace_id >= 1 (not == 1)
- TKG AsrxSegmentEntry: start/end -> start_time/end_time (match ASRX JSON)
- Unregister error handling: log instead of silent discard
- Add publish_pipeline_progress calls at each pipeline stage
  (processors, rule1, face_trace, identity_agent, TKG, rule2, completion)
This commit is contained in:
Accusys
2026-07-02 10:43:46 +08:00
parent d791d138f2
commit 3eabd45882
65 changed files with 9477 additions and 3852 deletions
+464 -65
View File
@@ -22,6 +22,12 @@ struct RegisterFileRequest {
user_id: Option<i64>,
content_hash: Option<String>,
pattern: Option<String>,
#[serde(default = "default_force")]
force: bool,
}
fn default_force() -> bool {
true
}
#[derive(Debug, Deserialize, Serialize)]
@@ -188,6 +194,7 @@ async fn register_single_file(
file_path: &str,
_user_id: Option<i64>,
provided_hash: Option<String>,
force: bool,
) -> RegisterFileResponse {
tracing::info!("[REGISTER] Starting registration for: {}", file_path);
@@ -325,41 +332,54 @@ async fn register_single_file(
"[REGISTER] Content hash collision → already registered: {}",
existing_uuid
);
let existing_info: Option<(String, String, f64, i32, i32, f64, i64, Option<String>)> = sqlx::query_as(
&format!("SELECT file_name, file_path, duration, width, height, fps, total_frames, registration_time::text FROM {} WHERE file_uuid = $1", videos_table)
).bind(&existing_uuid).fetch_optional(db.pool()).await.unwrap_or(None);
if let Some((ename, epath, dur, w, h, f, tf, rt)) = existing_info {
// If force=true, unregister asynchronously then continue
if force {
tracing::info!(
"[REGISTER] Force mode: async unregistering existing file {}",
existing_uuid
);
if let Err(e) = unregister_internal(&state, &existing_uuid).await {
tracing::error!("[REGISTER] Force unregister failed for {}: {:?}", existing_uuid, e);
} else {
tracing::info!("[REGISTER] Force unregister completed for {}", existing_uuid);
}
} else {
let existing_info: Option<(String, String, f64, i32, i32, f64, i64, Option<String>)> = sqlx::query_as(
&format!("SELECT file_name, file_path, duration, width, height, fps, total_frames, registration_time::text FROM {} WHERE file_uuid = $1", videos_table)
).bind(&existing_uuid).fetch_optional(db.pool()).await.unwrap_or(None);
if let Some((ename, epath, dur, w, h, f, tf, rt)) = existing_info {
return RegisterFileResponse {
success: true,
file_uuid: existing_uuid,
file_name: ename,
file_path: epath.clone(),
file_type: None,
duration: dur,
width: w as u32,
height: h as u32,
fps: f,
total_frames: tf as u64,
registration_time: rt,
already_exists: true,
message: format!("Content already registered: {}", epath),
};
}
return RegisterFileResponse {
success: true,
file_uuid: existing_uuid,
file_name: ename,
file_path: epath.clone(),
file_name: file_name.clone(),
file_path: canonical_path.clone(),
file_type: None,
duration: dur,
width: w as u32,
height: h as u32,
fps: f,
total_frames: tf as u64,
registration_time: rt,
duration: 0.0,
width: 0,
height: 0,
fps: 0.0,
total_frames: 0,
registration_time: None,
already_exists: true,
message: format!("Content already registered: {}", epath),
message: "Content already registered (identical file)".to_string(),
};
}
return RegisterFileResponse {
success: true,
file_uuid: existing_uuid,
file_name: file_name.clone(),
file_path: canonical_path.clone(),
file_type: None,
duration: 0.0,
width: 0,
height: 0,
fps: 0.0,
total_frames: 0,
registration_time: None,
already_exists: true,
message: "Content already registered (identical file)".to_string(),
};
}
}
@@ -418,12 +438,19 @@ async fn register_single_file(
let duration = temp_probe_json
.get("format")
.and_then(|f| {
let src = if has_video { f.get("duration") } else { None };
src.and_then(|v| v.as_str())
.and_then(|f| f.get("duration"))
.and_then(|v| v.as_str())
.and_then(|s| s.parse::<f64>().ok())
.unwrap_or_else(|| {
temp_probe_json
.get("streams")
.and_then(|s| s.as_array())
.and_then(|streams| streams.iter().next())
.and_then(|st| st.get("duration"))
.and_then(|v| v.as_str())
.and_then(|s| s.parse::<f64>().ok())
})
.unwrap_or(0.0);
.unwrap_or(0.0)
});
let mut width = 0u32;
let mut height = 0u32;
let mut fps = 0.0;
@@ -454,7 +481,7 @@ async fn register_single_file(
let status = "registered";
let _ = sqlx::query(&format!(
"INSERT INTO {} (file_uuid, file_path, file_name, file_type, duration, width, height, fps, probe_json, status, content_hash, registration_time) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, NOW()) ON CONFLICT (file_uuid) DO UPDATE SET file_path = EXCLUDED.file_path, file_name = EXCLUDED.file_name, status = EXCLUDED.status, content_hash = EXCLUDED.content_hash",
"INSERT INTO {} (file_uuid, file_path, file_name, file_type, duration, width, height, fps, probe_json, status, content_hash, registration_time) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, NOW()) ON CONFLICT (file_uuid) DO UPDATE SET file_path = EXCLUDED.file_path, file_name = EXCLUDED.file_name, status = EXCLUDED.status, content_hash = EXCLUDED.content_hash, duration = EXCLUDED.duration, width = EXCLUDED.width, height = EXCLUDED.height, fps = EXCLUDED.fps, probe_json = EXCLUDED.probe_json",
videos_table
))
.bind(&file_uuid).bind(&canonical_path).bind(&final_name).bind(&final_file_type)
@@ -509,7 +536,6 @@ async fn register_single_file(
}
}
}
}
let audio_tracks: Vec<serde_json::Value> = temp_probe_json
@@ -647,6 +673,7 @@ async fn register_file(
&entry_path.to_string_lossy().to_string(),
req.user_id,
None,
req.force,
)
.await;
if result.success {
@@ -682,7 +709,49 @@ async fn register_file(
}));
}
let resp = register_single_file(&state, &file_path, req.user_id, req.content_hash).await;
// If force=true and file already exists, unregister first
if req.force {
let videos_table = schema::table_name("videos");
// Check by file_path first
if let Ok(Some(existing_uuid)) = sqlx::query_scalar::<_, String>(&format!(
"SELECT file_uuid FROM {} WHERE file_path = $1 LIMIT 1",
videos_table
))
.bind(&file_path)
.fetch_optional(state.db.pool())
.await
{
tracing::info!(
"[REGISTER] Force mode: unregistering existing file {}",
existing_uuid
);
if let Err(e) = unregister_internal(&state, &existing_uuid).await {
tracing::error!("[REGISTER] Force unregister failed for {}: {:?}", existing_uuid, e);
}
}
// Also check by content_hash if provided
if let Some(ref content_hash) = req.content_hash {
if let Ok(Some(existing_uuid)) = sqlx::query_scalar::<_, String>(&format!(
"SELECT file_uuid FROM {} WHERE content_hash = $1 LIMIT 1",
videos_table
))
.bind(content_hash)
.fetch_optional(state.db.pool())
.await
{
tracing::info!(
"[REGISTER] Force mode: unregistering by content_hash {}",
existing_uuid
);
if let Err(e) = unregister_internal(&state, &existing_uuid).await {
tracing::error!("[REGISTER] Force unregister failed for {}: {:?}", existing_uuid, e);
}
}
}
}
let resp =
register_single_file(&state, &file_path, req.user_id, req.content_hash, req.force).await;
if resp.success
&& !resp.already_exists
@@ -706,7 +775,8 @@ async fn register_file(
if let Some(ref vp) = video_path {
if let Ok(job) = auto_state.db.create_monitor_job(&auto_uuid, Some(vp)).await {
tracing::info!("[AUTO-PIPELINE] Job {} created for {}", job.id, auto_uuid);
let all_procs: Vec<&str> = vec!["cut", "asr", "asrx", "yolo", "ocr", "face", "pose", "appearance"];
let all_procs: Vec<&str> =
vec!["cut", "asr", "asrx", "ocr", "face", "pose", "appearance"];
let total = sqlx::query_scalar::<_, i64>(&format!(
"SELECT COALESCE(total_frames, 0) FROM {} WHERE file_uuid = $1",
schema::table_name("videos")
@@ -927,6 +997,7 @@ struct UnregisterResponse {
deleted_characters: u64,
deleted_chunks_rule1: u64,
deleted_processor_alerts: u64,
deleted_processor_versions: u64,
}
#[derive(Debug, Deserialize)]
@@ -948,7 +1019,11 @@ fn delete_output_files(uuid: &str) -> u64 {
for entry in entries.flatten() {
let path = entry.path();
if let Some(name) = path.file_name().and_then(|n| n.to_str()) {
if name.starts_with(uuid) && name.ends_with(".json") {
let is_uuid_file = name.starts_with(uuid) && !path.is_dir();
let is_pipeline_log = name.starts_with("pipeline_")
&& name.contains(uuid)
&& name.ends_with(".log");
if is_uuid_file || is_pipeline_log {
if std::fs::remove_file(&path).is_ok() {
deleted_count += 1;
tracing::info!("[UNREGISTER] Deleted output file: {}", name);
@@ -957,6 +1032,17 @@ fn delete_output_files(uuid: &str) -> u64 {
}
}
}
let uuid_dir = std::path::Path::new(output_dir).join(uuid);
if uuid_dir.is_dir() {
if std::fs::remove_dir_all(&uuid_dir).is_ok() {
deleted_count += 1;
tracing::info!(
"[UNREGISTER] Deleted output directory: {}",
uuid_dir.display()
);
}
}
}
let workspace_sqlite = format!("{}.workspace.sqlite", uuid);
@@ -982,7 +1068,6 @@ async fn unregister(
tracing::info!("[UNREGISTER] Unregistering file: {}", uuid);
let videos_table = schema::table_name("videos");
let face_table = schema::table_name("face_detections");
let processor_table = schema::table_name("processor_results");
let chunks_table = schema::table_name("chunk");
let parent_chunks_table = schema::table_name("parent_chunks");
@@ -1020,7 +1105,7 @@ async fn unregister(
}};
}
let deleted_faces = delete_safe!(face_table, "file_uuid = $1", &uuid, "faces");
let deleted_faces = 0i64; // Deprecated: face_detections table removed
let deleted_processors = delete_safe!(processor_table, "file_uuid = $1", &uuid, "processors");
let deleted_parent_chunks =
delete_safe!(parent_chunks_table, "uuid = $1", &uuid, "parent chunks");
@@ -1045,20 +1130,44 @@ async fn unregister(
})?
.rows_affected() as i64;
let deleted_file_identities =
delete_safe!(file_identities_table, "file_uuid = $1", &uuid, "file identities");
let deleted_speaker_detections =
delete_safe!(speaker_detections_table, "file_uuid = $1", &uuid, "speaker detections");
let deleted_face_clusters =
delete_safe!(face_clusters_table, "file_uuid = $1", &uuid, "face clusters");
let deleted_face_recognition =
delete_safe!(face_recognition_results_table, "file_uuid = $1", &uuid, "face recognition results");
let deleted_characters =
delete_safe!(characters_table, "file_uuid = $1", &uuid, "characters");
let deleted_chunks_rule1 =
delete_safe!(chunks_rule1_table, "uuid = $1", &uuid, "chunks rule1");
let deleted_processor_alerts =
delete_safe!(processor_alerts_table, "file_uuid = $1", &uuid, "processor alerts");
let deleted_file_identities = delete_safe!(
file_identities_table,
"file_uuid = $1",
&uuid,
"file identities"
);
let deleted_speaker_detections = delete_safe!(
speaker_detections_table,
"file_uuid = $1",
&uuid,
"speaker detections"
);
let deleted_face_clusters = delete_safe!(
face_clusters_table,
"file_uuid = $1",
&uuid,
"face clusters"
);
let deleted_face_recognition = delete_safe!(
face_recognition_results_table,
"file_uuid = $1",
&uuid,
"face recognition results"
);
let deleted_characters = delete_safe!(characters_table, "file_uuid = $1", &uuid, "characters");
let deleted_chunks_rule1 = delete_safe!(chunks_rule1_table, "uuid = $1", &uuid, "chunks rule1");
let deleted_processor_alerts = delete_safe!(
processor_alerts_table,
"file_uuid = $1",
&uuid,
"processor alerts"
);
let deleted_processor_versions = delete_safe!(
"processor_versions",
"file_uuid = $1",
&uuid,
"processor versions"
);
sqlx::query(&format!(
"DELETE FROM {} WHERE file_uuid = $1",
@@ -1078,29 +1187,54 @@ async fn unregister(
})?;
tracing::info!(
"[UNREGISTER] Deleted: {} faces, {} processors, {} parent_chunks, {} chunks, {} pre_chunks, {} tkg_nodes, {} cuts, {} strangers, {} chunk_vectors, {} monitor_jobs, {} frames, {} file_identities, {} speaker_detections, {} face_clusters, {} face_recognition_results, {} characters, {} chunks_rule1, {} processor_alerts",
"[UNREGISTER] Deleted: {} faces, {} processors, {} parent_chunks, {} chunks, {} pre_chunks, {} tkg_nodes, {} cuts, {} strangers, {} chunk_vectors, {} monitor_jobs, {} frames, {} file_identities, {} speaker_detections, {} face_clusters, {} face_recognition_results, {} characters, {} chunks_rule1, {} processor_alerts, {} processor_versions",
deleted_faces, deleted_processors, deleted_parent_chunks, deleted_chunks,
deleted_pre_chunks, deleted_tkg_nodes, deleted_cuts, deleted_strangers,
deleted_chunk_vectors, deleted_monitor_jobs, deleted_frames,
deleted_file_identities, deleted_speaker_detections, deleted_face_clusters,
deleted_face_recognition, deleted_characters, deleted_chunks_rule1,
deleted_processor_alerts
deleted_processor_alerts, deleted_processor_versions
);
let deleted_output_files = delete_output_files(&uuid);
let deleted_qdrant_vectors = {
let qdrant = QdrantDb::new();
match qdrant.delete_by_uuid(&uuid).await {
Ok(_) => {
tracing::info!("[UNREGISTER] Deleted Qdrant vectors for {}", uuid);
Some(1)
}
Err(e) => {
tracing::warn!("[UNREGISTER] Failed to delete Qdrant vectors: {}", e);
None
let mut total = 0u64;
if qdrant.delete_by_uuid(&uuid).await.is_ok() {
tracing::info!("[UNREGISTER] Deleted Qdrant vectors from main collection");
total += 1;
} else {
tracing::warn!("[UNREGISTER] Failed to delete Qdrant vectors from main collection");
}
let additional_collections = [
"_faces", // Python store_traced_faces.py
&format!("{}_voice", uuid), // Per-file voice embeddings
];
for coll in &additional_collections {
if QdrantDb::delete_by_uuid_from_collection(
&qdrant.client,
&qdrant.base_url,
&qdrant.api_key,
coll,
&uuid,
)
.await
.is_ok()
{
tracing::info!(
"[UNREGISTER] Deleted Qdrant vectors from collection: {}",
coll
);
total += 1;
} else {
tracing::debug!("[UNREGISTER] No vectors or collection not found: {}", coll);
}
}
Some(total)
};
let deleted_redis_keys = {
@@ -1130,7 +1264,10 @@ async fn unregister(
Some(1)
}
Err(e) => {
tracing::warn!("[UNREGISTER] Failed to delete Qdrant workspace vectors: {}", e);
tracing::warn!(
"[UNREGISTER] Failed to delete Qdrant workspace vectors: {}",
e
);
None
}
}
@@ -1155,13 +1292,275 @@ async fn unregister(
deleted_characters: deleted_characters as u64,
deleted_chunks_rule1: deleted_chunks_rule1 as u64,
deleted_processor_alerts: deleted_processor_alerts as u64,
deleted_processor_versions: deleted_processor_versions as u64,
}))
}
/// Internal unregister function - can be called from both API and register
async fn unregister_internal(state: &AppState, uuid: &str) -> Result<(), StatusCode> {
let videos_table = schema::table_name("videos");
let processor_table = schema::table_name("processor_results");
let chunks_table = schema::table_name("chunk");
let parent_chunks_table = schema::table_name("parent_chunks");
let pre_chunks_table = schema::table_name("pre_chunks");
let tkg_nodes_table = schema::table_name("tkg_nodes");
let cuts_table = schema::table_name("cuts");
let strangers_table = schema::table_name("strangers");
let chunk_vectors_table = schema::table_name("chunk_vectors");
let monitor_jobs_table = schema::table_name("monitor_jobs");
let frames_table = schema::table_name("frames");
let file_identities_table = schema::table_name("file_identities");
let speaker_detections_table = schema::table_name("speaker_detections");
let face_clusters_table = schema::table_name("face_clusters");
let face_recognition_results_table = schema::table_name("face_recognition_results");
let characters_table = schema::table_name("characters");
let chunks_rule1_table = schema::table_name("chunks_rule1");
let processor_alerts_table = schema::table_name("processor_alerts");
let mut tx = state.db.pool().begin().await.map_err(|e| {
tracing::error!("[unregister] Failed to start transaction: {}", e);
StatusCode::INTERNAL_SERVER_ERROR
})?;
macro_rules! delete_safe {
($table:expr, $where:expr, $bind:expr, $label:expr) => {{
sqlx::query(&format!("DELETE FROM {} WHERE {}", $table, $where))
.bind($bind)
.execute(&mut *tx)
.await
.map_err(|e| {
tracing::error!("[unregister] Failed to delete {}: {}", $label, e);
StatusCode::INTERNAL_SERVER_ERROR
})?
.rows_affected() as i64
}};
}
let _deleted_faces: i64 = 0; // Deprecated: face_detections table removed
let _deleted_processors = delete_safe!(processor_table, "file_uuid = $1", uuid, "processors");
let _deleted_parent_chunks =
delete_safe!(parent_chunks_table, "uuid = $1", uuid, "parent chunks");
let _deleted_chunks = delete_safe!(chunks_table, "file_uuid = $1", uuid, "chunks");
let _deleted_pre_chunks = delete_safe!(pre_chunks_table, "file_uuid = $1", uuid, "pre_chunks");
let _deleted_tkg_nodes = delete_safe!(tkg_nodes_table, "file_uuid = $1", uuid, "TKG nodes");
let _deleted_cuts = delete_safe!(cuts_table, "file_uuid = $1", uuid, "cuts");
let _deleted_strangers = delete_safe!(strangers_table, "file_uuid = $1", uuid, "strangers");
let _deleted_chunk_vectors =
delete_safe!(chunk_vectors_table, "uuid = $1", uuid, "chunk vectors");
let _deleted_monitor_jobs = delete_safe!(monitor_jobs_table, "uuid = $1", uuid, "monitor jobs");
let _deleted_frames: i64 = sqlx::query(&format!(
"DELETE FROM {} WHERE file_id = (SELECT id FROM {} WHERE file_uuid = $1)",
frames_table, videos_table
))
.bind(uuid)
.execute(&mut *tx)
.await
.map_err(|e| {
tracing::error!("[unregister] Failed to delete frames: {}", e);
StatusCode::INTERNAL_SERVER_ERROR
})?
.rows_affected() as i64;
let _deleted_file_identities = delete_safe!(
file_identities_table,
"file_uuid = $1",
uuid,
"file identities"
);
let _deleted_speaker_detections = delete_safe!(
speaker_detections_table,
"file_uuid = $1",
uuid,
"speaker detections"
);
let _deleted_face_clusters =
delete_safe!(face_clusters_table, "file_uuid = $1", uuid, "face clusters");
let _deleted_face_recognition = delete_safe!(
face_recognition_results_table,
"file_uuid = $1",
uuid,
"face recognition results"
);
let _deleted_characters = delete_safe!(characters_table, "file_uuid = $1", uuid, "characters");
let _deleted_chunks_rule1 = delete_safe!(chunks_rule1_table, "uuid = $1", uuid, "chunks rule1");
let _deleted_processor_alerts = delete_safe!(
processor_alerts_table,
"file_uuid = $1",
uuid,
"processor alerts"
);
let _deleted_processor_versions = delete_safe!(
"processor_versions",
"file_uuid = $1",
uuid,
"processor versions"
);
sqlx::query(&format!(
"DELETE FROM {} WHERE file_uuid = $1",
videos_table
))
.bind(uuid)
.execute(&mut *tx)
.await
.map_err(|e| {
tracing::error!("[unregister] Failed: {}", e);
StatusCode::INTERNAL_SERVER_ERROR
})?;
tx.commit().await.map_err(|e| {
tracing::error!("[unregister] Failed to commit transaction: {}", e);
StatusCode::INTERNAL_SERVER_ERROR
})?;
tracing::info!("[UNREGISTER] Deleted all data for {}", uuid);
// Delete output files
delete_output_files(uuid);
// Delete Qdrant vectors
let qdrant = QdrantDb::new();
let _ = qdrant.delete_by_uuid(uuid).await;
let _ = QdrantDb::delete_by_uuid_from_collection(
&qdrant.client,
&qdrant.base_url,
&qdrant.api_key,
"_faces",
uuid,
)
.await;
let _ = QdrantDb::delete_by_uuid_from_collection(
&qdrant.client,
&qdrant.base_url,
&qdrant.api_key,
&format!("{}_voice", uuid),
uuid,
)
.await;
// Delete Qdrant workspace
let workspace = QdrantWorkspace::new();
let _ = workspace.delete_by_file_uuid(uuid).await;
// Delete Redis keys
if let Ok(redis) = RedisClient::new() {
let _ = redis.delete_worker_job(uuid).await;
}
Ok(())
}
#[derive(Debug, Deserialize)]
struct UpdateMetadataRequest {
duration: Option<f64>,
status: Option<String>,
width: Option<i32>,
height: Option<i32>,
fps: Option<f64>,
}
#[derive(Serialize)]
struct UpdateMetadataResponse {
success: bool,
file_uuid: String,
message: String,
}
async fn update_file_metadata(
Path(file_uuid): Path<String>,
State(state): State<AppState>,
Json(req): Json<UpdateMetadataRequest>,
) -> Result<Json<UpdateMetadataResponse>, StatusCode> {
let videos_table = schema::table_name("videos");
let mut set_clauses: Vec<String> = Vec::new();
let mut bind_idx = 2;
if let Some(_) = req.duration {
set_clauses.push(format!("duration = ${}", bind_idx));
bind_idx += 1;
}
if let Some(_) = req.status {
set_clauses.push(format!("status = ${}", bind_idx));
bind_idx += 1;
}
if let Some(_) = req.width {
set_clauses.push(format!("width = ${}", bind_idx));
bind_idx += 1;
}
if let Some(_) = req.height {
set_clauses.push(format!("height = ${}", bind_idx));
bind_idx += 1;
}
if let Some(_) = req.fps {
set_clauses.push(format!("fps = ${}", bind_idx));
bind_idx += 1;
}
if set_clauses.is_empty() {
return Ok(Json(UpdateMetadataResponse {
success: false,
file_uuid,
message: "No fields to update".to_string(),
}));
}
set_clauses.push("updated_at = NOW()".to_string());
let sql = format!(
"UPDATE {} SET {} WHERE file_uuid = $1",
videos_table,
set_clauses.join(", ")
);
let mut query = sqlx::query(&sql).bind(&file_uuid);
if let Some(d) = req.duration {
query = query.bind(d);
}
if let Some(s) = req.status {
query = query.bind(s);
}
if let Some(w) = req.width {
query = query.bind(w);
}
if let Some(h) = req.height {
query = query.bind(h);
}
if let Some(f) = req.fps {
query = query.bind(f);
}
let result = query.execute(state.db.pool()).await;
match result {
Ok(res) if res.rows_affected() > 0 => Ok(Json(UpdateMetadataResponse {
success: true,
file_uuid,
message: "Metadata updated successfully".to_string(),
})),
Ok(_) => Ok(Json(UpdateMetadataResponse {
success: false,
file_uuid,
message: "File not found".to_string(),
})),
Err(e) => {
tracing::error!("[METADATA] Update failed: {}", e);
Ok(Json(UpdateMetadataResponse {
success: false,
file_uuid,
message: format!("Update failed: {}", e),
}))
}
}
}
pub fn file_routes() -> Router<AppState> {
Router::new()
.route("/api/v1/files/register", post(register_file))
.route("/api/v1/files/lookup", get(lookup_file_by_name))
.route("/api/v1/unregister", post(unregister))
.route("/api/v1/file/:file_uuid/probe", get(probe_by_uuid))
.route(
"/api/v1/file/:file_uuid/metadata",
post(update_file_metadata),
)
}