This repository has been archived by the owner on Jul 31, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.gpl
492 lines (366 loc) · 11.5 KB
/
schema.gpl
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
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
# ------------------------------------------------------
# THIS FILE WAS AUTOMATICALLY GENERATED (DO NOT MODIFY)
# ------------------------------------------------------
"""Auth"""
type AuthModel {
token: String!
tokenExpireDate: DateTime!
user: UserDto!
}
type ClubDto {
_id: ID!
"""The name of the club"""
name: String!
"""You need a description for this?"""
street: String!
"""You need a description for this?"""
zip: String!
"""You need a description for this?"""
city: String!
"""Register of associatoins ID, if exists in country of origin"""
registrationId: String!
"""Country of origin"""
country: String!
"""An array(ids) of provided martial arts in this club"""
martialArts: [MartialArtsDto!]!
"""
An array(ids) of users who administrate this club. Default: The creator of the club.
"""
admins: [UserDto!]!
}
input ClubInput {
"""You need a description for this?"""
name: String
"""You need a description for this?"""
street: String
"""You need a description for this?"""
zip: String
"""You need a description for this?"""
city: String
"""Register of associatoins ID, if exists in country of origin"""
registrationId: String
"""Country of origin"""
country: String
"""An array(ids) of provided martial arts in this club"""
martialArts: [String!]
"""
An array(ids) of users who administrate this club. Default: The creator of the club.
"""
admins: [String!]
}
type ClubMemberDto {
club: ClubDto!
confirmed: Boolean!
}
input ClubMemberInput {
"""The id of the club the user is member of."""
club: String
"""
The confirmation status; false by default. Only turns true, if the club admin confirms the membership.
"""
confirmed: Boolean
}
"""
A date-time string at UTC, such as 2019-12-03T09:54:33Z, compliant with the date-time format.
"""
scalar DateTime
type ExamDto {
_id: ID!
"""The title of the exam"""
title: String!
"""Describe what tis exam is all about"""
description: String!
"""The price - how much this exam will cost."""
price: String!
minRank: String
"""The date and time of the exam"""
examDate: DateTime!
"""The date and time when registration should close"""
regEndDate: DateTime!
"""Is this exam public, or only for club members?"""
isPublic: Boolean!
"""The id of the club who organizes this exam"""
club: ClubDto!
"""The id of the responsible examiner. Usually the current user."""
examiner: UserDto!
"""The adress where the exam will take place"""
examPlace: String!
"""The martial art that gets tested"""
martialArt: MartialArtsDto!
"""An array with IDs from users who wants to get tested"""
participants: [UserDto!]!
}
input ExaminerInput {
"""The user id of the examiner. Just in case we need more information"""
_id: String
"""The first (and middle) name of the examiner"""
firstName: String
"""The last name of the examiner"""
lastName: String
}
input ExamInput {
"""The title of the exam"""
title: String
"""The description of the exam"""
description: String
"""The price - how much this exam will cost."""
price: String
"""The description of the exam"""
examPlace: String
"""The date when the exam should be held"""
examDate: DateTime
"""The date when registration will be closed"""
regEndDate: DateTime
"""Is this exam open for public registration?"""
isPublic: Boolean
"""The id of the accompanying association / club"""
club: String
minRank: String
"""The user id of the examiner"""
examiner: String
"""The id of the martial art this exam is for"""
martialArt: String
"""An array of ids from users who wants to get examined """
participants: [String!]
}
type ExamResultDto {
_id: ID!
user: String!
exam: String!
martialArt: MartialArtsDto!
examiner: UserDto!
rank: String!
date: DateTime!
reportUri: String!
passed: Boolean!
}
input ExamResultInput {
"""The id of the user this exam result is all about."""
user: String
"""The id of the related exam"""
exam: String
"""The martial art that was testet"""
martialArt: MartialArtInput
"""The examiner of the exam"""
examiner: ExaminerInput
"""The name of the rank that the user achieved"""
rank: String
"""The date string this exam took place"""
date: String
"""Did the user passed the exam? False, if he failed."""
passed: Boolean
}
type MaRanksDto {
_id: MartialArtsDto!
rankId: String
}
input MaRanksInput {
"""The id of the martial art"""
_id: String!
"""The id of the rank"""
rankId: String
}
input MartialArtInput {
"""
The id of the martial art that the exam was about. Just in case we need more information.
"""
_id: String
"""The name of the martial art"""
name: String
"""The style name of the martial art"""
styleName: String
}
type MartialArtsDto {
_id: ID!
name: String!
styleName: String!
description: String
ranks: [RankDto!]
examiners: [SimpleUserDto!]
}
input MartialArtsInput {
"""The name of the martial art"""
name: String
"""The style name the martial art belongs to"""
styleName: String
"""The description of the martial art"""
description: String
"""
An array of all ranks available in this martial art. The lower the rank number the higher the rank.
"""
ranks: [RankInput!]
"""
An array of users who is examiner for this martial art. Insert user id.
"""
examiners: [String!]
}
type Mutation {
"""Add a new club to the clubs array of a user"""
addUserToClub(clubId: String!): UserDto!
"""Removes the current user from a club member list"""
removeUserFromClub(clubId: String!): Boolean!
"""Add a new martial art rank to the current user"""
addMartialArtRankToUser(maRank: MaRanksInput!, userId: String!): UserDto!
"""Updates the current user"""
updateUser(input: UserInput!): UserDto!
"""Deletes the account of the current user"""
deleteUser: Boolean!
"""
Examiners can upload an exam protocol to an existing exam result. Use cURL request to send required data.
"""
uploadAvatar(protocol: Upload!): Boolean!
"""Creates a new martial art"""
createMartialArt(input: MartialArtsInput!): MartialArtsDto!
"""Updates an existing martial art"""
updateMartialArt(input: MartialArtsInput!, id: String!): MartialArtsDto!
"""Adds an user as examiner"""
addExaminer(maId: String!, email: String!): MartialArtsDto!
"""Removes an user from the examiners list"""
removeExaminer(maId: String!, userId: String!): MartialArtsDto!
"""Deletes a martial art, if the current user is authorized"""
deleteMartialArt(id: String!): String!
"""
Creates a new temporary user and sends an confirmation link to the given email
address. Returns -1 if account already exists, 1 if you already tried to
register and 0 if registration was ok.
"""
signup(userInput: UserInput!): String!
"""
Send a link for password reset, if the email address is in use. No error message whatsoever.
"""
forgotPassword(email: String!): Boolean!
"""Changes the password of the current user."""
changePassword(password: String!): Boolean!
"""Create a new club."""
createClub(input: ClubInput!): ClubDto!
"""Adds a new admin to a club, if the current user is authorized"""
addClubAdmin(userId: String!, clubId: String!): Boolean!
"""Update an existinc club. Just fill out what you want to change!"""
updateClub(input: ClubInput!, id: String!): ClubDto!
"""Deletes a club, if the current user is authorized"""
deleteClub(clubId: String!): Boolean!
"""Creates a new exam. DOH!"""
createExam(input: ExamInput!): ExamDto!
"""You can update any exam, that was created by you!"""
updateExam(input: ExamInput!, examId: String!): ExamDto!
"""The current user can register for an exam as participant"""
registerToExam(examId: String!): Boolean!
"""Removes the current user as participant from the given exam"""
unregisterFromExam(examId: String!): Boolean!
"""
Deletes the exam with given examId, if exam.examiner equals current user
"""
deleteExam(examId: String!): Boolean!
"""Creates a new exam result"""
createExamResult(input: ExamResultInput!): ExamResultDto!
"""Delete all exam results related to the current user"""
deleteRelatedExamResults: Boolean!
"""
Examiners can upload an exam protocol to an existing exam result. Use cURL request to send required data.
"""
uploadExamProtocol(protocol: Upload!, examResultId: String!): String!
}
type Query {
"""
Returns an user object representing the current logged in user including avatar file
"""
getUser: UserDto!
"""Returns an array of martial art objects"""
getAllMartialArts: [MartialArtsDto!]!
"""Returns one martial art object by id"""
getMartialArtById(id: String!): MartialArtsDto!
"""Returns one martial art object by rank id"""
getMartialArtByRank(rankId: String!): MartialArtsDto!
"""Returns striped out one rank object by rank id"""
getRank(rankId: String!): RankDto!
"""Logs the user in if email and password are correct"""
login(password: String!, email: String!): AuthModel!
"""Returns an array with all existing clubs"""
getAllClubs: [ClubDto!]!
"""Returns one club by id"""
getClubById(id: String!): ClubDto!
"""
Returns an array of all club members, if the current user is authorized
"""
getAllClubMembers(clubId: String!): [UserDto!]!
"""Returns an array of all exams. Including previous ones."""
getAllExams(minDate: DateTime!): [ExamDto!]!
"""Returns one exam with the given id"""
getExamById(id: String!): ExamDto!
"""
Returns an array of all exams. Only exams with an future starting date included.
"""
getPlannedExams: [ExamDto!]!
"""
Returns all exams where the user is examiner and exam results are missing
"""
getOpenExams: [ExamDto!]!
"""Returns all exams where the user participated or examined"""
getUserExams(minDate: DateTime!): [ExamDto!]!
"""Returns an array with all exam results of the current user"""
getAllExamResults: [ExamResultDto!]!
"""Returns one exam result with a given id"""
getExamResultById(id: String!): ExamResultDto!
}
type RankDto {
_id: ID!
name: String!
number: Float!
}
input RankInput {
_id: String
"""The name of the martial art rank"""
name: String!
"""
The number of the martial art rank. We are assuming, that number 1 is your grand master (highest rank)!
"""
number: Float!
}
type SimpleUserDto {
_id: ID!
firstName: String!
lastName: String!
email: String!
password: String!
"""
Returns an array of Martial Arts. The child array "ranks" should only contain the current rank (at index 0).
"""
martialArts: [MaRanksDto!]!
clubs: [ClubMemberDto!]!
avatarUri: String!
}
"""The `Upload` scalar type represents a file upload."""
scalar Upload
type UserDto {
_id: ID!
firstName: String!
lastName: String!
email: String!
password: String!
"""
Returns an array of Martial Arts. The child array "ranks" should only contain the current rank (at index 0).
"""
martialArts: [MaRanksDto!]
clubs: [ClubMemberDto!]
avatarUri: String
}
input UserInput {
"""The users first name"""
firstName: String
"""The users last name"""
lastName: String
"""The users email address"""
email: String
"""
The users password. Will be turned into a hash before we write it into the database.
"""
password: String
"""The new password, that replaces the old one"""
newPassword: String
"""
An array of martial art rank ids. We look out that you dont insert two ranks of the same martial art.
"""
martialArts: [String!]
"""An array of clubs the user is (or wants to be) an member of."""
clubs: [ClubMemberInput!]
}