arch: split ConfigRepository, extract polling, consolidate conversions, decouple protocol
- Value↔JSON: From impls on domain Value behind `json` feature, delete 4 duplicate converters - ConfigRepository split into ConfigRepository (12), UserRepository (3), WidgetStateCache (2) - polling orchestration moved from bootstrap to application::polling_service - WidgetRenderer in client-domain owns scroll/cache, both clients use it - network loop consolidated into client-application::run_connection_loop - protocol crate drops domain dep, Wire↔Domain conversions move to adapters
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use crate::entities::{
|
||||
DataSource, DataSourceId, LayoutPreset, LayoutPresetId, User, WidgetConfig, WidgetId,
|
||||
DataSource, DataSourceId, LayoutPreset, LayoutPresetId, WidgetConfig, WidgetId,
|
||||
};
|
||||
use crate::value_objects::{Layout, ThemeConfig, WidgetState};
|
||||
use crate::value_objects::{Layout, ThemeConfig};
|
||||
use std::future::Future;
|
||||
|
||||
pub trait ConfigRepository {
|
||||
@@ -56,19 +56,4 @@ pub trait ConfigRepository {
|
||||
&self,
|
||||
theme: &ThemeConfig,
|
||||
) -> impl Future<Output = Result<(), Self::Error>> + Send;
|
||||
|
||||
fn get_user_by_username(
|
||||
&self,
|
||||
username: &str,
|
||||
) -> impl Future<Output = Result<Option<User>, Self::Error>> + Send;
|
||||
fn save_user(&self, user: &User) -> impl Future<Output = Result<(), Self::Error>> + Send;
|
||||
fn count_users(&self) -> impl Future<Output = Result<u32, Self::Error>> + Send;
|
||||
|
||||
fn save_widget_states(
|
||||
&self,
|
||||
states: &[(WidgetId, WidgetState)],
|
||||
) -> impl Future<Output = Result<(), Self::Error>> + Send;
|
||||
fn load_widget_states(
|
||||
&self,
|
||||
) -> impl Future<Output = Result<Vec<(WidgetId, WidgetState)>, Self::Error>> + Send;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ mod config_repository;
|
||||
mod data_source_port;
|
||||
mod event;
|
||||
mod secret_store;
|
||||
mod user_repository;
|
||||
mod widget_state_cache;
|
||||
mod widget_state_reader;
|
||||
|
||||
pub use auth::{AuthPort, PasswordHashPort};
|
||||
@@ -14,4 +16,6 @@ pub use config_repository::ConfigRepository;
|
||||
pub use data_source_port::DataSourcePort;
|
||||
pub use event::EventPublisher;
|
||||
pub use secret_store::SecretStore;
|
||||
pub use user_repository::UserRepository;
|
||||
pub use widget_state_cache::WidgetStateCache;
|
||||
pub use widget_state_reader::WidgetStateReader;
|
||||
|
||||
13
crates/domain/src/ports/user_repository.rs
Normal file
13
crates/domain/src/ports/user_repository.rs
Normal file
@@ -0,0 +1,13 @@
|
||||
use crate::entities::User;
|
||||
use std::future::Future;
|
||||
|
||||
pub trait UserRepository {
|
||||
type Error;
|
||||
|
||||
fn get_user_by_username(
|
||||
&self,
|
||||
username: &str,
|
||||
) -> impl Future<Output = Result<Option<User>, Self::Error>> + Send;
|
||||
fn save_user(&self, user: &User) -> impl Future<Output = Result<(), Self::Error>> + Send;
|
||||
fn count_users(&self) -> impl Future<Output = Result<u32, Self::Error>> + Send;
|
||||
}
|
||||
15
crates/domain/src/ports/widget_state_cache.rs
Normal file
15
crates/domain/src/ports/widget_state_cache.rs
Normal file
@@ -0,0 +1,15 @@
|
||||
use crate::entities::WidgetId;
|
||||
use crate::value_objects::WidgetState;
|
||||
use std::future::Future;
|
||||
|
||||
pub trait WidgetStateCache {
|
||||
type Error;
|
||||
|
||||
fn save_widget_states(
|
||||
&self,
|
||||
states: &[(WidgetId, WidgetState)],
|
||||
) -> impl Future<Output = Result<(), Self::Error>> + Send;
|
||||
fn load_widget_states(
|
||||
&self,
|
||||
) -> impl Future<Output = Result<Vec<(WidgetId, WidgetState)>, Self::Error>> + Send;
|
||||
}
|
||||
Reference in New Issue
Block a user