From f1d7feb2eacf3318d463b36339876bcf33c6337d Mon Sep 17 00:00:00 2001 From: oluwashane Date: Wed, 19 Feb 2020 17:51:01 +0100 Subject: [PATCH] feature/42/users-should-be-able-to-view-notes --- src/app/index.js | 3 ++- src/app/note/queries.js | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/app/index.js b/src/app/index.js index 3ff167d..9faaedd 100644 --- a/src/app/index.js +++ b/src/app/index.js @@ -5,6 +5,7 @@ import { noteMutations, noteQueries } from './note'; import { tagMutations, tagQueries } from './tag'; export default new GraphQLSchema({ - query: userQueries, + // query: userQueries, + query: noteQueries, mutation: collectionMutations }); diff --git a/src/app/note/queries.js b/src/app/note/queries.js index e69de29..7d1ab7c 100644 --- a/src/app/note/queries.js +++ b/src/app/note/queries.js @@ -0,0 +1,18 @@ +import { GraphQLObjectType, GraphQLList } from 'graphql'; +import NoteType from './types' +import Note from '../../database'; + +const noteQuery = new GraphQLObjectType({ + name: 'Query', + fields: () => ({ + notes: { + type: new GraphQLList(NoteType), + resolve: async(parentValue, args) => { + const note = await Note.find({}); + return note; + } + } + }) +}) + +export default noteQuery;