From 4d480d3130abc443340417d3497b4c6ef7a07789 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Thu, 22 Sep 2022 08:16:06 +0200 Subject: [PATCH] add post query --- backend/src/db/graphql/posts.js | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/backend/src/db/graphql/posts.js b/backend/src/db/graphql/posts.js index 237446d41..83f6cfb1a 100644 --- a/backend/src/db/graphql/posts.js +++ b/backend/src/db/graphql/posts.js @@ -3,14 +3,42 @@ import gql from 'graphql-tag' // ------ mutations export const createPostMutation = gql` - mutation ($id: ID, $title: String!, $slug: String, $content: String!, $categoryIds: [ID]!) { - CreatePost(id: $id, title: $title, slug: $slug, content: $content, categoryIds: $categoryIds) { + 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 + ) { id slug + title + content } } ` // ------ queries +export const postQuery = () => { + return gql` + query Post($id: ID!) { + Post(id: $id) { + id + title + content + } + } + ` +} + // fill queries in here