Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const { gql } = require('apollo-server-koa')
- const UserType = require('./types/user')
- const PostType = require('./types/post')
- const RootQuery = gql`
- type Query {
- getUser(id: Int!): User
- getPostsByUserId(user_id: Int!): [Post!]
- }
- `;
- const RootMutation = `
- type Mutation {
- addUser(username: String!, password: String!, fullName: String, email: String, phone: String): User
- addPost(user_id: Int!, title: String!, content: String!): Post
- updatePost(id: Int!, title: String, content: String): Post
- }
- `;
- const SchemaDefinition = `
- schema {
- query: Query
- mutation: Mutation
- }
- `;
- module.exports = [
- SchemaDefinition, RootQuery, RootMutation, UserType, PostType
- ];
Add Comment
Please, Sign In to add comment