-
-
Save koistya/f75e21e4436760784ce9 to your computer and use it in GitHub Desktop.
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
Base Schema | |
type Location { | |
city: String | |
country: String | |
} | |
type User { | |
id: String! | |
name: String | |
location: Location | |
posts: [Post] | |
activity: [Topic] | |
} | |
interface Topic { | |
id: String! | |
title: String | |
text: String | |
} | |
type Post : Topic { | |
id: String! | |
authors: [User] | |
title: String | |
text: String | |
comments: [Comment] | |
} | |
type Comment : Topic { | |
id: String! | |
author: User | |
title: String | |
text: String | |
} | |
type QueryRoot { | |
me: User | |
user(userId: String!): User | |
post(postId: String!): Post | |
users: [User] | |
posts: [Post] | |
} | |
How would you model authorship of topics? | |
Sample Queries: | |
{ | |
posts() { | |
id, | |
authors { | |
name | |
}, | |
text | |
} | |
} | |
{ | |
user(id:1) { | |
...activityText | |
...activityTitles | |
} | |
} | |
fragment activityText on User { | |
activity { | |
name | |
} | |
} | |
fragment activityTitles on User { | |
activity { | |
title | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment