fix: remove duplicate code in handle_delete_item and fix path parameter syntax
Co-authored-by: aider (openai/andrew/openrouter/qwen/qwen3-coder) <aider@aider.chat>
This commit is contained in:
@@ -212,29 +212,6 @@ pub async fn handle_delete_item(
|
||||
} else {
|
||||
Err(StatusCode::NOT_FOUND)
|
||||
}
|
||||
let mut conn = state.db.lock().await;
|
||||
|
||||
if let Some(item) = db::get_item(&mut *conn, id).map_err(|e| {
|
||||
warn!("Failed to get item {} for deletion: {}", id, e);
|
||||
StatusCode::INTERNAL_SERVER_ERROR
|
||||
})? {
|
||||
db::delete_item(&mut *conn, item).map_err(|e| {
|
||||
warn!("Failed to delete item {}: {}", id, e);
|
||||
StatusCode::INTERNAL_SERVER_ERROR
|
||||
})?;
|
||||
|
||||
let response = ApiResponse::<()> {
|
||||
success: true,
|
||||
data: None,
|
||||
error: None,
|
||||
};
|
||||
Ok(Json(response))
|
||||
} else {
|
||||
Err(StatusCode::NOT_FOUND)
|
||||
}
|
||||
} else {
|
||||
Err(StatusCode::BAD_REQUEST)
|
||||
}
|
||||
}
|
||||
|
||||
#[utoipa::path(
|
||||
|
||||
Reference in New Issue
Block a user