Last active
January 30, 2021 06:13
-
-
Save thawkin3/3186d8d87eec04b3bfc2d1c1a5df8846 to your computer and use it in GitHub Desktop.
Type definitions for Jokes and Ratings and how to query them
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { gql } = require('apollo-server-express') | |
const typeDefs = gql` | |
type Joke { | |
id: Int! | |
content: String! | |
ratings: [Rating] | |
} | |
type Rating { | |
id: Int! | |
jokeId: Int! | |
score: Int! | |
} | |
type Query { | |
joke(id: Int!): Joke | |
jokes: [Joke] | |
rating(id: Int!): Rating | |
ratings: [Rating] | |
} | |
type Mutation { | |
rating(jokeId: Int!, score: Int!): Rating | |
} | |
` | |
module.exports = typeDefs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment