diff --git a/k-tv-backend/api/src/dto.rs b/k-tv-backend/api/src/dto.rs index e182b0b..8b35429 100644 --- a/k-tv-backend/api/src/dto.rs +++ b/k-tv-backend/api/src/dto.rs @@ -114,7 +114,7 @@ pub struct UpdateChannelRequest { pub description: Option, pub timezone: Option, /// Replace the entire schedule config (template import/edit) - pub schedule_config: Option, + pub schedule_config: Option, pub recycle_policy: Option, pub auto_schedule: Option, pub access_mode: Option, diff --git a/k-tv-backend/api/src/poller.rs b/k-tv-backend/api/src/poller.rs index 0867cf7..17ae9f5 100644 --- a/k-tv-backend/api/src/poller.rs +++ b/k-tv-backend/api/src/poller.rs @@ -172,6 +172,10 @@ mod tests { async fn delete(&self, _id: ChannelId) -> DomainResult<()> { unimplemented!() } + async fn save_config_snapshot(&self, _channel_id: ChannelId, _config: &domain::ScheduleConfig, _label: Option) -> DomainResult { unimplemented!() } + async fn list_config_snapshots(&self, _channel_id: ChannelId) -> DomainResult> { unimplemented!() } + async fn get_config_snapshot(&self, _channel_id: ChannelId, _snapshot_id: Uuid) -> DomainResult> { unimplemented!() } + async fn patch_config_snapshot_label(&self, _channel_id: ChannelId, _snapshot_id: Uuid, _label: Option) -> DomainResult> { unimplemented!() } } struct MockScheduleRepo { @@ -213,6 +217,9 @@ mod tests { ) -> DomainResult> { Ok(HashMap::new()) } + async fn list_schedule_history(&self, _channel_id: ChannelId) -> DomainResult> { unimplemented!() } + async fn get_schedule_by_id(&self, _channel_id: ChannelId, _schedule_id: Uuid) -> DomainResult> { unimplemented!() } + async fn delete_schedules_after(&self, _channel_id: ChannelId, _target_generation: u32) -> DomainResult<()> { unimplemented!() } } struct MockRegistry; @@ -437,6 +444,9 @@ mod tests { ) -> DomainResult> { Ok(HashMap::new()) } + async fn list_schedule_history(&self, _: ChannelId) -> DomainResult> { unimplemented!() } + async fn get_schedule_by_id(&self, _: ChannelId, _: Uuid) -> DomainResult> { unimplemented!() } + async fn delete_schedules_after(&self, _: ChannelId, _: u32) -> DomainResult<()> { unimplemented!() } } let now = Utc::now(); diff --git a/k-tv-backend/api/src/routes/channels/crud.rs b/k-tv-backend/api/src/routes/channels/crud.rs index 5201d4a..7cd34d0 100644 --- a/k-tv-backend/api/src/routes/channels/crud.rs +++ b/k-tv-backend/api/src/routes/channels/crud.rs @@ -102,7 +102,7 @@ pub(super) async fn update_channel( channel.timezone = tz; } if let Some(sc) = payload.schedule_config { - channel.schedule_config = sc; + channel.schedule_config = domain::ScheduleConfig::from(sc); } if let Some(rp) = payload.recycle_policy { channel.recycle_policy = rp; diff --git a/k-tv-backend/api/src/routes/channels/schedule.rs b/k-tv-backend/api/src/routes/channels/schedule.rs index dc57dc8..a8b0bc6 100644 --- a/k-tv-backend/api/src/routes/channels/schedule.rs +++ b/k-tv-backend/api/src/routes/channels/schedule.rs @@ -18,7 +18,7 @@ use crate::{ use super::require_owner; -/// Trigger 48-hour schedule generation for a channel, starting from now. +/// Trigger 7-day schedule generation for a channel, starting from now. /// Replaces any existing schedule for the same window. pub(super) async fn generate_schedule( State(state): State, @@ -42,7 +42,7 @@ pub(super) async fn generate_schedule( Ok((StatusCode::CREATED, Json(ScheduleResponse::from(schedule)))) } -/// Return the currently active 48-hour schedule for a channel. +/// Return the currently active 7-day schedule for a channel. /// 404 if no schedule has been generated yet — call POST /:id/schedule first. pub(super) async fn get_active_schedule( State(state): State, diff --git a/k-tv-backend/api/src/scheduler.rs b/k-tv-backend/api/src/scheduler.rs index 6a7bda7..4eb7f54 100644 --- a/k-tv-backend/api/src/scheduler.rs +++ b/k-tv-backend/api/src/scheduler.rs @@ -127,6 +127,10 @@ mod tests { async fn delete(&self, _id: ChannelId) -> DomainResult<()> { unimplemented!() } + async fn save_config_snapshot(&self, _channel_id: ChannelId, _config: &domain::ScheduleConfig, _label: Option) -> DomainResult { unimplemented!() } + async fn list_config_snapshots(&self, _channel_id: ChannelId) -> DomainResult> { unimplemented!() } + async fn get_config_snapshot(&self, _channel_id: ChannelId, _snapshot_id: Uuid) -> DomainResult> { unimplemented!() } + async fn patch_config_snapshot_label(&self, _channel_id: ChannelId, _snapshot_id: Uuid, _label: Option) -> DomainResult> { unimplemented!() } } struct MockScheduleRepo { @@ -168,6 +172,9 @@ mod tests { ) -> DomainResult> { Ok(HashMap::new()) } + async fn list_schedule_history(&self, _channel_id: ChannelId) -> DomainResult> { unimplemented!() } + async fn get_schedule_by_id(&self, _channel_id: ChannelId, _schedule_id: Uuid) -> DomainResult> { unimplemented!() } + async fn delete_schedules_after(&self, _channel_id: ChannelId, _target_generation: u32) -> DomainResult<()> { unimplemented!() } } struct MockRegistry;