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},
|
|
|
|
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>;
|
2023-05-28 16:25:25 +02:00
|
|
|
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
|
|
|
}
|