fix: unregister — rename request/response uuid → file_uuid
This commit is contained in:
@@ -61,7 +61,7 @@ Every path segment after the resource ID is a **verb** — an action on that res
|
||||
| 6 | GET | `/api/v1/stats/sftpgo` | SFTPGo service status |
|
||||
| 7 | GET | `/api/v1/stats/inference` | LLM/embedding health |
|
||||
| 8 | POST | `/api/v1/files/register` | Register video file → file_uuid |
|
||||
| 9 | POST | `/api/v1/unregister` | Unregister file(s): by `uuid` or pattern match on `file_path`+`pattern` |
|
||||
| 9 | POST | `/api/v1/unregister` | Unregister file(s): by `file_uuid` or pattern match on `file_path`+`pattern` |
|
||||
| 10 | GET | `/api/v1/files/scan` | Scan directory for new files |
|
||||
| 11 | GET | `/api/v1/file/:file_uuid/probe` | ffprobe metadata |
|
||||
| 12 | POST | `/api/v1/file/:file_uuid/process` | Start processing pipeline |
|
||||
|
||||
@@ -118,10 +118,10 @@ Modes:
|
||||
- By `file_path` + `pattern` regex: unregister all matching files in a directory
|
||||
|
||||
```bash
|
||||
# By UUID
|
||||
# By file_uuid
|
||||
curl -X POST http://localhost:3002/api/v1/unregister \
|
||||
-H "X-API-Key: muser_..." -H "Content-Type: application/json" \
|
||||
-d '{"uuid":"53e3a229bf68878b7a799e811e097f9c"}'
|
||||
-d '{"file_uuid":"53e3a229bf68878b7a799e811e097f9c"}'
|
||||
|
||||
# By pattern (unregister all .mp4 files in directory)
|
||||
curl -X POST http://localhost:3002/api/v1/unregister \
|
||||
@@ -129,7 +129,7 @@ curl -X POST http://localhost:3002/api/v1/unregister \
|
||||
-d '{"file_path":"/data/demo","pattern":"\\.mp4$"}'
|
||||
```
|
||||
```json
|
||||
{"success":true,"uuid":"53e3a229bf68878b7a799e811e097f9c","message":"File unregistered successfully"}
|
||||
{"success":true,"file_uuid":"53e3a229bf68878b7a799e811e097f9c","message":"File unregistered successfully"}
|
||||
```
|
||||
|
||||
```bash
|
||||
|
||||
@@ -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