diff --git a/editoast/src/views/infra/mod.rs b/editoast/src/views/infra/mod.rs index 947af6d06e5..13e78ab96cf 100644 --- a/editoast/src/views/infra/mod.rs +++ b/editoast/src/views/infra/mod.rs @@ -18,7 +18,6 @@ use actix_web::web::Data; use actix_web::web::Json; use actix_web::web::Path; use actix_web::web::Query; -use actix_web::Either; use actix_web::HttpResponse; use actix_web::Responder; use chashmap::CHashMap; @@ -26,7 +25,6 @@ use editoast_derive::EditoastError; use serde::Deserialize; use serde::Serialize; use std::collections::HashMap; -use std::ops::DerefMut as _; use std::sync::Arc; use thiserror::Error; use utoipa::IntoParams; @@ -97,7 +95,6 @@ pub fn infra_routes() -> impl HttpServiceFactory { list, create, refresh, - cache_status, get_all_voltages, railjson::railjson_routes(), )) @@ -628,31 +625,6 @@ async fn load( Ok(HttpResponse::NoContent().finish()) } -#[derive(Debug, Default, Deserialize)] -pub struct StatePayload { - infra: Option, -} - -#[get("/cache_status")] -async fn cache_status( - payload: Either, ()>, - db_pool: Data, - core: Data, -) -> Result>> { - if let Either::Left(Json(StatePayload { - infra: Some(infra_id), - })) = payload - { - if !Infra::exists(db_pool.get().await?.deref_mut(), infra_id).await? { - return Err(InfraApiError::NotFound { infra_id }.into()); - } - let infra_state = fetch_infra_state(infra_id, core.as_ref()).await?; - Ok(Json(HashMap::from([(infra_id.to_string(), infra_state)]))) - } else { - Ok(Json(fetch_all_infra_states(core.as_ref()).await?)) - } -} - /// Builds a Core cache_status request, runs it pub async fn fetch_infra_state(infra_id: i64, core: &CoreClient) -> Result { Ok(InfraStateRequest {