From aa670a051244b5864575024a702e9865162c0375 Mon Sep 17 00:00:00 2001 From: Jonas Leder <jonas@jonasled.de> Date: Thu, 7 Apr 2022 09:12:29 +0200 Subject: [PATCH] add mutation query for new comment --- public/API/queries/queries.php | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/public/API/queries/queries.php b/public/API/queries/queries.php index bbd802a..962ee87 100644 --- a/public/API/queries/queries.php +++ b/public/API/queries/queries.php @@ -53,17 +53,6 @@ $queryType = new ObjectType([ ], 'resolve' => fn ($rootValue, $args) => comments($args["article"], $rootValue["db"]), ], - "newComment" => [ - "type" => Type::string(), - "args" => [ - "article" => Type::string(), - "name" => Type::string(), - "email" => Type::string(), - "comment" => Type::string(), - "hCaptchaResponse" => Type::string() - ], - 'resolve' => fn ($rootValue, $args) => newComment($rootValue["db"], $args["article"], $args["name"], $args["email"], $args["comment"], $args["hCaptchaResponse"]), - ], 'ebayKleinanzeigen' => [ "type" => $ebayKleinanzeigenFields, "args" => [ @@ -75,5 +64,22 @@ $queryType = new ObjectType([ 'resolve' => fn ($rootValue, $args) => ebayKleinanzeigen($args["imageCount"]), ] - ], + ] +]); + +$mutationType = new ObjectType([ + 'name' => 'Mutation', + 'fields' => [ + "comment" => [ + "type" => Type::string(), + "args" => [ + "article" => Type::string(), + "name" => Type::string(), + "email" => Type::string(), + "comment" => Type::string(), + "hCaptchaResponse" => Type::string() + ], + 'resolve' => fn ($rootValue, $args) => newComment($rootValue["db"], $args["article"], $args["name"], $args["email"], $args["comment"], $args["hCaptchaResponse"]), + ], + ] ]); -- GitLab