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:
@@ -2,9 +2,7 @@ use axum::Json;
|
||||
use axum::extract::{Path, State};
|
||||
|
||||
use api_types::{ProviderConfigRequest, ProviderConfigResponse};
|
||||
use application::providers::{
|
||||
DeleteProviderCommand, GetProviderQuery, ListProvidersQuery, UpsertProviderCommand,
|
||||
};
|
||||
use application::providers::UpsertProviderCommand;
|
||||
use domain::DomainError;
|
||||
|
||||
use crate::errors::AppError;
|
||||
@@ -15,8 +13,7 @@ pub async fn list_providers(
|
||||
State(state): State<AppState>,
|
||||
AdminUser(_user): AdminUser,
|
||||
) -> Result<Json<Vec<ProviderConfigResponse>>, AppError> {
|
||||
let providers =
|
||||
application::providers::list::execute(&state.provider_deps, ListProvidersQuery).await?;
|
||||
let providers = state.provider_config_query.get_all().await?;
|
||||
Ok(Json(
|
||||
providers
|
||||
.into_iter()
|
||||
@@ -30,8 +27,9 @@ pub async fn get_provider(
|
||||
AdminUser(_user): AdminUser,
|
||||
Path(id): Path<String>,
|
||||
) -> Result<Json<ProviderConfigResponse>, AppError> {
|
||||
let query = GetProviderQuery { id: id.clone() };
|
||||
let provider = application::providers::get::execute(&state.provider_deps, query)
|
||||
let provider = state
|
||||
.provider_config_query
|
||||
.get_by_id(&id)
|
||||
.await?
|
||||
.ok_or_else(|| AppError(DomainError::NotFound(format!("Provider {id} not found"))))?;
|
||||
Ok(Json(ProviderConfigResponse::from(provider)))
|
||||
@@ -58,7 +56,6 @@ pub async fn delete_provider(
|
||||
AdminUser(_user): AdminUser,
|
||||
Path(id): Path<String>,
|
||||
) -> Result<axum::http::StatusCode, AppError> {
|
||||
let cmd = DeleteProviderCommand { id };
|
||||
application::providers::delete::execute(&state.provider_deps, cmd).await?;
|
||||
state.provider_config_command.delete(&id).await?;
|
||||
Ok(axum::http::StatusCode::NO_CONTENT)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user