|
|
|
|
@@ -1,3 +1,4 @@
|
|
|
|
|
use std::future::Future;
|
|
|
|
|
use crate::entities::{
|
|
|
|
|
DataSource, DataSourceId, LayoutPreset, LayoutPresetId, WidgetConfig, WidgetId,
|
|
|
|
|
};
|
|
|
|
|
@@ -6,21 +7,21 @@ use crate::value_objects::Layout;
|
|
|
|
|
pub trait ConfigRepository {
|
|
|
|
|
type Error;
|
|
|
|
|
|
|
|
|
|
async fn get_widget(&self, id: WidgetId) -> Result<Option<WidgetConfig>, Self::Error>;
|
|
|
|
|
async fn list_widgets(&self) -> Result<Vec<WidgetConfig>, Self::Error>;
|
|
|
|
|
async fn save_widget(&self, config: &WidgetConfig) -> Result<(), Self::Error>;
|
|
|
|
|
async fn delete_widget(&self, id: WidgetId) -> Result<(), Self::Error>;
|
|
|
|
|
fn get_widget(&self, id: WidgetId) -> impl Future<Output = Result<Option<WidgetConfig>, Self::Error>> + Send;
|
|
|
|
|
fn list_widgets(&self) -> impl Future<Output = Result<Vec<WidgetConfig>, Self::Error>> + Send;
|
|
|
|
|
fn save_widget(&self, config: &WidgetConfig) -> impl Future<Output = Result<(), Self::Error>> + Send;
|
|
|
|
|
fn delete_widget(&self, id: WidgetId) -> impl Future<Output = Result<(), Self::Error>> + Send;
|
|
|
|
|
|
|
|
|
|
async fn get_data_source(&self, id: DataSourceId) -> Result<Option<DataSource>, Self::Error>;
|
|
|
|
|
async fn list_data_sources(&self) -> Result<Vec<DataSource>, Self::Error>;
|
|
|
|
|
async fn save_data_source(&self, source: &DataSource) -> Result<(), Self::Error>;
|
|
|
|
|
async fn delete_data_source(&self, id: DataSourceId) -> Result<(), Self::Error>;
|
|
|
|
|
fn get_data_source(&self, id: DataSourceId) -> impl Future<Output = Result<Option<DataSource>, Self::Error>> + Send;
|
|
|
|
|
fn list_data_sources(&self) -> impl Future<Output = Result<Vec<DataSource>, Self::Error>> + Send;
|
|
|
|
|
fn save_data_source(&self, source: &DataSource) -> impl Future<Output = Result<(), Self::Error>> + Send;
|
|
|
|
|
fn delete_data_source(&self, id: DataSourceId) -> impl Future<Output = Result<(), Self::Error>> + Send;
|
|
|
|
|
|
|
|
|
|
async fn get_layout(&self) -> Result<Option<Layout>, Self::Error>;
|
|
|
|
|
async fn save_layout(&self, layout: &Layout) -> Result<(), Self::Error>;
|
|
|
|
|
fn get_layout(&self) -> impl Future<Output = Result<Option<Layout>, Self::Error>> + Send;
|
|
|
|
|
fn save_layout(&self, layout: &Layout) -> impl Future<Output = Result<(), Self::Error>> + Send;
|
|
|
|
|
|
|
|
|
|
async fn get_preset(&self, id: LayoutPresetId) -> Result<Option<LayoutPreset>, Self::Error>;
|
|
|
|
|
async fn list_presets(&self) -> Result<Vec<LayoutPreset>, Self::Error>;
|
|
|
|
|
async fn save_preset(&self, preset: &LayoutPreset) -> Result<(), Self::Error>;
|
|
|
|
|
async fn delete_preset(&self, id: LayoutPresetId) -> Result<(), Self::Error>;
|
|
|
|
|
fn get_preset(&self, id: LayoutPresetId) -> impl Future<Output = Result<Option<LayoutPreset>, Self::Error>> + Send;
|
|
|
|
|
fn list_presets(&self) -> impl Future<Output = Result<Vec<LayoutPreset>, Self::Error>> + Send;
|
|
|
|
|
fn save_preset(&self, preset: &LayoutPreset) -> impl Future<Output = Result<(), Self::Error>> + Send;
|
|
|
|
|
fn delete_preset(&self, id: LayoutPresetId) -> impl Future<Output = Result<(), Self::Error>> + Send;
|
|
|
|
|
}
|
|
|
|
|
|