feat: update scripts to use new cuddle

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
2023-06-10 14:35:03 +02:00
parent 88c7acd439
commit 3e5309e1e6
7 changed files with 52 additions and 15 deletions

View File

@@ -1,5 +1,6 @@
use crate::common::*;
use crate::items::{CreatedItem, Item};
use crate::projects::Project;
use async_graphql::{Context, EmptySubscription, Object, Schema};
use como_domain::item::queries::{GetItemQuery, GetItemsQuery};
use como_domain::item::requests::{CreateItemDto, UpdateItemDto};
@@ -77,15 +78,17 @@ impl QueryRoot {
&self,
ctx: &Context<'_>,
query: GetProjectQuery,
) -> anyhow::Result<ProjectDto> {
) -> anyhow::Result<Project> {
project_service(ctx)
.get_project(get_domain_context(ctx), query)
.await
.map(|p| p.into())
}
async fn get_projects(&self, ctx: &Context<'_>) -> anyhow::Result<Vec<ProjectDto>> {
async fn get_projects(&self, ctx: &Context<'_>) -> anyhow::Result<Vec<Project>> {
project_service(ctx)
.get_projects(get_domain_context(ctx))
.await
.map(|p| p.into_iter().map(|p| p.into()).collect())
}
}