fix(presentation): extract 12 handler violations to use cases

- TokenService port + JwtTokenService adapter; login/refresh return LoginResult
- delete get_token (dup of login); create_tokens helper removed
- type UpdateChannelRequest schedule_config/recycle_policy (no serde_json::Value)
- update_settings returns updated Vec; handler calls one use case
- config use case in application::config; handler maps DTO only
- SyncStatusEntry moved to api-types w/ From<LibrarySyncLogEntry>
- trigger_sync: Conflict error, drop sync_trigger.send from handler
- UpsertProviderCommand.config accepts Value; serialization in use case
- get_current_broadcast returns BroadcastWithChannel; one call
- get_stream_url resolves broadcast internally; handler single call
This commit is contained in:
2026-07-12 05:28:49 +02:00
parent 9b18d3ff6d
commit 33b440d297
44 changed files with 414 additions and 280 deletions

View File

@@ -18,13 +18,15 @@ pub struct CreateChannelRequest {
pub webhook_headers: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[derive(Debug, Clone, Deserialize, ToSchema)]
pub struct UpdateChannelRequest {
pub name: Option<String>,
pub description: Option<String>,
pub timezone: Option<String>,
pub schedule_config: Option<serde_json::Value>,
pub recycle_policy: Option<serde_json::Value>,
#[schema(value_type = Option<Object>)]
pub schedule_config: Option<domain::models::ScheduleConfigCompat>,
#[schema(value_type = Option<Object>)]
pub recycle_policy: Option<domain::RecyclePolicy>,
pub auto_schedule: Option<bool>,
pub access_mode: Option<String>,
pub access_password: Option<String>,

View File

@@ -20,7 +20,7 @@ pub use config::{ConfigResponse, ProviderCapabilitiesResponse, ProviderInfo};
pub use iptv::IptvParams;
pub use library::{
CollectionResponse, GenresParams, LibraryItemResponse, LibrarySearchParams, ProviderParam,
SeasonResponse, SeasonsParams, ShowResponse, ShowsParams,
SeasonResponse, SeasonsParams, ShowResponse, ShowsParams, SyncStatusEntry,
};
pub use providers::{ProviderConfigRequest, ProviderConfigResponse};
pub use schedule::{

View File

@@ -103,6 +103,29 @@ impl From<domain::SeasonSummary> for SeasonResponse {
}
}
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct SyncStatusEntry {
pub provider_id: String,
pub started_at: String,
pub finished_at: String,
pub items_found: u32,
pub status: String,
pub error_msg: String,
}
impl From<domain::LibrarySyncLogEntry> for SyncStatusEntry {
fn from(e: domain::LibrarySyncLogEntry) -> Self {
Self {
provider_id: e.provider_id().to_string(),
started_at: e.started_at().to_string(),
finished_at: e.finished_at().unwrap_or("").to_string(),
items_found: e.items_found(),
status: e.status().to_string(),
error_msg: e.error_msg().unwrap_or("").to_string(),
}
}
}
#[derive(Debug, Deserialize, ToSchema)]
pub struct LibrarySearchParams {
pub provider: Option<String>,