Created
February 29, 2016 17:40
-
-
Save JeffRMoore/2c9311c0284774a5ee23 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
It might be useful to model the Location object in Posts as a dateline as well