diff options
| author | rtkay123 <dev@kanjala.com> | 2026-04-03 14:43:54 +0200 |
|---|---|---|
| committer | rtkay123 <dev@kanjala.com> | 2026-04-03 14:43:54 +0200 |
| commit | 41d90f42c37df06dabfd717d19f3dc72b5ba2d11 (patch) | |
| tree | 2da259062cbdb459a2958d0be46eed20642b355a /crates/api-base/src/health/mod.rs | |
| parent | 898a2966975c7397e35d8df6b72df42147bf18bd (diff) | |
| download | sellershut-41d90f42c37df06dabfd717d19f3dc72b5ba2d11.tar.bz2 sellershut-41d90f42c37df06dabfd717d19f3dc72b5ba2d11.zip | |
feat: openapi
Diffstat (limited to 'crates/api-base/src/health/mod.rs')
| -rw-r--r-- | crates/api-base/src/health/mod.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/crates/api-base/src/health/mod.rs b/crates/api-base/src/health/mod.rs new file mode 100644 index 0000000..a84dc85 --- /dev/null +++ b/crates/api-base/src/health/mod.rs @@ -0,0 +1,27 @@ +#[cfg(feature = "utoipa")] +mod apidoc; + +#[cfg(feature = "utoipa")] +pub use apidoc::*; + +#[derive(Default)] +pub struct BaseService; + +impl HealthDriver for BaseService {} + +pub trait HealthDriver: Send + Sync { + fn health(&self, app: &str, version: &str) -> String { + format!("{app} v{version} is live") + } +} + +#[cfg(test)] +mod tests { + use crate::health::{BaseService, HealthDriver}; + + #[test] + fn health() { + let app = BaseService.health(env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION")); + assert!(app.contains("is live")); + } +} |
