Skip to content

Instantly share code, notes, and snippets.

@scastiel
Last active April 21, 2019 16:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scastiel/8f512047c0f959b79463bd7838dd87a8 to your computer and use it in GitHub Desktop.
Save scastiel/8f512047c0f959b79463bd7838dd87a8 to your computer and use it in GitHub Desktop.
Graphcool types and queries
mutation {
createUser(name: "Sébastien") {
id
name
}
}
mutation {
createUser(name: "Mary") {
id
name
}
}
{
allUsers {
id
name
posts {
id
imageUrl
}
}
}
mutation {
createPost(
authorId: "cjur4185307sq0106c5uy3wyh"
imageUrl: "https://images.unsplash.com/photo-1555706195-38f133d1419f"
) {
id
author {
id
name
}
imageUrl
}
}
mutation {
createPost(
authorId: "cjur4185307sq0106c5uy3wyh"
imageUrl: "https://images.unsplash.com/photo-1555847166-ca9cd76d2490"
) {
id
author {
id
name
}
imageUrl
}
}
mutation {
createPost(
authorId: "cjur4wgyl0b94014663afke1p"
imageUrl: "https://images.unsplash.com/photo-1555851457-ac7a2e726e8d"
) {
id
author {
id
name
}
imageUrl
}
}
mutation {
createComment(
postId: "cjur4y17m0asx01234iwn30rv"
authorId: "cjur4185307sq0106c5uy3wyh"
content: "Great picture!"
) {
id
createdAt
content
}
}
mutation {
createComment(
postId: "cjur4y17m0asx01234iwn30rv"
authorId: "cjur4wgyl0b94014663afke1p"
content: "Thanks :)"
) {
id
createdAt
content
}
}
{
allPosts(orderBy: createdAt_DESC) {
id
createdAt
imageUrl
author {
id
name
}
comments(orderBy: createdAt_DESC) {
id
createdAt
author {
id
name
}
content
}
}
}
type User @model {
id: ID! @isUnique
name: String
posts: [Post!]! @relation(name: "UserPosts")
comments: [Comment!]! @relation(name: "UserComments")
}
type Post @model {
id: ID! @isUnique
createdAt: DateTime!
author: User! @relation(name: "UserPosts")
imageUrl: String!
comments: [Comment!]! @relation(name: "PostComments")
}
type Comment @model {
id: ID! @isUnique
createdAt: DateTime!
content: String!
post: Post! @relation(name: "PostComments")
author: User! @relation(name: "UserComments")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment