fix(domain): typed VOs in MovieEnrichmentRequested and PersonEnrichmentRequested

This commit is contained in:
2026-06-12 01:34:47 +02:00
parent aec5f6b058
commit cedb13d7a8
9 changed files with 24 additions and 15 deletions

View File

@@ -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?;
}

View File

@@ -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?;
}

View File

@@ -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;
}

View File

@@ -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;
}