Refactor application context and repository structure
- Updated `AppContext` to include separate repositories for movies, reviews, diaries, and stats. - Modified use cases to utilize the new repository structure, ensuring that the correct repositories are called for their respective operations. - Introduced `DiaryRepository` and `StatsRepository` traits to encapsulate diary and statistics-related operations. - Updated all relevant use cases, handlers, and tests to reflect the changes in repository usage. - Ensured that panic repositories are updated to implement the new traits for testing purposes.
This commit is contained in:
@@ -1,15 +1,19 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use domain::ports::{
|
||||
AuthService, EventPublisher, MetadataClient, MovieRepository, PasswordHasher,
|
||||
PosterFetcherClient, PosterStorage, UserRepository,
|
||||
AuthService, DiaryRepository, EventPublisher, MetadataClient, MovieRepository,
|
||||
PasswordHasher, PosterFetcherClient, PosterStorage, ReviewRepository, StatsRepository,
|
||||
UserRepository,
|
||||
};
|
||||
|
||||
use crate::config::AppConfig;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct AppContext {
|
||||
pub repository: Arc<dyn MovieRepository>,
|
||||
pub movie_repository: Arc<dyn MovieRepository>,
|
||||
pub review_repository: Arc<dyn ReviewRepository>,
|
||||
pub diary_repository: Arc<dyn DiaryRepository>,
|
||||
pub stats_repository: Arc<dyn StatsRepository>,
|
||||
pub metadata_client: Arc<dyn MetadataClient>,
|
||||
pub poster_fetcher: Arc<dyn PosterFetcherClient>,
|
||||
pub poster_storage: Arc<dyn PosterStorage>,
|
||||
|
||||
Reference in New Issue
Block a user