diff --git a/README.md b/README.md index bc11a26..88fe933 100644 --- a/README.md +++ b/README.md @@ -1,3 +1 @@ # Cibus Backend - -Some text diff --git a/como_infrastructure/src/services/project_service.rs b/como_infrastructure/src/services/project_service.rs index 02f9004..7fdab82 100644 --- a/como_infrastructure/src/services/project_service.rs +++ b/como_infrastructure/src/services/project_service.rs @@ -1,5 +1,6 @@ use std::{collections::HashMap, sync::Arc}; +use anyhow::Context; use axum::async_trait; use como_core::projects::ProjectService; use como_domain::projects::{ @@ -16,6 +17,12 @@ impl DefaultProjectService { } } +impl Default for DefaultProjectService { + fn default() -> Self { + Self::new() + } +} + #[async_trait] impl ProjectService for DefaultProjectService { async fn get_project(&self, _query: GetProjectQuery) -> anyhow::Result { @@ -38,6 +45,12 @@ impl MemoryProjectService { } } +impl Default for MemoryProjectService { + fn default() -> Self { + Self::new() + } +} + #[async_trait] impl ProjectService for MemoryProjectService { async fn get_project(&self, query: GetProjectQuery) -> anyhow::Result { @@ -45,7 +58,7 @@ impl ProjectService for MemoryProjectService { if let Some(item_id) = query.item_id { Ok(ps .get(&item_id.to_string()) - .ok_or(anyhow::anyhow!("could not find project"))? + .context("could not find project")? .clone()) } else { Err(anyhow::anyhow!("could not find project"))