Merge branch 'evals' of https://github.com/buster-so/buster into evals

This commit is contained in:
Nate Kelley 2025-03-20 15:59:19 -06:00
commit 904cb6deb2
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
2 changed files with 14 additions and 14 deletions

View File

@ -1,10 +1,7 @@
use axum::{
extract::Path,
http::StatusCode,
Json,
Extension,
use axum::{extract::Path, http::StatusCode, Extension, Json};
use handlers::metrics::{
delete_metric_handler, delete_metrics_handler, DeleteMetricsRequest, DeleteMetricsResponse,
};
use handlers::metrics::{delete_metric_handler, delete_metrics_handler, DeleteMetricsRequest, DeleteMetricsResponse};
use middleware::AuthenticatedUser;
use uuid::Uuid;
@ -50,18 +47,21 @@ pub async fn delete_metrics_rest_handler(
if response.failed_ids.is_empty() && !response.successful_ids.is_empty() {
return Ok(ApiResponse::NoContent);
}
// Return 207 Multi-Status if there were mixed results
if !response.failed_ids.is_empty() {
return Ok(ApiResponse::custom(StatusCode::MULTI_STATUS, response));
return Ok(ApiResponse::JsonData(response));
}
// Return 200 OK for other cases (like empty list)
Ok(ApiResponse::Ok(response))
},
Ok(ApiResponse::JsonData(response))
}
Err(e) => {
tracing::error!("Error in bulk metric deletion: {}", e);
Err((StatusCode::INTERNAL_SERVER_ERROR, format!("Failed to delete metrics: {}", e)))
Err((
StatusCode::INTERNAL_SERVER_ERROR,
format!("Failed to delete metrics: {}", e),
))
}
}
}
}

View File

@ -52,7 +52,7 @@ export const updateMetric = async (params: UpdateMetricParams) => {
};
export const deleteMetrics = async (params: { ids: string[] }) => {
return mainApi.delete<null>(`/metrics/delete`, {
return mainApi.delete<null>(`/metrics`, {
data: { ids: params.ids }
}).then((res) => res.data);
};