domain ports: CQRS-split traits for all bounded contexts

This commit is contained in:
2026-07-12 01:23:38 +02:00
parent 616c60e213
commit 0166e829c1
13 changed files with 693 additions and 0 deletions

View 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)>>;
}