application: config_snapshots, admin, providers, iptv

This commit is contained in:
2026-07-12 02:14:07 +02:00
parent ebf0614fdf
commit 466d34b5d0
37 changed files with 895 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
use domain::models::ChannelConfigSnapshot;
use domain::value_objects::ChannelId;
use domain::{DomainError, DomainResult};
use super::commands::SaveSnapshotCommand;
use super::deps::ConfigSnapshotDeps;
/// Save a snapshot of the channel's current schedule config.
///
/// Flow: find channel -> snapshot its current config -> return snapshot.
pub async fn execute(
deps: &ConfigSnapshotDeps,
cmd: SaveSnapshotCommand,
) -> DomainResult<ChannelConfigSnapshot> {
let channel_id = ChannelId::from(cmd.channel_id);
let channel = deps
.channel_query
.find_by_id(channel_id)
.await?
.ok_or(DomainError::ChannelNotFound(cmd.channel_id))?;
deps.channel_command
.save_config_snapshot(channel_id, channel.schedule_config(), cmd.label)
.await
}
#[cfg(test)]
#[path = "tests/save.rs"]
mod tests;