From abcfe259a09d51b26076ce0252807db04119d447 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Mon, 3 Oct 2022 22:41:25 +0200 Subject: [PATCH] query and mutations are functions --- backend/src/db/graphql/posts.js | 46 +++++++++++++++++---------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/backend/src/db/graphql/posts.js b/backend/src/db/graphql/posts.js index 83f6cfb1a..bb7402a9f 100644 --- a/backend/src/db/graphql/posts.js +++ b/backend/src/db/graphql/posts.js @@ -2,30 +2,32 @@ import gql from 'graphql-tag' // ------ mutations -export const createPostMutation = gql` - mutation ( - $id: ID - $title: String! - $slug: String - $content: String! - $categoryIds: [ID] - $groupId: ID - ) { - CreatePost( - id: $id - title: $title - slug: $slug - content: $content - categoryIds: $categoryIds - groupId: $groupId +export const createPostMutation = () => { + return gql` + mutation ( + $id: ID + $title: String! + $slug: String + $content: String! + $categoryIds: [ID] + $groupId: ID ) { - id - slug - title - content + CreatePost( + id: $id + title: $title + slug: $slug + content: $content + categoryIds: $categoryIds + groupId: $groupId + ) { + id + slug + title + content + } } - } -` + ` +} // ------ queries