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:
2026-07-12 05:00:49 +02:00
parent 031cba5cfb
commit c0e685a4ee
65 changed files with 684 additions and 695 deletions

View File

@@ -1,7 +1,7 @@
use std::sync::Arc;
use domain::testing::{InMemoryChannelRepository, NoopEventPublisher};
use domain::value_objects::UserId;
use domain::value_objects::{ChannelId, UserId};
use domain::DomainError;
use crate::channels::commands::{CreateChannelCommand, UpdateChannelCommand};
@@ -26,7 +26,7 @@ async fn updates_channel_name() {
let channel = create::execute(
&deps,
CreateChannelCommand {
owner_id: owner.value(),
owner_id: owner,
name: "Original".into(),
timezone: "UTC".into(),
},
@@ -37,8 +37,8 @@ async fn updates_channel_name() {
let updated = update::execute(
&deps,
UpdateChannelCommand {
channel_id: channel.id().value(),
owner_id: owner.value(),
channel_id: channel.id(),
owner_id: owner,
name: Some("Renamed".into()),
description: None,
timezone: None,
@@ -63,7 +63,7 @@ async fn update_fails_if_not_owner() {
let channel = create::execute(
&deps,
CreateChannelCommand {
owner_id: owner.value(),
owner_id: owner,
name: "Protected".into(),
timezone: "UTC".into(),
},
@@ -74,8 +74,8 @@ async fn update_fails_if_not_owner() {
let result = update::execute(
&deps,
UpdateChannelCommand {
channel_id: channel.id().value(),
owner_id: stranger.value(),
channel_id: channel.id(),
owner_id: stranger,
name: Some("Hacked".into()),
description: None,
timezone: None,
@@ -100,8 +100,8 @@ async fn update_nonexistent_channel_returns_not_found() {
let result = update::execute(
&deps,
UpdateChannelCommand {
channel_id: uuid::Uuid::new_v4(),
owner_id: uuid::Uuid::new_v4(),
channel_id: ChannelId::generate(),
owner_id: UserId::generate(),
name: Some("Ghost".into()),
description: None,
timezone: None,
@@ -127,7 +127,7 @@ async fn update_config_creates_snapshot() {
let channel = create::execute(
&deps,
CreateChannelCommand {
owner_id: owner.value(),
owner_id: owner,
name: "Snapshotted".into(),
timezone: "UTC".into(),
},
@@ -140,8 +140,8 @@ async fn update_config_creates_snapshot() {
update::execute(
&deps,
UpdateChannelCommand {
channel_id: channel.id().value(),
owner_id: owner.value(),
channel_id: channel.id(),
owner_id: owner,
name: None,
description: None,
timezone: None,
@@ -167,7 +167,7 @@ async fn update_without_config_skips_snapshot() {
let channel = create::execute(
&deps,
CreateChannelCommand {
owner_id: owner.value(),
owner_id: owner,
name: "NoSnapshot".into(),
timezone: "UTC".into(),
},
@@ -179,8 +179,8 @@ async fn update_without_config_skips_snapshot() {
update::execute(
&deps,
UpdateChannelCommand {
channel_id: channel.id().value(),
owner_id: owner.value(),
channel_id: channel.id(),
owner_id: owner,
name: Some("Renamed".into()),
description: None,
timezone: None,
@@ -205,7 +205,7 @@ async fn update_description_clear() {
let channel = create::execute(
&deps,
CreateChannelCommand {
owner_id: owner.value(),
owner_id: owner,
name: "Desc Test".into(),
timezone: "UTC".into(),
},
@@ -217,8 +217,8 @@ async fn update_description_clear() {
let updated = update::execute(
&deps,
UpdateChannelCommand {
channel_id: channel.id().value(),
owner_id: owner.value(),
channel_id: channel.id(),
owner_id: owner,
name: None,
description: Some(Some("A description".into())),
timezone: None,
@@ -235,8 +235,8 @@ async fn update_description_clear() {
let cleared = update::execute(
&deps,
UpdateChannelCommand {
channel_id: channel.id().value(),
owner_id: owner.value(),
channel_id: channel.id(),
owner_id: owner,
name: None,
description: Some(None),
timezone: None,