application: config_snapshots, admin, providers, iptv
This commit is contained in:
18
crates/application/src/admin/update_settings.rs
Normal file
18
crates/application/src/admin/update_settings.rs
Normal file
@@ -0,0 +1,18 @@
|
||||
use domain::DomainResult;
|
||||
|
||||
use super::commands::UpdateSettingsCommand;
|
||||
use super::deps::AdminDeps;
|
||||
|
||||
/// Update one or more admin settings.
|
||||
///
|
||||
/// Iterates key/value pairs and upserts each one.
|
||||
pub async fn execute(deps: &AdminDeps, cmd: UpdateSettingsCommand) -> DomainResult<()> {
|
||||
for (key, value) in &cmd.settings {
|
||||
deps.settings_repo.set(key, value).await?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "tests/update_settings.rs"]
|
||||
mod tests;
|
||||
Reference in New Issue
Block a user