use std::sync::Arc; use crate::config::Config; use notes_domain::{ NoteRepository, NoteService, TagRepository, TagService, UserRepository, UserService, }; /// Application state holding all dependencies #[derive(Clone)] pub struct AppState { pub note_repo: Arc, pub tag_repo: Arc, pub user_repo: Arc, pub note_service: Arc, pub tag_service: Arc, pub user_service: Arc, pub nats_client: async_nats::Client, pub config: Config, } impl AppState { pub fn new( note_repo: Arc, tag_repo: Arc, user_repo: Arc, note_service: Arc, tag_service: Arc, user_service: Arc, nats_client: async_nats::Client, config: Config, ) -> Self { Self { note_repo, tag_repo, user_repo, note_service, tag_service, user_service, nats_client, config, } } }