Skip to content

Commit d85eb23

Browse files
committed
feat(docs/develop): 📝 Update GraphQL Schema docs in accordance with changes from server-state/server#14
1 parent 3b2e393 commit d85eb23

File tree

2 files changed

+489
-9
lines changed

2 files changed

+489
-9
lines changed

develop/references/graphql-base-schema.md

Lines changed: 347 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,268 @@ interact with.
4949

5050
The currently authenticated user, if any
5151

52+
</td>
53+
</tr>
54+
<tr>
55+
<td colspan="2" valign="top"><strong>users</strong></td>
56+
<td valign="top">[<a href="#user">User</a>!]!</td>
57+
<td>
58+
59+
List of all users.
60+
61+
**Accessible for admins only.**
62+
63+
</td>
64+
</tr>
65+
<tr>
66+
<td colspan="2" valign="top"><strong>userById</strong></td>
67+
<td valign="top"><a href="#user">User</a></td>
68+
<td>
69+
70+
Get user details based on their user id.
71+
72+
**Accessible for admins only.**
73+
74+
</td>
75+
</tr>
76+
<tr>
77+
<td colspan="2" align="right" valign="top">id</td>
78+
<td valign="top"><a href="#id">ID</a>!</td>
79+
<td>
80+
81+
The user's ID
82+
83+
</td>
84+
</tr>
85+
<tr>
86+
<td colspan="2" valign="top"><strong>userByEmail</strong></td>
87+
<td valign="top"><a href="#user">User</a></td>
88+
<td>
89+
90+
Get user details based on their email address.
91+
92+
**Accessible for admins only.**
93+
94+
</td>
95+
</tr>
96+
<tr>
97+
<td colspan="2" align="right" valign="top">email</td>
98+
<td valign="top"><a href="#string">String</a>!</td>
99+
<td>
100+
101+
The user's email address
102+
52103
</td>
53104
</tr>
54105
</tbody>
55106
</table>
56107

108+
## Mutation
109+
110+
<table>
111+
<thead>
112+
<tr>
113+
<th align="left">Field</th>
114+
<th align="right">Argument</th>
115+
<th align="left">Type</th>
116+
<th align="left">Description</th>
117+
</tr>
118+
</thead>
119+
<tbody>
120+
<tr>
121+
<td colspan="2" valign="top"><strong>login</strong></td>
122+
<td valign="top"><a href="#loginresponse">LoginResponse</a>!</td>
123+
<td>
124+
125+
A mutation to login using email and password and get a JWT token for
126+
authentication.
127+
128+
</td>
129+
</tr>
130+
<tr>
131+
<td colspan="2" align="right" valign="top">email</td>
132+
<td valign="top"><a href="#string">String</a>!</td>
133+
<td></td>
134+
</tr>
135+
<tr>
136+
<td colspan="2" align="right" valign="top">password</td>
137+
<td valign="top"><a href="#string">String</a>!</td>
138+
<td></td>
139+
</tr>
140+
<tr>
141+
<td colspan="2" valign="top"><strong>addUser</strong></td>
142+
<td valign="top"><a href="#adduserresponse">AddUserResponse</a>!</td>
143+
<td>
144+
145+
Adds a new user.
146+
147+
**Accessible for admins only.**
148+
149+
</td>
150+
</tr>
151+
<tr>
152+
<td colspan="2" align="right" valign="top">user</td>
153+
<td valign="top"><a href="#adduserinput">AddUserInput</a>!</td>
154+
<td></td>
155+
</tr>
156+
<tr>
157+
<td colspan="2" valign="top"><strong>removeUser</strong></td>
158+
<td valign="top"><a href="#removeuserresponse">RemoveUserResponse</a>!</td>
159+
<td>
160+
161+
Removes a user.
162+
163+
**Accessible for admins only.**
164+
165+
</td>
166+
</tr>
167+
<tr>
168+
<td colspan="2" align="right" valign="top">id</td>
169+
<td valign="top"><a href="#id">ID</a>!</td>
170+
<td>
171+
172+
The user's user id
173+
174+
</td>
175+
</tr>
176+
<tr>
177+
<td colspan="2" valign="top"><strong>editUser</strong></td>
178+
<td valign="top"><a href="#edituserresponse">EditUserResponse</a>!</td>
179+
<td>
180+
181+
Edits an existing user.
182+
183+
Specify the user you want to edit in the `userEdits` input's `id` field.
184+
185+
**Accessible for admins only.**
186+
187+
</td>
188+
</tr>
189+
<tr>
190+
<td colspan="2" align="right" valign="top">user</td>
191+
<td valign="top"><a href="#edituserinput">EditUserInput</a>!</td>
192+
<td></td>
193+
</tr>
194+
</tbody>
195+
</table>
196+
57197
## Objects
58198

