fix: snapshot existing config before update; rollback returns 200
This commit is contained in:
@@ -44,10 +44,12 @@ impl ChannelService {
|
||||
}
|
||||
|
||||
pub async fn update(&self, channel: Channel) -> DomainResult<Channel> {
|
||||
// Auto-snapshot the config being replaced
|
||||
self.channel_repo
|
||||
.save_config_snapshot(channel.id, &channel.schedule_config, None)
|
||||
.await?;
|
||||
// Auto-snapshot the existing config before overwriting
|
||||
if let Some(existing) = self.channel_repo.find_by_id(channel.id).await? {
|
||||
self.channel_repo
|
||||
.save_config_snapshot(channel.id, &existing.schedule_config, None)
|
||||
.await?;
|
||||
}
|
||||
self.channel_repo.save(&channel).await?;
|
||||
Ok(channel)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user