como/como_core/src/projects/mod.rs
kjuulh 6dc0c24443
feat: with create project
Signed-off-by: kjuulh <contact@kjuulh.io>
2023-05-28 16:25:25 +02:00

21 lines
599 B
Rust

use std::sync::Arc;
use async_trait::async_trait;
use como_domain::{
projects::{mutation::CreateProjectMutation, queries::GetProjectQuery, ProjectDto},
users::User,
};
pub type DynProjectService = Arc<dyn ProjectService + Send + Sync>;
#[async_trait]
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>;
}