use std::sync::Arc; use std::time::Instant; use config::AppConfig; use export::{AppDatabase, AppRedis, AppState, AppStorage}; #[derive(Clone)] pub struct AdminService { pub state: AppState, started_at: Instant, } impl AdminService { pub fn new(state: AppState) -> Self { Self { state, started_at: Instant::now(), } } pub fn config(&self) -> &AppConfig { &self.state.config } pub fn admin_config(&self) -> &config::admin::AdminConfig { &self.state.config.admin } pub fn db(&self) -> &Arc { &self.state.database } pub fn redis(&self) -> &AppRedis { &self.state.redis } pub fn storage(&self) -> &Arc { &self.state.storage } pub fn uptime_secs(&self) -> u64 { self.started_at.elapsed().as_secs() } }