Skip to content

Instantly share code, notes, and snippets.

@JeffRMoore
Created February 29, 2016 17:40
Show Gist options
  • Save JeffRMoore/2c9311c0284774a5ee23 to your computer and use it in GitHub Desktop.
Save JeffRMoore/2c9311c0284774a5ee23 to your computer and use it in GitHub Desktop.
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
}
}
@JeffRMoore
Copy link
Author

It might be useful to model the Location object in Posts as a dateline as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment