forklaunch 1.33.0

Launch faster with forklaunch
1
2
3
4
5
6
7
8
9
10
use crate::{domain::schemas::HealthResponse, persistence::PostgresRepository, error::Result};
#[derive(Clone)]
pub struct HealthService { name: String, repository: PostgresRepository }
impl HealthService {
    pub fn new(name: String, repository: PostgresRepository) -> Self { Self { name, repository } }
    pub async fn report(&self) -> Result<HealthResponse> {
        Ok(HealthResponse { service: self.name.clone(), status: "ok".into(),
            record_count: self.repository.count().await?, routes: vec!["health".into()] })
    }
}