2022-10-03 23:00:31 +02:00
|
|
|
use std::sync::Arc;
|
|
|
|
|
|
|
|
use async_trait::async_trait;
|
2023-05-28 17:17:22 +02:00
|
|
|
use como_domain::{
|
|
|
|
item::{
|
|
|
|
queries::{GetItemQuery, GetItemsQuery},
|
|
|
|
requests::CreateItemDto,
|
|
|
|
responses::CreatedItemDto,
|
|
|
|
ItemDto,
|
|
|
|
},
|
|
|
|
users::User,
|
2022-10-04 22:39:57 +02:00
|
|
|
};
|
2022-10-03 23:00:31 +02:00
|
|
|
|
|
|
|
pub type DynItemService = Arc<dyn ItemService + Send + Sync>;
|
|
|
|
|
|
|
|
#[async_trait]
|
2022-10-04 11:06:48 +02:00
|
|
|
pub trait ItemService {
|
2023-05-28 17:17:22 +02:00
|
|
|
async fn add_item(&self, item: CreateItemDto, user: &User) -> anyhow::Result<CreatedItemDto>;
|
|
|
|
async fn get_item(&self, query: GetItemQuery, user: &User) -> anyhow::Result<ItemDto>;
|
|
|
|
async fn get_items(&self, query: GetItemsQuery, user: &User) -> anyhow::Result<Vec<ItemDto>>;
|
2022-10-04 11:06:48 +02:00
|
|
|
}
|