Skip to content

Instantly share code, notes, and snippets.

@chrisl777
Created April 27, 2018 23:35
Show Gist options
  • Save chrisl777/97a6cd362bf22a8b14bb0fea5b7e2152 to your computer and use it in GitHub Desktop.
Save chrisl777/97a6cd362bf22a8b14bb0fea5b7e2152 to your computer and use it in GitHub Desktop.
A more involved GraphQL schema involving Movies and TV Show information.
const schema = `
type Query {
movie(id: ID!): Movie
tvShow(id: ID!): TVShow
movies(year: Int, page: Int): Movies
}
interface Media {
id: ID! @isUnique
externalId: String! @isUnique
}
type Movies {
pages: Int
results: [Movie]
}
type Movie implements Media {
id: ID! @isUnique
externalId: String! @isUnique
title: String!
budget: Int
popularity: Float!
tagline: String
overview: String
status: String
runtime: Int
release_date: String
vote_average: Float
vote_count: Int
poster_path: String
backdrop_path: String
#backdrops: [MovieBackdrop] @relation(name: "MovieBackdrops")
posters: [Poster] @relation(name: "MediaPoster")
trailers: [Trailer] @relation(name: "MediaTrailer")
genres: [Genre] @relation(name: "Genres")
keywords: [Keyword] @relation(name: "Keywords")
relatedAVIVideos: [AVIVideo]
}
type TVShow implements Media {
id: ID! @isUnique
externalId: String! @isUnique
title: String!
popularity: Float!
first_air_date: String
last_air_date: String
overview: String
vote_average: Float
vote_count: Int
number_of_episodes: Int
number_of_seasons: Int
episode_run_time: Int
poster_path: String
seasons: [TVShowSeason] @relation(name: "TVShowSeasons")
posters: [Poster] @relation(name: "MediaPoster")
trailers: [Trailer] @relation(name: "MediaTrailer")
genres: [Genre] @relation(name: "Genres")
}
type TVShowSeason @model {
id: ID! @isUnique
externalId: String! @isUnique
tvShow: TVShow! @relation(name: "TVShowSeasons")
name: String
season_number: Int
air_date: String
overview: String
episode_count: Int
poster_path: String
episodes: [TVShowEpisode] @relation(name: "TVShowSeasonEpisodes")
}
type TVShowEpisode @model {
id: ID! @isUnique
externalId: String! @isUnique
name: String!
airDate: String
overview: String
voteAverage: Float
voteCount: Int
season: TVShowSeason! @relation(name: "TVShowSeasonEpisodes")
}
type Trailer @model {
id: ID! @isUnique
externalId: String! @isUnique
key: String
name: String
site: String
media: Media! @relation(name: "MediaTrailer")
}
type Poster @model {
id: ID! @isUnique
externalId: String! @isUnique
aspectRatio: Float
filePath: String
height: Int
width: Int
voteAverage: Float
voteCount: Int
media: Media! @relation(name: "MediaPoster")
}
type Genre @model {
id: ID! @isUnique
externalId: String! @isUnique
name: String!
}
type Keyword @model {
id: ID! @isUnique
externalId: String! @isUnique
name: String!
}
type AVIVideo @model {
id: ID! @isUnique
externalId: String
name: String
thumbnailUrl: String
}
`
export default schema
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment