Added apis
This commit is contained in:
@@ -6,6 +6,7 @@ edition = "2021"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
como_domain = { path = "../como_domain" }
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
axum = "0.5.1"
|
||||
|
||||
|
@@ -1,8 +1,11 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use como_domain::item::{requests::CreateItemDto, responses::CreatedItemDto};
|
||||
|
||||
pub type DynItemService = Arc<dyn ItemService + Send + Sync>;
|
||||
|
||||
#[async_trait]
|
||||
pub trait ItemService {}
|
||||
pub trait ItemService {
|
||||
async fn add_item(&self, item: CreateItemDto) -> anyhow::Result<CreatedItemDto>;
|
||||
}
|
||||
|
@@ -5,4 +5,11 @@ use async_trait::async_trait;
|
||||
pub type DynUserService = Arc<dyn UserService + Send + Sync>;
|
||||
|
||||
#[async_trait]
|
||||
pub trait UserService {}
|
||||
pub trait UserService {
|
||||
async fn add_user(&self, username: String, password: String) -> anyhow::Result<String>;
|
||||
async fn validate_user(
|
||||
&self,
|
||||
username: String,
|
||||
password: String,
|
||||
) -> anyhow::Result<Option<String>>;
|
||||
}
|
||||
|
Reference in New Issue
Block a user