fix(domain): typed VOs in MovieEnrichmentRequested and PersonEnrichmentRequested
This commit is contained in:
@@ -112,7 +112,7 @@ async fn publish_events(
|
||||
publisher
|
||||
.publish(&DomainEvent::MovieEnrichmentRequested {
|
||||
movie_id: movie.id().clone(),
|
||||
external_metadata_id: ext_id.value().to_string(),
|
||||
external_metadata_id: ext_id.clone(),
|
||||
})
|
||||
.await?;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ use domain::{
|
||||
errors::DomainError,
|
||||
events::DomainEvent,
|
||||
ports::{EventPublisher, MovieProfileRepository, PeriodicJob},
|
||||
value_objects::ExternalMetadataId,
|
||||
};
|
||||
|
||||
pub struct EnrichmentStalenessJob {
|
||||
@@ -38,9 +39,16 @@ impl PeriodicJob for EnrichmentStalenessJob {
|
||||
}
|
||||
tracing::info!("enrichment scan: {} stale movies", stale.len());
|
||||
for (movie_id, external_metadata_id) in stale {
|
||||
let ext_id = match ExternalMetadataId::new(external_metadata_id) {
|
||||
Ok(id) => id,
|
||||
Err(e) => {
|
||||
tracing::warn!("skipping stale movie with malformed external_metadata_id: {e}");
|
||||
continue;
|
||||
}
|
||||
};
|
||||
let event = DomainEvent::MovieEnrichmentRequested {
|
||||
movie_id,
|
||||
external_metadata_id,
|
||||
external_metadata_id: ext_id,
|
||||
};
|
||||
self.event_publisher.publish(&event).await?;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ pub async fn execute(deps: &GetPersonDeps, id: PersonId) -> Result<Option<Person
|
||||
.event_publisher
|
||||
.publish(&DomainEvent::PersonEnrichmentRequested {
|
||||
person_id: id,
|
||||
external_person_id: p.external_id().value().to_string(),
|
||||
external_person_id: p.external_id().clone(),
|
||||
})
|
||||
.await;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ pub async fn execute(deps: &GetPersonDeps, id: PersonId) -> Result<PersonCredits
|
||||
.event_publisher
|
||||
.publish(&DomainEvent::PersonEnrichmentRequested {
|
||||
person_id: id,
|
||||
external_person_id: credits.person.external_id().value().to_string(),
|
||||
external_person_id: credits.person.external_id().clone(),
|
||||
})
|
||||
.await;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user