fix: delete_video - add file existence check + fix pre_chunks UUID cast
- unregister: check file exists before delete, return 200 with success:false if not found - delete_video: cast pre_chunks.file_uuid parameter as UUID (::uuid) - Added Phase 2 test script (10/10 endpoints passed)
This commit is contained in:
@@ -3525,6 +3525,22 @@ async fn unregister(
|
||||
}
|
||||
|
||||
tracing::info!("[unregister] Unregistering file: {}", uuid);
|
||||
|
||||
// Check if video exists first
|
||||
match db.get_video_by_uuid(uuid).await {
|
||||
Ok(Some(_)) => {},
|
||||
Ok(None) => {
|
||||
return Ok(Json(UnregisterResponse {
|
||||
success: false,
|
||||
file_uuid: uuid.to_string(),
|
||||
message: "File not found".to_string(),
|
||||
}));
|
||||
}
|
||||
Err(e) => {
|
||||
return Err(StatusCode::INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
match db.delete_video(uuid).await {
|
||||
Ok(_) => {
|
||||
let _ = state.mongo_cache.invalidate_videos_list().await;
|
||||
|
||||
Reference in New Issue
Block a user