fix(presentation): extract 12 handler violations to use cases
- TokenService port + JwtTokenService adapter; login/refresh return LoginResult - delete get_token (dup of login); create_tokens helper removed - type UpdateChannelRequest schedule_config/recycle_policy (no serde_json::Value) - update_settings returns updated Vec; handler calls one use case - config use case in application::config; handler maps DTO only - SyncStatusEntry moved to api-types w/ From<LibrarySyncLogEntry> - trigger_sync: Conflict error, drop sync_trigger.send from handler - UpsertProviderCommand.config accepts Value; serialization in use case - get_current_broadcast returns BroadcastWithChannel; one call - get_stream_url resolves broadcast internally; handler single call
This commit is contained in:
@@ -4,6 +4,7 @@ use application::{
|
||||
admin::AdminDeps,
|
||||
auth::AuthDeps,
|
||||
channels::{ChannelCommandDeps, ChannelQueryDeps},
|
||||
config::ConfigDeps,
|
||||
config_snapshots::ConfigSnapshotDeps,
|
||||
iptv::IptvDeps,
|
||||
library::{LibraryCommandDeps, LibraryQueryDeps},
|
||||
@@ -46,12 +47,23 @@ pub async fn build_app_state(config: Config) -> anyhow::Result<AppState> {
|
||||
#[cfg(feature = "auth-jwt")]
|
||||
let jwt_validator = build_jwt_validator(&config)?;
|
||||
|
||||
#[cfg(feature = "auth-jwt")]
|
||||
let token_service: Arc<dyn domain::ports::TokenService> = {
|
||||
let validator = jwt_validator
|
||||
.as_ref()
|
||||
.expect("JWT validator required")
|
||||
.as_ref()
|
||||
.clone();
|
||||
Arc::new(adapter_auth::JwtTokenService::new(validator))
|
||||
};
|
||||
|
||||
let (sync_tx, sync_rx) = tokio::sync::watch::channel(());
|
||||
|
||||
let auth_deps = Arc::new(AuthDeps {
|
||||
user_command: wire_output.user_command.clone(),
|
||||
user_query: wire_output.user_query.clone(),
|
||||
auth_service,
|
||||
token_service,
|
||||
event_publisher: event_publisher.clone(),
|
||||
});
|
||||
|
||||
@@ -105,6 +117,18 @@ pub async fn build_app_state(config: Config) -> anyhow::Result<AppState> {
|
||||
provider_config_query: wire_output.provider_config_query.clone(),
|
||||
});
|
||||
|
||||
let mut available_provider_types = Vec::new();
|
||||
#[cfg(feature = "jellyfin")]
|
||||
available_provider_types.push("jellyfin".to_string());
|
||||
#[cfg(feature = "local-files")]
|
||||
available_provider_types.push("local_files".to_string());
|
||||
|
||||
let config_deps = Arc::new(ConfigDeps {
|
||||
provider_registry: provider_registry.clone(),
|
||||
allow_registration: config.allow_registration,
|
||||
available_provider_types,
|
||||
});
|
||||
|
||||
let config_arc = Arc::new(config);
|
||||
|
||||
let bg_schedule_deps = schedule_deps.clone();
|
||||
@@ -140,6 +164,7 @@ pub async fn build_app_state(config: Config) -> anyhow::Result<AppState> {
|
||||
channel_command_deps,
|
||||
channel_query_deps,
|
||||
config_snapshot_deps,
|
||||
config_deps,
|
||||
schedule_deps,
|
||||
library_command_deps,
|
||||
library_query_deps,
|
||||
@@ -148,12 +173,11 @@ pub async fn build_app_state(config: Config) -> anyhow::Result<AppState> {
|
||||
provider_deps,
|
||||
#[cfg(feature = "auth-jwt")]
|
||||
jwt_validator,
|
||||
provider_registry,
|
||||
_library_sync: library_sync,
|
||||
_settings_repo: wire_output.settings,
|
||||
_event_bus: event_bus,
|
||||
config: config_arc,
|
||||
sync_trigger: sync_tx,
|
||||
_sync_trigger: sync_tx,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user