use axum::{extract::State, response::IntoResponse, Json};
use serde_json::json;
use crate::state::AppState;
pub async fn health_check(State(state): State<AppState>) -> impl IntoResponse {
let db_status = match state.db.ping().await {
Ok(_) => "healthy",
Err(_) => "unhealthy",
};
Json(json!({
"status": "ok",
"database": db_status,
}))
}