backend/controller/
health.rs1use actix_http::StatusCode;
4use actix_web::{get, HttpResponse, Result};
5
6use crate::config::data::SharedPool;
7use crate::error::ServiceError;
8use crate::service::health;
9
10#[utoipa::path(
15 context_path = "/api/health",
16 responses(
17 (status = 200, description = "Backend is healthy"),
18 (status = 503, description = "One or more services are unavailable")
19 )
20)]
21#[get("")]
22pub async fn get(pool: SharedPool) -> Result<HttpResponse> {
23 health::get(&pool)
24 .await
25 .map_err(|e| ServiceError::new(StatusCode::SERVICE_UNAVAILABLE, &e.reason))?;
26 Ok(HttpResponse::Ok().body("OK"))
27}