potree_auth/project/ports/
project_repository.rs1use std::fmt::Debug;
2
3use async_trait::async_trait;
4
5use super::super::domain::Project;
6use super::super::domain::ProjectId;
7
8#[cfg_attr(test, mockall::automock)]
11#[async_trait]
12pub trait ProjectRepository: Debug + Send + Sync + 'static {
13 async fn read(&self, project_id: &ProjectId) -> Result<Project, ProjectRepositoryError>;
23
24 async fn list(&self) -> Result<Vec<Project>, ProjectRepositoryError>;
33}
34
35#[derive(Debug, Clone, thiserror::Error)]
36pub enum ProjectRepositoryError {
37 #[error("the `Project` ({id}) could not be found")]
38 ResourceNotFound { id: ProjectId },
39
40 #[error("unable to parse the `Project` ({id}) ")]
41 Parsing { id: ProjectId },
42
43 #[error("unable to interact with the datastore backend: {message}")]
44 Infrastucture { message: String },
45}