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:
@@ -12,7 +12,9 @@ pub async fn list_channels(
|
||||
query_deps: &Arc<ChannelQueryDeps>,
|
||||
owner_id: Uuid,
|
||||
) -> String {
|
||||
let query = ListByOwnerQuery { owner_id };
|
||||
let query = ListByOwnerQuery {
|
||||
owner_id: owner_id.into(),
|
||||
};
|
||||
match application::channels::list_by_owner::execute(query_deps, query).await {
|
||||
Ok(channels) => ok_json(&channels),
|
||||
Err(e) => domain_err(e),
|
||||
@@ -20,7 +22,9 @@ pub async fn list_channels(
|
||||
}
|
||||
|
||||
pub async fn get_channel(query_deps: &Arc<ChannelQueryDeps>, id: Uuid) -> String {
|
||||
let query = GetChannelQuery { channel_id: id };
|
||||
let query = GetChannelQuery {
|
||||
channel_id: id.into(),
|
||||
};
|
||||
match application::channels::get::execute(query_deps, query).await {
|
||||
Ok(Some(channel)) => ok_json(&channel),
|
||||
Ok(None) => serde_json::json!({"error": "Channel not found"}).to_string(),
|
||||
@@ -35,7 +39,7 @@ pub async fn create_channel(
|
||||
timezone: &str,
|
||||
) -> String {
|
||||
let cmd = CreateChannelCommand {
|
||||
owner_id,
|
||||
owner_id: owner_id.into(),
|
||||
name: name.to_string(),
|
||||
timezone: timezone.to_string(),
|
||||
};
|
||||
@@ -55,8 +59,8 @@ pub async fn update_channel(
|
||||
schedule_config: Option<domain::ScheduleConfig>,
|
||||
) -> String {
|
||||
let cmd = UpdateChannelCommand {
|
||||
channel_id,
|
||||
owner_id,
|
||||
channel_id: channel_id.into(),
|
||||
owner_id: owner_id.into(),
|
||||
name,
|
||||
description: description.map(Some),
|
||||
timezone,
|
||||
@@ -76,8 +80,8 @@ pub async fn delete_channel(
|
||||
owner_id: Uuid,
|
||||
) -> String {
|
||||
let cmd = DeleteChannelCommand {
|
||||
channel_id,
|
||||
owner_id,
|
||||
channel_id: channel_id.into(),
|
||||
owner_id: owner_id.into(),
|
||||
};
|
||||
match application::channels::delete::execute(cmd_deps, cmd).await {
|
||||
Ok(()) => serde_json::json!({"deleted": channel_id}).to_string(),
|
||||
|
||||
Reference in New Issue
Block a user