Initial commit
This commit is contained in:
commit
dccfa2d4cf
19 changed files with 3156 additions and 0 deletions
24
service/src/lib.rs
Normal file
24
service/src/lib.rs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
use std::{future::Future, sync::Arc};
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ServiceError {
|
||||
#[error("Database query error: {0}")]
|
||||
DatabaseQueryError(#[from] dao::DaoError),
|
||||
|
||||
#[error("Forbidden")]
|
||||
Forbidden,
|
||||
}
|
||||
|
||||
pub trait HelloService {
|
||||
fn hello(&self) -> impl Future<Output = Result<Arc<str>, ServiceError>> + Send;
|
||||
}
|
||||
|
||||
pub trait PermissionService {
|
||||
fn check_permission(
|
||||
&self,
|
||||
privilege: &str,
|
||||
) -> impl Future<Output = Result<(), ServiceError>> + Send;
|
||||
|
||||
fn current_user(&self) -> impl Future<Output = Result<Arc<str>, ServiceError>> + Send;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue