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, #[cfg(feature = "smart-features")] pub link_repo: Arc, pub note_service: Arc, pub tag_service: Arc, pub user_service: Arc, pub config: Config, } impl AppState { pub fn new( note_repo: Arc, tag_repo: Arc, user_repo: Arc, #[cfg(feature = "smart-features")] link_repo: Arc, note_service: Arc, tag_service: Arc, user_service: Arc, config: Config, ) -> Self { Self { note_repo, tag_repo, user_repo, #[cfg(feature = "smart-features")] link_repo, note_service, tag_service, user_service, config, } } }