como/como_core/src/projects/mod.rs

21 lines
599 B
Rust
Raw Normal View History

2022-10-03 23:00:31 +02:00
use std::sync::Arc;
use async_trait::async_trait;
use como_domain::{
projects::{mutation::CreateProjectMutation, queries::GetProjectQuery, ProjectDto},
users::User,
2022-10-04 22:39:57 +02:00
};
2022-10-03 23:00:31 +02:00
pub type DynProjectService = Arc<dyn ProjectService + Send + Sync>;
#[async_trait]
2022-10-04 22:39:57 +02:00
pub trait ProjectService {
async fn get_project(&self, query: GetProjectQuery) -> anyhow::Result<ProjectDto>;
async fn get_projects(&self, user: &User) -> anyhow::Result<Vec<ProjectDto>>;
async fn create_project(
&self,
name: CreateProjectMutation,
user: &User,
) -> anyhow::Result<ProjectDto>;
2022-10-04 22:39:57 +02:00
}