como/crates/como_core/src/projects/mod.rs

25 lines
657 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},
Context,
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,
context: &Context,
query: GetProjectQuery,
) -> anyhow::Result<ProjectDto>;
async fn get_projects(&self, context: &Context) -> anyhow::Result<Vec<ProjectDto>>;
async fn create_project(
&self,
context: &Context,
name: CreateProjectMutation,
) -> anyhow::Result<ProjectDto>;
2022-10-04 22:39:57 +02:00
}