Last active
April 21, 2019 16:50
-
-
Save scastiel/8f512047c0f959b79463bd7838dd87a8 to your computer and use it in GitHub Desktop.
Graphcool types and queries
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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