fix: unregister — rename request/response uuid → file_uuid
This commit is contained in:
@@ -2507,13 +2507,13 @@ async fn cache_toggle(
|
||||
#[derive(Debug, Serialize)]
|
||||
struct UnregisterResponse {
|
||||
success: bool,
|
||||
uuid: String,
|
||||
file_uuid: String,
|
||||
message: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct UnregisterRequest {
|
||||
uuid: Option<String>,
|
||||
file_uuid: Option<String>,
|
||||
file_path: Option<String>,
|
||||
pattern: Option<String>,
|
||||
}
|
||||
@@ -2530,7 +2530,7 @@ async fn unregister(
|
||||
if !dir.is_dir() {
|
||||
return Ok(Json(UnregisterResponse {
|
||||
success: false,
|
||||
uuid: String::new(),
|
||||
file_uuid: String::new(),
|
||||
message: format!("Not a directory: {}", dir_path),
|
||||
}));
|
||||
}
|
||||
@@ -2561,18 +2561,18 @@ async fn unregister(
|
||||
let _ = state.mongo_cache.invalidate_videos_list().await;
|
||||
return Ok(Json(UnregisterResponse {
|
||||
success: true,
|
||||
uuid: format!("batch_{}", count),
|
||||
file_uuid: format!("batch_{}", count),
|
||||
message: format!("Unregistered {} files matching pattern", count),
|
||||
}));
|
||||
}
|
||||
|
||||
// Single UUID mode
|
||||
let uuid = req.uuid.as_deref().unwrap_or("");
|
||||
let uuid = req.file_uuid.as_deref().unwrap_or("");
|
||||
if uuid.is_empty() {
|
||||
return Ok(Json(UnregisterResponse {
|
||||
success: false,
|
||||
uuid: String::new(),
|
||||
message: "Either uuid or file_path+pattern is required".to_string(),
|
||||
file_uuid: String::new(),
|
||||
message: "Either file_uuid or file_path+pattern is required".to_string(),
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -2582,7 +2582,7 @@ async fn unregister(
|
||||
let _ = state.mongo_cache.invalidate_videos_list().await;
|
||||
Ok(Json(UnregisterResponse {
|
||||
success: true,
|
||||
uuid: uuid.to_string(),
|
||||
file_uuid: uuid.to_string(),
|
||||
message: "File unregistered successfully".to_string(),
|
||||
}))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user