This commit is contained in:
2025-12-23 02:15:25 +01:00
commit 39b28c7f3b
120 changed files with 15045 additions and 0 deletions

27
notes-api/src/state.rs Normal file
View File

@@ -0,0 +1,27 @@
//! Application state for dependency injection
use std::sync::Arc;
use notes_domain::{NoteRepository, TagRepository, UserRepository};
/// Application state holding all dependencies
#[derive(Clone)]
pub struct AppState {
pub note_repo: Arc<dyn NoteRepository>,
pub tag_repo: Arc<dyn TagRepository>,
pub user_repo: Arc<dyn UserRepository>,
}
impl AppState {
pub fn new(
note_repo: Arc<dyn NoteRepository>,
tag_repo: Arc<dyn TagRepository>,
user_repo: Arc<dyn UserRepository>,
) -> Self {
Self {
note_repo,
tag_repo,
user_repo,
}
}
}