22
crates/como_core/src/users/mod.rs
Normal file
22
crates/como_core/src/users/mod.rs
Normal file
@@ -0,0 +1,22 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use como_domain::Context;
|
||||
|
||||
pub type DynUserService = Arc<dyn UserService + Send + Sync>;
|
||||
|
||||
#[async_trait]
|
||||
pub trait UserService {
|
||||
async fn add_user(
|
||||
&self,
|
||||
context: &Context,
|
||||
username: String,
|
||||
password: String,
|
||||
) -> anyhow::Result<String>;
|
||||
async fn validate_user(
|
||||
&self,
|
||||
context: &Context,
|
||||
username: String,
|
||||
password: String,
|
||||
) -> anyhow::Result<Option<String>>;
|
||||
}
|
Reference in New Issue
Block a user