refactor(application): strip comments, DRY ownership check + parse_content_type
This commit is contained in:
@@ -5,10 +5,6 @@ use domain::{DomainError, DomainResult};
|
||||
use super::commands::RestoreSnapshotCommand;
|
||||
use super::deps::ConfigSnapshotDeps;
|
||||
|
||||
/// Restore a channel's config from a snapshot.
|
||||
///
|
||||
/// Flow: find snapshot -> find channel -> snapshot current config (backup) ->
|
||||
/// apply snapshot config to channel -> save channel -> return updated channel.
|
||||
pub async fn execute(
|
||||
deps: &ConfigSnapshotDeps,
|
||||
cmd: RestoreSnapshotCommand,
|
||||
@@ -30,12 +26,10 @@ pub async fn execute(
|
||||
.await?
|
||||
.ok_or(DomainError::ChannelNotFound(cmd.channel_id))?;
|
||||
|
||||
// Auto-snapshot the current config before overwriting
|
||||
deps.channel_command
|
||||
.save_config_snapshot(channel_id, channel.schedule_config(), None)
|
||||
.await?;
|
||||
|
||||
// Apply the snapshot's config
|
||||
channel.set_schedule_config(snapshot.config().clone());
|
||||
deps.channel_command.save(&channel).await?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user