Skip to content

Instantly share code, notes, and snippets.

@scastiel scastiel/queries.graphql
Last active Apr 21, 2019

Embed
What would you like to do?
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
You can’t perform that action at this time.