feat: implement TMDb enrichment for movie profiles
- Add SqliteMovieProfileRepository for managing movie profiles in SQLite. - Create TmdbEnrichmentClient to fetch movie details from TMDb API. - Implement enrichment event handling with EnrichmentHandler. - Introduce periodic jobs for cleaning up expired import sessions and checking for stale movie profiles. - Update application context to include movie profile repository. - Add API endpoint to retrieve movie profiles. - Extend domain models with new structures for movie enrichment (Genre, Keyword, CastMember, CrewMember, MovieProfile). - Modify event system to include MovieEnrichmentRequested event. - Enhance tests to cover new functionality and ensure stability.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use chrono::{NaiveDateTime, Utc};
|
||||
use chrono::{DateTime, NaiveDateTime, Utc};
|
||||
|
||||
use crate::{
|
||||
errors::DomainError,
|
||||
@@ -490,3 +490,56 @@ mod tests {
|
||||
assert_eq!(user.avatar_path(), None);
|
||||
}
|
||||
}
|
||||
|
||||
// ── Movie enrichment ───────────────────────────────────────────────────────────
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Genre {
|
||||
pub tmdb_id: u32,
|
||||
pub name: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Keyword {
|
||||
pub tmdb_id: u32,
|
||||
pub name: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct CastMember {
|
||||
pub tmdb_person_id: u64,
|
||||
pub name: String,
|
||||
pub character: String,
|
||||
pub billing_order: u32,
|
||||
pub profile_path: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct CrewMember {
|
||||
pub tmdb_person_id: u64,
|
||||
pub name: String,
|
||||
pub job: String,
|
||||
pub department: String,
|
||||
pub profile_path: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct MovieProfile {
|
||||
pub movie_id: MovieId,
|
||||
pub tmdb_id: u64,
|
||||
pub imdb_id: Option<String>,
|
||||
pub overview: Option<String>,
|
||||
pub tagline: Option<String>,
|
||||
pub runtime_minutes: Option<u32>,
|
||||
pub budget_usd: Option<i64>,
|
||||
pub revenue_usd: Option<i64>,
|
||||
pub vote_average: Option<f64>,
|
||||
pub vote_count: Option<u32>,
|
||||
pub original_language: Option<String>,
|
||||
pub collection_name: Option<String>,
|
||||
pub genres: Vec<Genre>,
|
||||
pub keywords: Vec<Keyword>,
|
||||
pub cast: Vec<CastMember>,
|
||||
pub crew: Vec<CrewMember>,
|
||||
pub enriched_at: DateTime<Utc>,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user