From 180436dfcee15ec5fbc8c27a5249393bef52427d Mon Sep 17 00:00:00 2001 From: bach Date: Wed, 17 May 2023 15:38:21 +0200 Subject: [PATCH] added author on gql puissance d'agir --- .../graphql/ouatt_extension.base.graphqls | 2 ++ .../SchemaExtension/OuattSchemaExtension.php | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/web/modules/custom/ouatt_graphql/graphql/ouatt_extension.base.graphqls b/src/web/modules/custom/ouatt_graphql/graphql/ouatt_extension.base.graphqls index 18ce4fd..4fd991a 100644 --- a/src/web/modules/custom/ouatt_graphql/graphql/ouatt_extension.base.graphqls +++ b/src/web/modules/custom/ouatt_graphql/graphql/ouatt_extension.base.graphqls @@ -67,6 +67,7 @@ type Etape { type Besoin implements NodeInterface { id: Int! path: String! + author: String description: String! index: Int concernement: Concernement @@ -76,6 +77,7 @@ type Besoin implements NodeInterface { type Reponse implements NodeInterface { id: Int! path: String! + author: String besoin: Besoin qui: String quoi: String diff --git a/src/web/modules/custom/ouatt_graphql/src/Plugin/GraphQL/SchemaExtension/OuattSchemaExtension.php b/src/web/modules/custom/ouatt_graphql/src/Plugin/GraphQL/SchemaExtension/OuattSchemaExtension.php index 8a80537..05b64e7 100644 --- a/src/web/modules/custom/ouatt_graphql/src/Plugin/GraphQL/SchemaExtension/OuattSchemaExtension.php +++ b/src/web/modules/custom/ouatt_graphql/src/Plugin/GraphQL/SchemaExtension/OuattSchemaExtension.php @@ -585,6 +585,14 @@ class OuattSchemaExtension extends SdlSchemaExtensionPluginBase { ) ); + $registry->addFieldResolver('Besoin', 'author', + $builder->compose( + $builder->produce('entity_owner') + ->map('entity', $builder->fromParent()), + $builder->produce('entity_label') + ->map('entity', $builder->fromParent()) + )); + // description: String! $registry->addFieldResolver('Besoin', 'description', $builder->produce('property_path') @@ -680,6 +688,15 @@ class OuattSchemaExtension extends SdlSchemaExtensionPluginBase { ->map('url', $builder->fromParent()) ) ); + + $registry->addFieldResolver('Reponse', 'author', + $builder->compose( + $builder->produce('entity_owner') + ->map('entity', $builder->fromParent()), + $builder->produce('entity_label') + ->map('entity', $builder->fromParent()) + )); + // besoin: Besoin $registry->addFieldResolver('Reponse', 'besoin', $builder->compose(