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;