diff options
author | rtkay123 <dev@kanjala.com> | 2025-07-27 18:16:41 +0200 |
---|---|---|
committer | rtkay123 <dev@kanjala.com> | 2025-07-27 18:16:41 +0200 |
commit | 3c4d17cf2840c643b8cd111ef775750cc5ae83b3 (patch) | |
tree | 2b7d25b24d94141a6d9255426d4f973cced5d278 /crates/profile-service/src/state.rs | |
parent | e26d87f4fa18999c6bcfbcf32cfa85adab11acdd (diff) | |
download | sellershut-3c4d17cf2840c643b8cd111ef775750cc5ae83b3.tar.bz2 sellershut-3c4d17cf2840c643b8cd111ef775750cc5ae83b3.zip |
refactor: profile -> users
Diffstat (limited to 'crates/profile-service/src/state.rs')
-rw-r--r-- | crates/profile-service/src/state.rs | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/crates/profile-service/src/state.rs b/crates/profile-service/src/state.rs deleted file mode 100644 index 1ccfbfd..0000000 --- a/crates/profile-service/src/state.rs +++ /dev/null @@ -1,42 +0,0 @@ -use std::sync::Arc; - -use sqlx::PgPool; -use stack_up::{Configuration, cache::RedisManager}; - -use crate::cnfg::LocalConfig; - -#[derive(Clone)] -pub struct AppHandle(Arc<AppState>); - -impl std::ops::Deref for AppHandle { - type Target = Arc<AppState>; - - fn deref(&self) -> &Self::Target { - &self.0 - } -} - -#[derive(Clone)] -pub struct Services { - pub postgres: PgPool, - pub cache: RedisManager, -} - -pub struct AppState { - pub services: Services, - pub local_config: LocalConfig, -} - -impl AppState { - pub async fn create( - services: Services, - configuration: &Configuration, - ) -> Result<AppHandle, anyhow::Error> { - let local_config: LocalConfig = serde_json::from_value(configuration.misc.clone())?; - - Ok(AppHandle(Arc::new(Self { - services, - local_config, - }))) - } -} |