feat: working projects and items

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
2023-05-28 17:17:22 +02:00
parent 6dc0c24443
commit 12c7c8f6ee
10 changed files with 98 additions and 39 deletions

View File

@@ -49,14 +49,10 @@ impl MemoryProjectService {
impl ProjectService for MemoryProjectService {
async fn get_project(&self, query: GetProjectQuery) -> anyhow::Result<ProjectDto> {
let ps = self.project_store.lock().await;
if let Some(item_id) = query.item_id {
Ok(ps
.get(&item_id.to_string())
.ok_or(anyhow::anyhow!("could not find project"))?
.clone())
} else {
Err(anyhow::anyhow!("could not find project"))
}
Ok(ps
.get(&query.project_id.to_string())
.ok_or(anyhow::anyhow!("could not find project"))?
.clone())
}
async fn get_projects(&self, user: &User) -> anyhow::Result<Vec<ProjectDto>> {
Ok(self