feat: working projects and items

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
2023-05-28 17:17:22 +02:00
parent 6dc0c24443
commit 12c7c8f6ee
10 changed files with 98 additions and 39 deletions

View File

@@ -1,18 +1,21 @@
use std::sync::Arc;
use async_trait::async_trait;
use como_domain::item::{
queries::{GetItemQuery, GetItemsQuery},
requests::CreateItemDto,
responses::CreatedItemDto,
ItemDto,
use como_domain::{
item::{
queries::{GetItemQuery, GetItemsQuery},
requests::CreateItemDto,
responses::CreatedItemDto,
ItemDto,
},
users::User,
};
pub type DynItemService = Arc<dyn ItemService + Send + Sync>;
#[async_trait]
pub trait ItemService {
async fn add_item(&self, item: CreateItemDto) -> anyhow::Result<CreatedItemDto>;
async fn get_item(&self, query: GetItemQuery) -> anyhow::Result<ItemDto>;
async fn get_items(&self, query: GetItemsQuery) -> anyhow::Result<Vec<ItemDto>>;
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>>;
}