use super::health::logic::{self, HealthResponse};
use super::http::AppState;
use crate::error::AppError;
use axum::{extract::State, Json};
#[utoipa::path(post, path = "/crontab-sync/retry",
responses((status = 200, body = HealthResponse)))]
pub async fn retry_crontab_sync(
State(state): State<AppState>,
) -> Result<Json<HealthResponse>, AppError> {
let store = state.routines.clone();
let uptime_start = state.uptime_start;
let _ = crate::sync::routines::sync_routines_to_crontab(&store);
let response = logic::build(uptime_start);
Ok(Json(response))
}
#[cfg(test)]
#[path = "retry_crontab_sync_tests.rs"]
mod tests;