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

@@ -34,6 +34,28 @@ pub struct Channel {
updated_at: DateTime<Utc>,
}
pub struct ChannelRow {
pub id: ChannelId,
pub owner_id: UserId,
pub name: String,
pub description: Option<String>,
pub timezone: String,
pub schedule_config: ScheduleConfig,
pub recycle_policy: RecyclePolicy,
pub auto_schedule: bool,
pub access_mode: AccessMode,
pub access_password_hash: Option<String>,
pub logo: Option<String>,
pub logo_position: LogoPosition,
pub logo_opacity: f32,
pub webhook_url: Option<String>,
pub webhook_poll_interval_secs: u32,
pub webhook_body_template: Option<String>,
pub webhook_headers: Option<String>,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}
impl Channel {
pub fn new(
owner_id: UserId,
@@ -64,47 +86,27 @@ impl Channel {
}
}
pub fn from_persistence(
id: ChannelId,
owner_id: UserId,
name: String,
description: Option<String>,
timezone: String,
schedule_config: ScheduleConfig,
recycle_policy: RecyclePolicy,
auto_schedule: bool,
access_mode: AccessMode,
access_password_hash: Option<String>,
logo: Option<String>,
logo_position: LogoPosition,
logo_opacity: f32,
webhook_url: Option<String>,
webhook_poll_interval_secs: u32,
webhook_body_template: Option<String>,
webhook_headers: Option<String>,
created_at: DateTime<Utc>,
updated_at: DateTime<Utc>,
) -> Self {
pub fn from_persistence(row: ChannelRow) -> Self {
Self {
id,
owner_id,
name,
description,
timezone,
schedule_config,
recycle_policy,
auto_schedule,
access_mode,
access_password_hash,
logo,
logo_position,
logo_opacity,
webhook_url,
webhook_poll_interval_secs,
webhook_body_template,
webhook_headers,
created_at,
updated_at,
id: row.id,
owner_id: row.owner_id,
name: row.name,
description: row.description,
timezone: row.timezone,
schedule_config: row.schedule_config,
recycle_policy: row.recycle_policy,
auto_schedule: row.auto_schedule,
access_mode: row.access_mode,
access_password_hash: row.access_password_hash,
logo: row.logo,
logo_position: row.logo_position,
logo_opacity: row.logo_opacity,
webhook_url: row.webhook_url,
webhook_poll_interval_secs: row.webhook_poll_interval_secs,
webhook_body_template: row.webhook_body_template,
webhook_headers: row.webhook_headers,
created_at: row.created_at,
updated_at: row.updated_at,
}
}