2022-10-03 23:00:31 +02:00
|
|
|
use std::sync::Arc;
|
|
|
|
|
|
|
|
use async_trait::async_trait;
|
2023-05-28 16:25:25 +02:00
|
|
|
use como_domain::{
|
|
|
|
projects::{mutation::CreateProjectMutation, queries::GetProjectQuery, ProjectDto},
|
2023-06-04 11:02:51 +02:00
|
|
|
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 {
|
2023-06-04 11:02:51 +02:00
|
|
|
async fn get_project(
|
|
|
|
&self,
|
|
|
|
context: &Context,
|
|
|
|
query: GetProjectQuery,
|
|
|
|
) -> anyhow::Result<ProjectDto>;
|
|
|
|
async fn get_projects(&self, context: &Context) -> anyhow::Result<Vec<ProjectDto>>;
|
2023-05-28 16:25:25 +02:00
|
|
|
async fn create_project(
|
|
|
|
&self,
|
2023-06-04 11:02:51 +02:00
|
|
|
context: &Context,
|
2023-05-28 16:25:25 +02:00
|
|
|
name: CreateProjectMutation,
|
|
|
|
) -> anyhow::Result<ProjectDto>;
|
2022-10-04 22:39:57 +02:00
|
|
|
}
|