collapse 20 pass-through use cases; handlers call ports directly
delete get/list/list_by_owner channels, get_settings/activity_log admin, get_item/get_sync_status/list_collections/list_seasons/list_shows/list_genres library, get/list/delete providers, get/list/patch_label config_snapshots, get_active/list_history/delete_after schedule — all single-delegation. remove ChannelQueryDeps, LibraryQueryDeps, deleted query/command structs. add direct port fields to AppState. update MCP crate accordingly.
This commit is contained in:
@@ -1,31 +1,27 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use application::channels::{
|
||||
ChannelCommandDeps, ChannelQueryDeps, CreateChannelCommand, DeleteChannelCommand,
|
||||
GetChannelQuery, ListByOwnerQuery, UpdateChannelCommand,
|
||||
ChannelCommandDeps, CreateChannelCommand, DeleteChannelCommand, UpdateChannelCommand,
|
||||
};
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::error::{domain_err, ok_json};
|
||||
|
||||
pub async fn list_channels(
|
||||
query_deps: &Arc<ChannelQueryDeps>,
|
||||
channel_query: &Arc<dyn domain::ports::ChannelQuery>,
|
||||
owner_id: Uuid,
|
||||
) -> String {
|
||||
let query = ListByOwnerQuery {
|
||||
owner_id: owner_id.into(),
|
||||
};
|
||||
match application::channels::list_by_owner::execute(query_deps, query).await {
|
||||
match channel_query.find_by_owner(owner_id.into()).await {
|
||||
Ok(channels) => ok_json(&channels),
|
||||
Err(e) => domain_err(e),
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn get_channel(query_deps: &Arc<ChannelQueryDeps>, id: Uuid) -> String {
|
||||
let query = GetChannelQuery {
|
||||
channel_id: id.into(),
|
||||
};
|
||||
match application::channels::get::execute(query_deps, query).await {
|
||||
pub async fn get_channel(
|
||||
channel_query: &Arc<dyn domain::ports::ChannelQuery>,
|
||||
id: Uuid,
|
||||
) -> String {
|
||||
match channel_query.find_by_id(id.into()).await {
|
||||
Ok(Some(channel)) => ok_json(&channel),
|
||||
Ok(None) => serde_json::json!({"error": "Channel not found"}).to_string(),
|
||||
Err(e) => domain_err(e),
|
||||
|
||||
Reference in New Issue
Block a user