Skip to content

Instantly share code, notes, and snippets.

@michaellee8
Last active September 12, 2017 09:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaellee8/4854443c01b7f5ada94b899c3c4f95fb to your computer and use it in GitHub Desktop.
Save michaellee8/4854443c01b7f5ada94b899c3c4f95fb to your computer and use it in GitHub Desktop.
graphl script for query
{
"includeAll": [
{
"model": "User",
"as": "user",
"where": {
"userId": 1
}
}
],
"includeCorrect": [
{
"model": "User",
"as": "user",
"where": {
"userId": 1
}
},
{
"model": "QuestionAnswer",
"as": "questionAnswer",
"where": {
"questionAnswerIsCorrect": true
}
}
],
"includeWrong": [
{
"model": "User",
"as": "user",
"where": {
"userId": 1
}
},
{
"model": "QuestionAnswer",
"as": "questionAnswer",
"where": {
"questionAnswerIsCorrect": false
}
}
]
}
query getQuestionStats($includeAll: SequelizeJSON, $includeCorrect: SequelizeJSON, $includeWrong: SequelizeJSON) {
total: questionSumbitsCount(include: $includeAll)
all: questionSumbits(include: $includeAll) {
user {
userName
}
questionAnswer {
questionAnswerText
questionAnswerIsCorrect
}
}
correct: questionSumbitsCount(include: $includeCorrect)
wrong: questionSumbitsCount(include: $includeWrong)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment