refactor: remaining MEDIUM — CQRS splits, DI Deps, profile dedup, event Value, response enum
M1: MovieRepository→MovieCommand/MovieQuery, WatchEventRepository→ WatchEventCommand/WatchEventQuery M2: goals/ and import/ use Deps structs M7: extract upload_image helper in update_profile M8: FederationDeliveryRequested activity_json String→serde_json::Value M11: UserProfileResponse uses ProfileViewData enum
This commit is contained in:
@@ -15,7 +15,8 @@ pub async fn execute(
|
||||
|
||||
let (movie, _is_new) = resolve_and_persist_movie(
|
||||
&cmd.input,
|
||||
deps.movie.as_ref(),
|
||||
deps.movie_command.as_ref(),
|
||||
deps.movie_query.as_ref(),
|
||||
deps.metadata.as_ref(),
|
||||
deps.event_publisher.as_ref(),
|
||||
)
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use domain::ports::{EventPublisher, MetadataClient, MovieRepository, WatchlistRepository};
|
||||
use domain::ports::{EventPublisher, MetadataClient, MovieCommand, MovieQuery, WatchlistRepository};
|
||||
|
||||
pub struct WatchlistAddDeps {
|
||||
pub movie: Arc<dyn MovieRepository>,
|
||||
pub movie_command: Arc<dyn MovieCommand>,
|
||||
pub movie_query: Arc<dyn MovieQuery>,
|
||||
pub metadata: Arc<dyn MetadataClient>,
|
||||
pub watchlist: Arc<dyn WatchlistRepository>,
|
||||
pub event_publisher: Arc<dyn EventPublisher>,
|
||||
|
||||
@@ -2,7 +2,7 @@ use std::sync::Arc;
|
||||
|
||||
use domain::{
|
||||
models::Movie,
|
||||
ports::MovieRepository,
|
||||
ports::MovieCommand,
|
||||
testing::{InMemoryMovieRepository, InMemoryWatchlistRepository, NoopEventPublisher},
|
||||
value_objects::{MovieTitle, ReleaseYear},
|
||||
};
|
||||
@@ -17,7 +17,8 @@ fn make_deps(
|
||||
watchlist: Arc<InMemoryWatchlistRepository>,
|
||||
) -> WatchlistAddDeps {
|
||||
WatchlistAddDeps {
|
||||
movie: movies,
|
||||
movie_command: Arc::clone(&movies) as _,
|
||||
movie_query: movies,
|
||||
metadata: Arc::new(domain::testing::FakeMetadataClient),
|
||||
watchlist,
|
||||
event_publisher: NoopEventPublisher::new(),
|
||||
|
||||
Reference in New Issue
Block a user