refactor(domain): Row structs for from_persistence, ID newtypes, kill clippy.toml
- delete clippy.toml (too-many-arguments-threshold=20 hack) - ChannelRow/MediaItemRow/LibraryItemRow structs for from_persistence - SnapshotId/ActivityEventId/PlaybackRecordId newtypes - DomainError variants use ChannelId/UserId instead of Uuid - ActivityEvent.channel_id: Option<ChannelId> not Option<Uuid> - InMemory repos key on newtype IDs - AlgorithmicParams struct for schedule engine - update all adapters/application/presentation callers
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
use domain::models::Channel;
|
||||
use domain::value_objects::ChannelId;
|
||||
use domain::{DomainError, DomainResult};
|
||||
|
||||
use super::commands::RestoreSnapshotCommand;
|
||||
@@ -9,11 +8,9 @@ pub async fn execute(
|
||||
deps: &ConfigSnapshotDeps,
|
||||
cmd: RestoreSnapshotCommand,
|
||||
) -> DomainResult<Channel> {
|
||||
let channel_id = ChannelId::from(cmd.channel_id);
|
||||
|
||||
let snapshot = deps
|
||||
.channel_query
|
||||
.get_config_snapshot(channel_id, cmd.snapshot_id)
|
||||
.get_config_snapshot(cmd.channel_id, cmd.snapshot_id)
|
||||
.await?
|
||||
.ok_or(DomainError::ValidationError(format!(
|
||||
"Snapshot {} not found",
|
||||
@@ -22,12 +19,12 @@ pub async fn execute(
|
||||
|
||||
let mut channel = deps
|
||||
.channel_query
|
||||
.find_by_id(channel_id)
|
||||
.find_by_id(cmd.channel_id)
|
||||
.await?
|
||||
.ok_or(DomainError::ChannelNotFound(cmd.channel_id))?;
|
||||
|
||||
deps.channel_command
|
||||
.save_config_snapshot(channel_id, channel.schedule_config(), None)
|
||||
.save_config_snapshot(cmd.channel_id, channel.schedule_config(), None)
|
||||
.await?;
|
||||
|
||||
channel.set_schedule_config(snapshot.config().clone());
|
||||
|
||||
Reference in New Issue
Block a user