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;