This commit is contained in:
@@ -36,6 +36,8 @@ pub trait MovieRepository: Send + Sync {
|
||||
page: &PageParams,
|
||||
filter: &MovieFilter,
|
||||
) -> Result<Paginated<MovieSummary>, DomainError>;
|
||||
/// Returns all movies that have an external_metadata_id set. Used for deduplication.
|
||||
async fn list_movies_with_external_id(&self) -> Result<Vec<Movie>, DomainError>;
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
@@ -68,3 +70,15 @@ pub trait MovieEnrichmentClient: Send + Sync {
|
||||
external_metadata_id: &str,
|
||||
) -> Result<MovieProfile, DomainError>;
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
pub trait MovieDeduplicator: Send + Sync {
|
||||
/// Atomically re-points all foreign keys (reviews, watchlist entries, movie profiles)
|
||||
/// from `old_id` to `canonical_id`, upserts the canonical movie record, then deletes
|
||||
/// the old duplicate. Returns the number of rows re-pointed across all tables.
|
||||
async fn merge_into_canonical(
|
||||
&self,
|
||||
old_id: &MovieId,
|
||||
canonical: &Movie,
|
||||
) -> Result<u64, DomainError>;
|
||||
}
|
||||
|
||||
@@ -74,6 +74,10 @@ pub trait LocalApContentQuery: Send + Sync {
|
||||
) -> Result<Vec<WatchlistWithMovie>, DomainError>;
|
||||
async fn get_review_by_id(&self, review_id: &ReviewId) -> Result<Option<Review>, DomainError>;
|
||||
async fn get_movie_by_id(&self, movie_id: &MovieId) -> Result<Option<Movie>, DomainError>;
|
||||
async fn get_movie_by_external_metadata_id(
|
||||
&self,
|
||||
external_id: &str,
|
||||
) -> Result<Option<Movie>, DomainError>;
|
||||
async fn count_local_posts(&self) -> Result<u64, DomainError>;
|
||||
async fn get_local_reviews_for_movie(
|
||||
&self,
|
||||
@@ -90,4 +94,5 @@ pub trait LocalApContentQuery: Send + Sync {
|
||||
user_id: &UserId,
|
||||
year: u16,
|
||||
) -> Result<Option<(Goal, u32)>, DomainError>;
|
||||
async fn list_goals_for_user(&self, user_id: &UserId) -> Result<Vec<Goal>, DomainError>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user