use super::logic;
use crate::routines::RoutineStore;
use axum::{extract::State, Json};
use logic::CleanupResponse;
#[utoipa::path(post, path = "/routines/cleanup",
responses((status = 200, body = CleanupResponse, description = "Workbenches removed and bytes freed")))]
pub async fn cleanup_workbenches(State(store): State<RoutineStore>) -> Json<CleanupResponse> {
Json(
tokio::task::spawn_blocking(move || logic::build(&store))
.await
.unwrap_or(CleanupResponse {
removed: 0,
freed_bytes: 0,
}),
)
}
#[cfg(test)]
#[path = "http_tests.rs"]
mod http_tests;