Skip to content

Instantly share code, notes, and snippets.

@unicodeveloper
Created August 18, 2017 02:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save unicodeveloper/539f59dde7c80ef07246e764d76744fd to your computer and use it in GitHub Desktop.
Save unicodeveloper/539f59dde7c80ef07246e764d76744fd to your computer and use it in GitHub Desktop.
import { makeExecutableSchema } from ‘graphql-tools’;
import resolvers from ‘./resolver’;
/*
 Define our Schema in GraphQL schema language.
 Learn more — http://dev.apollodata.com/tools/graphql-tools/generate-schema.html
*/
const typeDefs = `
type User {
 id: Int!
 email: String!
 password: String!
 firstname: String!
 lastname: String!
 bio: String!
 notes: [Note]
}
type Note {
 id: Int!
 title: String!
 body: String!
 user: User!
 createdAt: Int!
 updatedAt: Int!
}
type Query {
 login(email: String!, password: String!): User
 createUser(email: String!, password: String!, firstname: String!, lastname: String!, password: String!, bio: String!): User
 fetchAllUsers: [User]
 fetchUser(id: Int!): User
 updateUser(id: Int!, password: String!, firstname: String!, lastname: String!, bio: String!): Boolean
 createNote(title: String!, body: String!, userId: Int!): Note
 fetchNote(id: Int!): Note
 fetchAllNotes: [Note]
 updateNote(id: Int!, title: String!, body: String!): Boolean
 deleteNote(id: Int!): Boolean!
}
`;
export default makeExecutableSchema({ typeDefs, resolvers });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment