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:
@@ -60,10 +60,6 @@ async fn main() -> anyhow::Result<()> {
|
||||
event_publisher: event_publisher.clone(),
|
||||
});
|
||||
|
||||
let channel_query_deps = Arc::new(application::channels::ChannelQueryDeps {
|
||||
channel_query: wire.channel_query.clone(),
|
||||
});
|
||||
|
||||
let schedule_deps = Arc::new(application::schedule::ScheduleDeps {
|
||||
schedule_engine,
|
||||
channel_query: wire.channel_query.clone(),
|
||||
@@ -73,15 +69,24 @@ async fn main() -> anyhow::Result<()> {
|
||||
provider_registry: provider_registry.clone(),
|
||||
});
|
||||
|
||||
let library_query_deps = Arc::new(application::library::LibraryQueryDeps {
|
||||
let library_sync: Arc<dyn domain::ports::LibrarySyncAdapter> =
|
||||
Arc::new(NoopLibrarySync);
|
||||
|
||||
let library_command_deps = Arc::new(application::library::LibraryCommandDeps {
|
||||
library_command: wire.library_command.clone(),
|
||||
library_query: wire.library_query.clone(),
|
||||
library_sync,
|
||||
provider_registry: provider_registry.clone(),
|
||||
event_publisher: event_publisher.clone(),
|
||||
});
|
||||
|
||||
let server = KTvMcpServer {
|
||||
channel_cmd_deps,
|
||||
channel_query_deps,
|
||||
channel_query: wire.channel_query.clone(),
|
||||
schedule_deps,
|
||||
library_query_deps,
|
||||
schedule_query: wire.schedule_query.clone(),
|
||||
library_query: wire.library_query.clone(),
|
||||
library_command_deps,
|
||||
owner_id,
|
||||
};
|
||||
|
||||
@@ -103,6 +108,7 @@ struct WireOutput {
|
||||
channel_query: Arc<dyn domain::ports::ChannelQuery>,
|
||||
schedule_command: Arc<dyn domain::ports::ScheduleCommand>,
|
||||
schedule_query: Arc<dyn domain::ports::ScheduleQuery>,
|
||||
library_command: Arc<dyn domain::ports::LibraryCommand>,
|
||||
library_query: Arc<dyn domain::ports::LibraryQuery>,
|
||||
}
|
||||
|
||||
@@ -116,6 +122,7 @@ fn wire_repositories(pool: &DbPool) -> anyhow::Result<WireOutput> {
|
||||
channel_query: w.channel_query,
|
||||
schedule_command: w.schedule_command,
|
||||
schedule_query: w.schedule_query,
|
||||
library_command: w.library_command,
|
||||
library_query: w.library_query,
|
||||
})
|
||||
}
|
||||
@@ -325,3 +332,16 @@ impl IProviderRegistry for SimpleProviderRegistry {
|
||||
provider.list_genres(content_type).await
|
||||
}
|
||||
}
|
||||
|
||||
struct NoopLibrarySync;
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl domain::ports::LibrarySyncAdapter for NoopLibrarySync {
|
||||
async fn sync_provider(
|
||||
&self,
|
||||
_provider: &dyn IMediaProvider,
|
||||
provider_id: &str,
|
||||
) -> domain::LibrarySyncResult {
|
||||
domain::LibrarySyncResult::with_error(provider_id, 0, "MCP does not support sync")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user