server: Add the attribute schema to the attributes in graphql

And make sure that we only request the schema once per top-level query
This commit is contained in:
Valentin Tolmer
2024-01-21 23:16:21 +01:00
committed by nitnelave
parent 1f2f034a48
commit e308a5e9a1
4 changed files with 229 additions and 181 deletions

View File

@@ -1,3 +1,5 @@
use std::sync::Arc;
use crate::{
domain::{
deserialize::deserialize_attribute_value,
@@ -159,11 +161,8 @@ impl<Handler: BackendHandler> Mutation<Handler> {
})
.instrument(span.clone())
.await?;
Ok(handler
.get_user_details(&user_id)
.instrument(span)
.await
.map(Into::into)?)
let user_details = handler.get_user_details(&user_id).instrument(span).await?;
super::query::User::<Handler>::from_user(user_details, Arc::new(schema))
}
async fn create_group(
@@ -513,11 +512,8 @@ async fn create_group_with_details<Handler: BackendHandler>(
attributes,
};
let group_id = handler.create_group(request).await?;
Ok(handler
.get_group_details(group_id)
.instrument(span)
.await
.map(Into::into)?)
let group_details = handler.get_group_details(group_id).instrument(span).await?;
super::query::Group::<Handler>::from_group_details(group_details, Arc::new(schema))
}
fn deserialize_attribute(