Skip to content

Instantly share code, notes, and snippets.

Last active Jan 30, 2021
What would you like to do?
Type definitions for Jokes and Ratings and how to query them
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