1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use async_trait::async_trait;
use super::DataError;
use crate::asset::Asset;
use crate::currency::Currency;
#[async_trait]
pub trait AssetHandler {
async fn insert_asset(&self, asset: &Asset) -> Result<usize, DataError>;
async fn insert_asset_if_new(
&self,
asset: &Asset,
rename_asset: bool,
) -> Result<usize, DataError>;
async fn get_asset_id(&self, asset: &Asset) -> Option<usize>;
async fn get_asset_by_id(&self, id: usize) -> Result<Asset, DataError>;
async fn get_asset_by_isin(&self, id: &str) -> Result<Asset, DataError>;
async fn get_all_assets(&self) -> Result<Vec<Asset>, DataError>;
async fn update_asset(&self, asset: &Asset) -> Result<(), DataError>;
async fn delete_asset(&self, id: usize) -> Result<(), DataError>;
async fn get_all_currencies(&self) -> Result<Vec<Currency>, DataError>;
}