- 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
23 lines
657 B
Rust
23 lines
657 B
Rust
use domain::models::ProviderConfigRow;
|
|
use domain::DomainResult;
|
|
|
|
use super::commands::UpsertProviderCommand;
|
|
use super::deps::ProviderDeps;
|
|
|
|
pub async fn execute(deps: &ProviderDeps, cmd: UpsertProviderCommand) -> DomainResult<()> {
|
|
let config_json = serde_json::to_string(&cmd.config)
|
|
.map_err(|e| domain::DomainError::ValidationError(format!("Invalid config: {e}")))?;
|
|
let row = ProviderConfigRow::from_persistence(
|
|
cmd.id,
|
|
cmd.provider_type,
|
|
config_json,
|
|
cmd.enabled,
|
|
String::new(),
|
|
);
|
|
deps.provider_config_command.upsert(&row).await
|
|
}
|
|
|
|
#[cfg(test)]
|
|
#[path = "tests/upsert.rs"]
|
|
mod tests;
|