From 23722a771bfe42cafbf07f9c253a5a3c9e201044 Mon Sep 17 00:00:00 2001 From: Gabriel Kaszewski Date: Fri, 20 Mar 2026 01:13:00 +0100 Subject: [PATCH] feat(domain): add ShowSummary, SeasonSummary types + ILibraryRepository methods --- k-tv-backend/domain/src/library.rs | 31 ++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/k-tv-backend/domain/src/library.rs b/k-tv-backend/domain/src/library.rs index cc0ce96..a8eae12 100644 --- a/k-tv-backend/domain/src/library.rs +++ b/k-tv-backend/domain/src/library.rs @@ -67,6 +67,7 @@ pub struct LibrarySearchFilter { pub min_duration_secs: Option, pub max_duration_secs: Option, pub search_term: Option, + pub season_number: Option, pub offset: u32, pub limit: u32, } @@ -83,12 +84,31 @@ impl Default for LibrarySearchFilter { min_duration_secs: None, max_duration_secs: None, search_term: None, + season_number: None, offset: 0, limit: 50, } } } +/// Aggregated summary of a TV show derived from synced episodes. +#[derive(Debug, Clone)] +pub struct ShowSummary { + pub series_name: String, + pub episode_count: u32, + pub season_count: u32, + pub thumbnail_url: Option, + pub genres: Vec, +} + +/// Aggregated summary of one season of a TV show. +#[derive(Debug, Clone)] +pub struct SeasonSummary { + pub season_number: u32, + pub episode_count: u32, + pub thumbnail_url: Option, +} + /// Port: sync one provider's items into the library repo. /// DB writes are handled entirely inside implementations — no pool in the trait. #[async_trait] @@ -114,6 +134,17 @@ pub trait ILibraryRepository: Send + Sync { async fn log_sync_finish(&self, log_id: i64, result: &LibrarySyncResult) -> DomainResult<()>; async fn latest_sync_status(&self) -> DomainResult>; async fn is_sync_running(&self, provider_id: &str) -> DomainResult; + async fn list_shows( + &self, + provider_id: Option<&str>, + search_term: Option<&str>, + genres: &[String], + ) -> DomainResult>; + async fn list_seasons( + &self, + series_name: &str, + provider_id: Option<&str>, + ) -> DomainResult>; } #[cfg(test)]