domain ports: CQRS-split traits for all bounded contexts
This commit is contained in:
21
crates/domain/src/ports/settings.rs
Normal file
21
crates/domain/src/ports/settings.rs
Normal file
@@ -0,0 +1,21 @@
|
||||
//! Application settings port.
|
||||
//!
|
||||
//! Key-value admin configuration (e.g. `library_sync_interval_hours`).
|
||||
//! Small enough to keep as a single trait rather than CQRS split.
|
||||
|
||||
use async_trait::async_trait;
|
||||
|
||||
use crate::errors::DomainResult;
|
||||
|
||||
/// Port for general admin settings persistence (`app_settings` table).
|
||||
#[async_trait]
|
||||
pub trait AppSettingsRepository: Send + Sync {
|
||||
/// Get a setting value by key. Returns `None` if not set.
|
||||
async fn get(&self, key: &str) -> DomainResult<Option<String>>;
|
||||
|
||||
/// Set a setting value (upsert).
|
||||
async fn set(&self, key: &str, value: &str) -> DomainResult<()>;
|
||||
|
||||
/// Get all settings as (key, value) pairs.
|
||||
async fn get_all(&self) -> DomainResult<Vec<(String, String)>>;
|
||||
}
|
||||
Reference in New Issue
Block a user