chore: format with updated rustfmt and taplo rules
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: Ie9ef5fc421fa20071946cf1073f7920c6a6a6964
This commit is contained in:
parent
605b1a5181
commit
c306383d27
72 changed files with 11217 additions and 10487 deletions
|
|
@ -5,24 +5,24 @@ use crate::state::AppState;
|
|||
|
||||
#[derive(Serialize)]
|
||||
struct HealthResponse {
|
||||
status: &'static str,
|
||||
database: bool,
|
||||
status: &'static str,
|
||||
database: bool,
|
||||
}
|
||||
|
||||
async fn health_check(State(state): State<AppState>) -> Json<HealthResponse> {
|
||||
let db_ok = sqlx::query_scalar::<_, i32>("SELECT 1")
|
||||
.fetch_one(&state.pool)
|
||||
.await
|
||||
.is_ok();
|
||||
let db_ok = sqlx::query_scalar::<_, i32>("SELECT 1")
|
||||
.fetch_one(&state.pool)
|
||||
.await
|
||||
.is_ok();
|
||||
|
||||
let status = if db_ok { "ok" } else { "degraded" };
|
||||
let status = if db_ok { "ok" } else { "degraded" };
|
||||
|
||||
Json(HealthResponse {
|
||||
status,
|
||||
database: db_ok,
|
||||
})
|
||||
Json(HealthResponse {
|
||||
status,
|
||||
database: db_ok,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn router() -> Router<AppState> {
|
||||
Router::new().route("/health", get(health_check))
|
||||
Router::new().route("/health", get(health_check))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue