-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.graphql
403 lines (302 loc) · 8.85 KB
/
schema.graphql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
# -----------------------------------------------
# !!! THIS FILE WAS GENERATED BY TYPE-GRAPHQL !!!
# !!! DO NOT MODIFY THIS FILE BY YOURSELF !!!
# -----------------------------------------------
"""The input required to create a attempt"""
input AttemptAddInput {
"""Quiz attempt start timestamp"""
endTime: DateTimeISO!
"""Attempt questions list"""
questions: [QuestionInput!]!
"""Quiz difficulty"""
quiz: ID!
"""Quiz attempt start timestamp"""
startTime: DateTimeISO!
"""User that is making the attempt"""
user: ID!
}
"""Attempt data of a given quiz and user"""
type AttemptData {
"""Number to indicate how many questions the user got correct"""
correctOptions: Int!
"""When did the quiz attempt finished, as timestamp"""
endTime: DateTimeISO!
id: ID!
"""Number to indicate minutes taken to make the quiz attempt"""
minutes: Int!
"""Number to indicate percentage of correct answers in the quiz attempt"""
percentage: Int!
"""List of questions played with answers"""
questions: [QuestionData!]!
"""The quiz attempted"""
quiz: QuizData!
"""Number to indicate the rating of this quiz attempt"""
rating: Int
"""Number to indicate seconds taken to make the quiz attempt"""
seconds: Int!
"""When did the quiz attempt started, as timestamp"""
startTime: DateTimeISO!
"""The user that did this quiz attempt"""
user: UserData!
}
"""The input required to create a comment for a quiz"""
input CommentAddInput {
"""Quiz difficulty"""
quiz: ID!
"""Comment text content"""
text: String!
"""User that is making the attempt"""
user: ID!
}
"""Individual comment of a quiz"""
type CommentData {
"""When was the comment made"""
createdAt: DateTimeISO!
id: ID!
"""The quiz where this comment was made"""
quiz: String!
"""The text of the comment"""
text: String!
"""When was the comment last updated at"""
updatedAt: DateTimeISO!
"""The user that did this comment"""
user: UserData!
}
"""
A date-time string at UTC, such as 2007-12-03T10:15:30Z, compliant with the `date-time` format outlined in section 5.6 of the RFC 3339 profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar.This scalar is serialized to a string in ISO 8601 format and parsed from a string in ISO 8601 format.
"""
scalar DateTimeISO
"""The difficulty measurement"""
enum Difficulty {
Easy
Hard
Medium
Unknown
}
"""User login input data"""
input LoginInput {
"""User email address"""
email: String!
"""User password"""
password: String!
}
"""The login mutation response body"""
type LoginResponse {
"""Access token generated (as a JWT)"""
access_token: String!
}
type Mutation {
addAttempt(attempt: AttemptAddInput!): AttemptData!
addAttemptRating(attemptId: String!, rating: Int!): Boolean!
addComment(comment: CommentAddInput!): Boolean!
"""Approve a quiz"""
approveQuiz(quizId: String!): Boolean!
"""Cancel a quiz. All attempts will be removed alongside."""
cancelQuiz(quizId: String!): Boolean!
createQuiz(quiz: QuizAddInput!): QuizData!
deleteAttempt(attemptId: String!): Boolean!
deleteComment(commentId: String!): Boolean!
"""
The delete of user is just about changing the verified property to false in order to disable it. User data should be kept till request from the user for GDPR reasons
"""
deleteUser(userId: String!): Boolean!
"""Edit comment only if you are the user that made the comment"""
editComment(commentId: String!, text: String!): Boolean!
loginUser(input: LoginInput!): LoginResponse!
signupUser(user: SignUpInput!): UserData!
"""Update user password while logged in"""
updatePassword(userPasswordInput: PasswordUpdateInput!): Boolean!
"""Update a quiz"""
updateQuiz(quiz: QuizAddInput!, quizId: String!): QuizData!
"""Update all user details"""
updateUser(user: UserUpdateInput!, userId: String!): UserData!
}
"""Option data"""
type OptionData {
"""
If this answer was the chosen answer. Only applicable when reading Attempts
"""
chosen: Boolean
"""If this answer is the correct one"""
correct: Boolean!
"""The answer text"""
text: String!
}
"""The input required to create an quiz option"""
input OptionInput {
chosen: Boolean
correct: Boolean!
text: String!
}
"""User update password input mutation data"""
input PasswordUpdateInput {
"""Current user password"""
currentPassword: String!
"""New user password"""
password: String!
"""New user password confirmation"""
passwordConfirm: String!
"""User id for identification"""
userId: String!
}
type Query {
attemptById(attemptId: String!): AttemptData!
attempts(quizId: String, userId: String): [AttemptData!]!
getCurrentlyLoggedInUser: UserData!
logoutUser: Boolean!
"""Get a quiz by its ID"""
quizById(quizId: String!): QuizData!
quizComments(quizId: String!): [CommentData!]!
"""Get the list of all quizzes based on multiple filter."""
quizList(country: String, status: QuizStatus): [QuizData!]!
"""Get the quiz of the day"""
quizOfTheDay: QuizData!
quizRating(quizId: String!): Int!
"""Get the list of all quizzes based on the country"""
quizzesByCountry(country: String!): [QuizData!]!
refreshAccessToken: LoginResponse!
}
"""Question data"""
type QuestionData {
"""The image for this question"""
image: String!
"""The list of answers for this question"""
options: [OptionData!]!
"""The question name"""
question: String!
"""The type of this question"""
type: QuestionType!
}
"""The input required to create a question"""
input QuestionInput {
"""The image for this question"""
image: String
options: [OptionInput!]!
"""Question text"""
question: String!
"""The type of this question"""
type: QuestionType!
}
"""The type of a question"""
enum QuestionType {
Multi
Single
}
"""The input required to create a quiz"""
input QuizAddInput {
"""The country that this quiz relates"""
country: String!
"""Quiz description in order to brief about the quiz"""
description: String!
"""Quiz difficulty"""
difficulty: Difficulty
"""Quiz image"""
image: String
"""Quiz array of questions"""
questions: [QuestionInput!]!
"""Quiz status"""
status: QuizStatus = Pending
"""Array of tags to describe the quiz in keywords"""
tags: [String!] = []
"""Quiz time limit in minutes"""
timeLimit: Int
"""Quiz title definition"""
title: String!
}
"""Quiz data"""
type QuizData {
"""The country where this quiz relates with"""
country: String!
"""When was the quiz created"""
createdAt: DateTimeISO!
"""The user that created this quiz for the first time"""
creator: UserData!
"""Description of the quiz"""
description: String!
"""The quiz difficulty to indicate how hard this quiz can be"""
difficulty: Difficulty
id: ID!
"""Image of the quiz"""
image: String!
"""The user that last edited this quiz"""
lastEditor: UserData
"""List of questions for this quiz"""
questions: [QuestionData!]!
"""
The quiz status that indicates how the quiz is being handled by the system. Pending by default and that means that is a new quiz created by a user and needs to be reviewed by an admin.
"""
status: QuizStatus
"""Array of tags to describe the quiz in keywords"""
tags: [String!]
"""The time limit of the quiz in minutes, if 0 there is no time limit"""
timeLimit: Int
"""Title of the quiz"""
title: String!
"""When was the quiz last updated at"""
updatedAt: DateTimeISO!
}
"""The status of a quiz"""
enum QuizStatus {
Approved
Cancelled
Pending
}
"""The roles options for the users"""
enum Roles {
"""
The admin role which has the same permissions of an user but has also administrative rights
"""
Admin
"""
The regular user that has the ability to do most of the functionalities on the website
"""
User
}
"""User sign up input mutation data"""
input SignUpInput {
"""New user country"""
country: String
"""New user date or birth (e.g: 23-06-2005)"""
dateOfBirth: DateTimeISO
"""New user email address"""
email: String!
"""New user first name"""
firstName: String!
"""New user last name"""
lastName: String!
"""New user password"""
password: String!
"""New user password confirmation"""
passwordConfirm: String!
}
"""User body data"""
type UserData {
"""User country"""
country: String
"""When was the user created"""
createdAt: DateTimeISO!
"""User date of birth"""
dateOfBirth: DateTimeISO
"""User email"""
email: String!
"""User first given name"""
firstName: String!
id: ID!
"""User family name"""
lastName: String
"""User role"""
role: Roles!
"""When was the user last updated at"""
updatedAt: DateTimeISO!
}
"""User input to update its data"""
input UserUpdateInput {
"""User country"""
country: String
"""User date or birth (e.g: 23-06-2005)"""
dateOfBirth: DateTimeISO
"""User first name"""
firstName: String!
"""User last name"""
lastName: String!
}