application: config_snapshots, admin, providers, iptv
This commit is contained in:
21
crates/application/src/providers/upsert.rs
Normal file
21
crates/application/src/providers/upsert.rs
Normal file
@@ -0,0 +1,21 @@
|
||||
use domain::models::ProviderConfigRow;
|
||||
use domain::DomainResult;
|
||||
|
||||
use super::commands::UpsertProviderCommand;
|
||||
use super::deps::ProviderDeps;
|
||||
|
||||
/// Insert or update a provider configuration.
|
||||
pub async fn execute(deps: &ProviderDeps, cmd: UpsertProviderCommand) -> DomainResult<()> {
|
||||
let row = ProviderConfigRow::from_persistence(
|
||||
cmd.id,
|
||||
cmd.provider_type,
|
||||
cmd.config_json,
|
||||
cmd.enabled,
|
||||
String::new(),
|
||||
);
|
||||
deps.provider_config_command.upsert(&row).await
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "tests/upsert.rs"]
|
||||
mod tests;
|
||||
Reference in New Issue
Block a user