backend/service/health.rs
1//! Service layer for health.
2
3use diesel_async::RunQueryDsl;
4
5use crate::{config::data::SharedPool, error::ServiceError};
6
7/// Get the health status of the backend.
8///
9/// # Errors
10/// If the connection to the database could not be established.
11pub async fn get(pool: &SharedPool) -> Result<(), ServiceError> {
12 let mut conn = pool.get().await?;
13 diesel::sql_query("SELECT 1").execute(&mut conn).await?;
14 Ok(())
15}