Skip to content

Instantly share code, notes, and snippets.

@SachaG
Last active March 5, 2019 14:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SachaG/796a9a9acb6db89b24edc6160276c677 to your computer and use it in GitHub Desktop.
Save SachaG/796a9a9acb6db89b24edc6160276c677 to your computer and use it in GitHub Desktop.
scalar JSON
scalar Date
# Type for Movies
type Movie {
_id: String
createdAt: Date
user: User
userId: String
name: String
year: String
review: String
}
input DeleteMovieInput{
selector: MovieSelectorUniqueInput!
}
input SingleMovieInput {
selector: MovieSelectorUniqueInput
# Whether to enable caching for this query
enableCache: Boolean
}
input MultiMovieInput {
# A JSON object that contains the query terms used to fetch data
terms: JSON,
# How much to offset the results by
offset: Int,
# A limit for the query
limit: Int,
# Whether to enable caching for this query
enableCache: Boolean
# Whether to calculate totalCount for this query
enableTotal: Boolean
# OpenCRUD fields
where: MovieSelectorInput
orderBy: MovieOrderByInput
skip: Int
after: String
before: String
first: Int
last: Int
}
type SingleMovieOutput{
result: Movie
}
type MultiMovieOutput{
results: [Movie]
totalCount: Int
}
type MovieOutput{
data: Movie
}
input CreateMovieDataInput {
name: String
year: String
review: String
}
input UpdateMovieDataInput {
name: String
year: String
review: String
}
input MovieSelectorInput {
AND: [MovieSelectorInput]
OR: [MovieSelectorInput]
}
input MovieSelectorUniqueInput {
_id: String
documentId: String # OpenCRUD backwards compatibility
slug: String
}
enum MovieOrderByInput {
foo #todo
}
type Query {
currentUser: User
# A single Movie document fetched by ID or slug
movie(input: SingleMovieInput): SingleMovieOutput
# A list of Movie documents matching a set of query terms
movies(input: MultiMovieInput): MultiMovieOutput
}
type Mutation {
# Mutation for creating new Movie documents
createMovie(data: CreateMovieDataInput) : MovieOutput
# Mutation for updating a Movie document
updateMovie(selector: MovieSelectorUniqueInput, data: UpdateMovieDataInput) : MovieOutput
# Mutation for upserting a Movie document
upsertMovie(selector: MovieSelectorUniqueInput, data: UpdateMovieDataInput) : MovieOutput
# Mutation for deleting a Movie document
deleteMovie(selector: MovieSelectorUniqueInput) : MovieOutput
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment