Browse Source

added author on gql puissance d'agir

bach 1 year ago
parent
commit
180436dfce

+ 2 - 0
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

+ 17 - 0
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(