199+
### AddUserResponse
200+
201+
The data returned by the `addUser` mutation.
202+
203+
<table>
204+
<thead>
205+
<tr>
206+
<th align="left">Field</th>
207+
<th align="right">Argument</th>
208+
<th align="left">Type</th>
209+
<th align="left">Description</th>
210+
</tr>
211+
</thead>
212+
<tbody>
213+
<tr>
214+
<td colspan="2" valign="top"><strong>user</strong></td>
215+
<td valign="top"><a href="#user">User</a>!</td>
216+
<td>
217+
218+
The newly created user.
219+
220+
</td>
221+
</tr>
222+
</tbody>
223+
</table>
224+
225+
### EditUserResponse
226+
227+
The data returned by the `editUser` mutation.
228+
229+
<table>
230+
<thead>
231+
<tr>
232+
<th align="left">Field</th>
233+
<th align="right">Argument</th>
234+
<th align="left">Type</th>
235+
<th align="left">Description</th>
236+
</tr>
237+
</thead>
238+
<tbody>
239+
<tr>
240+
<td colspan="2" valign="top"><strong>user</strong></td>
241+
<td valign="top"><a href="#user">User</a>!</td>
242+
<td>
243+
244+
The newly saved user details.
245+
246+
</td>
247+
</tr>
248+
</tbody>
249+
</table>
250+
251+
### LoginResponse
252+
253+
The data returned by the `login` mutation.
254+
255+
<table>
256+
<thead>
257+
<tr>
258+
<th align="left">Field</th>
259+
<th align="right">Argument</th>
260+
<th align="left">Type</th>
261+
<th align="left">Description</th>
262+
</tr>
263+
</thead>
264+
<tbody>
265+
<tr>
266+
<td colspan="2" valign="top"><strong>token</strong></td>
267+
<td valign="top"><a href="#string">String</a>!</td>
268+
<td>
269+
270+
A JWT token for authentication.
271+
272+
Use the header `Authorization: Bearer [token]` in later API interactions.
273+
274+
</td>
275+
</tr>
276+
<tr>
277+
<td colspan="2" valign="top"><strong>me</strong></td>
278+
<td valign="top"><a href="#user">User</a>!</td>
279+
<td>
280+
281+
Details about the authenticated user.
282+
283+
</td>
284+
</tr>
285+
</tbody>
286+
</table>
287+
288+
### RemoveUserResponse
289+
290+
The data returned by the `removeUser` mutation.
291+
292+
<table>
293+
<thead>
294+
<tr>
295+
<th align="left">Field</th>
296+
<th align="right">Argument</th>
297+
<th align="left">Type</th>
298+
<th align="left">Description</th>
299+
</tr>
300+
</thead>
301+
<tbody>
302+
<tr>
303+
<td colspan="2" valign="top"><strong>success</strong></td>
304+
<td valign="top"><a href="#boolean">Boolean</a>!</td>
305+
<td>
306+
307+
`true` if deletion was successful, `false` otherwise.
308+
309+
</td>
310+
</tr>
311+
</tbody>
312+
</table>
313+
59314
### ServerState
60315

61316
The ServerState type that represents every query about the server state.
@@ -87,7 +342,7 @@ type ABCDEF_State {
87342
<tbody>
88343
<tr>
89344
<td colspan="2" valign="top"><strong>timestamp</strong></td>
90-
<td valign="top"><a href="#int">Int</a></td>
345+
<td valign="top"><a href="#string">String</a></td>
91346
<td>
92347

93348
The timestamp of the query's execution
@@ -141,6 +396,97 @@ The user's role within the system
141396
</tbody>
142397
</table>
143398

399+
## Inputs
400+
401+
### AddUserInput
402+
403+
Input for the `addUser` mutation
404+
405+
<table>
406+
<thead>
407+
<tr>
408+
<th colspan="2" align="left">Field</th>
409+
<th align="left">Type</th>
410+
<th align="left">Description</th>
411+
</tr>
412+
</thead>
413+
<tbody>
414+
<tr>
415+
<td colspan="2" valign="top"><strong>email</strong></td>
416+
<td valign="top"><a href="#string">String</a>!</td>
417+
<td>
418+
419+
The user's email address.
420+
421+
</td>
422+
</tr>
423+
<tr>
424+
<td colspan="2" valign="top"><strong>password</strong></td>
425+
<td valign="top"><a href="#string">String</a></td>
426+
<td>
427+
428+
The new user's password.
429+
430+
If not specified, the new user won't be able to login until the password gets
431+
reset.
432+
433+
</td>
434+
</tr>
435+
<tr>
436+
<td colspan="2" valign="top"><strong>role</strong></td>
437+
<td valign="top"><a href="#userrole">UserRole</a></td>
438+
<td>
439+
440+
The new user's role. Defaults to `user`.
441+
442+
</td>
443+
</tr>
444+
</tbody>
445+
</table>
446+
447+
### EditUserInput
448+
449+
Input for the `editUser` mutation
450+
451+
<table>
452+
<thead>
453+
<tr>
454+
<th colspan="2" align="left">Field</th>
455+
<th align="left">Type</th>
456+
<th align="left">Description</th>
457+
</tr>
458+
</thead>
459+
<tbody>
460+
<tr>
461+
<td colspan="2" valign="top"><strong>id</strong></td>
462+
<td valign="top"><a href="#id">ID</a>!</td>
463+
<td>
464+
465+
The (existing !) user id.
466+
467+
</td>
468+
</tr>
469+
<tr>
470+
<td colspan="2" valign="top"><strong>email</strong></td>
471+
<td valign="top"><a href="#string">String</a></td>
472+
<td>
473+
474+
A new email address, if applicable.
475+
476+
</td>
477+
</tr>
478+
<tr>
479+
<td colspan="2" valign="top"><strong>role</strong></td>
480+
<td valign="top"><a href="#userrole">UserRole</a></td>
481+
<td>
482+
483+
A new user role, if applicable.
484+
485+
</td>
486+
</tr>
487+
</tbody>
488+
</table>
489+
144490
## Enums
145491

146492
### UserRole
@@ -187,11 +533,6 @@ String; however, it is not intended to be human-readable. When expected as an
187533
input type, any string (such as `"4"`) or integer (such as `4`) input value will
188534
be accepted as an ID.
189535

190-
### Int
191-
192-
The `Int` scalar type represents non-fractional signed whole numeric values. Int
193-
can represent values between -(2^31) and 2^31 - 1.
194-
195536
### JSON
196537

197538
A `JSONSerializable` value represented as its serialized JSON string.

0 commit comments

Comments
 (0)