Skip to content

Instantly share code, notes, and snippets.

@jexp
Created June 24, 2019 20:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jexp/dab27570cc71797a815132527fe93fa9 to your computer and use it in GitHub Desktop.
Save jexp/dab27570cc71797a815132527fe93fa9 to your computer and use it in GitHub Desktop.
StackOverflow GraphQL Schema
type Tag {
name: String!
questions: [Question] @relation(name: "TAGGED", direction: "IN")
}
type Answer {
createdAt: DateTime
downVotes: Int
id: Int!
link: String
text: String
upVotes: Int
answers: [Question] @relation(name: "ANSWERS", direction: "OUT")
users: [User] @relation(name: "PROVIDED", direction: "IN")
}
type User {
display_name: String
id: Int!
image: String
link: String
name: String
reputation: Int
acceptedCount: Int @cypher(statement: "RETURN size((this)-[:PROVIDED]->(:Answer {accepted:true})) as accepted")
recommendedQuestions: [Question] @cypher(statement: "MATCH (this)-[:PROVIDED]->(:Answer)-[:ANSWERS]->(:Question)-[:TAGGED]->(tag:Tag) WITH tag, count(*) as freq order by freq desc limit 4 MATCH (tag)<-[:TAGGED]-(q:Question {answered:false}) RETURN q ORDER BY q.favorites DESC LIMIT 5 ")
provided: [Answer] @relation(name: "PROVIDED", direction: "OUT")
asked: [Question] @relation(name: "ASKED", direction: "OUT")
}
type Question {
answered: Boolean
createdAt: DateTime
downVotes: Int
favorites: Int
id: Int!
link: String
text: String
title: String!
upVotes: Int
tagged: [Tag] @relation(name: "TAGGED", direction: "OUT")
answers: [Answer] @relation(name: "ANSWERS", direction: "IN")
users: [User] @relation(name: "ASKED", direction: "IN")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment