|
|
@@ -20,6 +20,7 @@ Server for Integrated Project, powered by Express.js and Redis, listens only on
|
|
20
|
20
|
* [/society/view/:society\_name](#societyviewsociety_name)
|
|
21
|
21
|
* [/society/view/:society\_name/events](#societyviewsociety_nameevents)
|
|
22
|
22
|
* [/society/join/](#societyjoin)
|
|
|
23
|
+ * [/society/leave/](#societyleave)
|
|
23
|
24
|
* [/events/create/](#eventscreate)
|
|
24
|
25
|
* [/events/view/:eventid](#eventsvieweventid)
|
|
25
|
26
|
* [/events/pending/](#eventspending)
|
|
|
@@ -287,19 +288,157 @@ The response is then formed as follows:
|
|
287
|
288
|
The error codes are as follows, `1` indicates that the user is already a member
|
|
288
|
289
|
of that society and `2` indicates a malformed request.
|
|
289
|
290
|
|
|
|
291
|
+### /society/leave/
|
|
|
292
|
+To leave a society, a `POST` request should be sent with the following data:
|
|
|
293
|
+```javascript
|
|
|
294
|
+{
|
|
|
295
|
+ "society": "TestSociety", // Society name here
|
|
|
296
|
+ "auth": "$2a$10$qjkvbcPZ4YC7/a/I0ZpTaeJp6auXjGrG9pgAdI3PP61u4CftQPSL2" // Auth key here
|
|
|
297
|
+}
|
|
|
298
|
+```
|
|
|
299
|
+The response is then formed as follows:
|
|
|
300
|
+```javascript
|
|
|
301
|
+{
|
|
|
302
|
+ "success": 1, // Indicates successfulness
|
|
|
303
|
+ "error": 0
|
|
|
304
|
+}
|
|
|
305
|
+```
|
|
|
306
|
+The error codes are as follows, `1` indicates that the user isn't a member
|
|
|
307
|
+of that society and `2` indicates a malformed request.
|
|
|
308
|
+
|
|
290
|
309
|
### /events/create/
|
|
291
|
|
-To create a new event, a `POST` request... its 4:30am and im shit tired of
|
|
292
|
|
-writing documentation, essentially just give it an auth key for all the following
|
|
293
|
|
-requests and you'll be golden, you can check what shit gets returned for yourself
|
|
294
|
|
-until I get a chance to write this up
|
|
|
310
|
+To create a new event, a `POST` request should be sent with the following data:
|
|
|
311
|
+```javascript
|
|
|
312
|
+{
|
|
|
313
|
+ "society": "TestSociety",
|
|
|
314
|
+ "name": "Test Event",
|
|
|
315
|
+ "location": "Test Location",
|
|
|
316
|
+ "start": "1460552065702",
|
|
|
317
|
+ "end": "1460552065734",
|
|
|
318
|
+ "details": "Some details about the test event",
|
|
|
319
|
+ "auth": "$2a$10$qjkvbcPZ4YC7/a/I0ZpTaeJp6auXjGrG9pgAdI3PP61u4CftQPSL2"
|
|
|
320
|
+}
|
|
|
321
|
+```
|
|
|
322
|
+Note that the end time of the event must be greater than the start time and the
|
|
|
323
|
+start time must be greater than Date.now(). Perhaps some client side
|
|
|
324
|
+verification that ensures, for example, the time of the event is the next day.
|
|
|
325
|
+The response will look like this:
|
|
|
326
|
+```javascript
|
|
|
327
|
+{
|
|
|
328
|
+ "success": 1,
|
|
|
329
|
+ "event": {
|
|
|
330
|
+ "id": "101898721",
|
|
|
331
|
+ "name": "Super Mario Kart Party",
|
|
|
332
|
+ "organiser": "test1",
|
|
|
333
|
+ "location": "Marioland",
|
|
|
334
|
+ "society": "TestSociety",
|
|
|
335
|
+ "start": "14605026110490",
|
|
|
336
|
+ "end": "14605026110500",
|
|
|
337
|
+ "details": "Play some Mario Kart with us"
|
|
|
338
|
+ },
|
|
|
339
|
+ "error": 0
|
|
|
340
|
+}
|
|
|
341
|
+```
|
|
|
342
|
+The error codes are as follows, `1` indicates that the user is not an admin of the society,
|
|
|
343
|
+`2` indicates that the event times are in some way invalid and `3` indicates that the
|
|
|
344
|
+request was malformed.
|
|
295
|
345
|
|
|
296
|
346
|
### /events/view/:eventid
|
|
297
|
|
-
|
|
|
347
|
+To view any individual event, a `GET` request should be sent with the following data:
|
|
|
348
|
+```javascript
|
|
|
349
|
+{
|
|
|
350
|
+ "auth": "$2a$10$qjkvbcPZ4YC7/a/I0ZpTaeJp6auXjGrG9pgAdI3PP61u4CftQPSL2"
|
|
|
351
|
+}
|
|
|
352
|
+```
|
|
|
353
|
+The response will then look like this:
|
|
|
354
|
+```javascript
|
|
|
355
|
+{
|
|
|
356
|
+ "event": {
|
|
|
357
|
+ "name": "Super Mario Kart Party",
|
|
|
358
|
+ "location": "Marioland",
|
|
|
359
|
+ "society": "TestSociety",
|
|
|
360
|
+ "start": "14605026110490",
|
|
|
361
|
+ "end": "14605026110500",
|
|
|
362
|
+ "details": "Play some Mario Kart with us",
|
|
|
363
|
+ "organiser": "test1",
|
|
|
364
|
+ "id": "101898721"
|
|
|
365
|
+ },
|
|
|
366
|
+ "error": 0
|
|
|
367
|
+}
|
|
|
368
|
+```
|
|
|
369
|
+The error codes are as follows, `1` indicates that the event does not exist, and
|
|
|
370
|
+`2` indicates a malformed request.
|
|
298
|
371
|
|
|
299
|
372
|
### /events/pending/
|
|
300
|
|
-
|
|
|
373
|
+To get a users pending events, a `GET` request should be sent with the following
|
|
|
374
|
+data:
|
|
|
375
|
+```javascript
|
|
|
376
|
+{
|
|
|
377
|
+ "auth": "$2a$10$qjkvbcPZ4YC7/a/I0ZpTaeJp6auXjGrG9pgAdI3PP61u4CftQPSL2"
|
|
|
378
|
+}
|
|
|
379
|
+```
|
|
|
380
|
+The response will then look like this:
|
|
|
381
|
+```javascript
|
|
|
382
|
+{
|
|
|
383
|
+ "pending_events": [
|
|
|
384
|
+ {
|
|
|
385
|
+ "name": "Super Mario Kart Party 5",
|
|
|
386
|
+ "location": "Marioland",
|
|
|
387
|
+ "society": "testsociety",
|
|
|
388
|
+ "start": "14605026110490",
|
|
|
389
|
+ "end": "14605026110500",
|
|
|
390
|
+ "details": "Play some Mario Kart with us",
|
|
|
391
|
+ "organiser": "test1",
|
|
|
392
|
+ "id": "851133039"
|
|
|
393
|
+ },
|
|
|
394
|
+ {
|
|
|
395
|
+ "name": "Super Mario Kart Party 6",
|
|
|
396
|
+ "location": "Marioland",
|
|
|
397
|
+ "society": "testsociety",
|
|
|
398
|
+ "start": "14605026110490",
|
|
|
399
|
+ "end": "14605026110500",
|
|
|
400
|
+ "details": "Play some Mario Kart with us",
|
|
|
401
|
+ "organiser": "test1",
|
|
|
402
|
+ "id": "838450388"
|
|
|
403
|
+ },
|
|
|
404
|
+ { ... }
|
|
|
405
|
+ ],
|
|
|
406
|
+ "error": 0
|
|
|
407
|
+}
|
|
|
408
|
+```
|
|
|
409
|
+The error codes are as follows, `1` indicates an invalid auth code and `2`
|
|
|
410
|
+indicates a malformed request.
|
|
301
|
411
|
|
|
302
|
412
|
### /events/accept/:eventid
|
|
303
|
|
-
|
|
|
413
|
+To accept an event, a `POST` request should be sent with the following data:
|
|
|
414
|
+```javascript
|
|
|
415
|
+{
|
|
|
416
|
+ "auth": "$2a$10$qjkvbcPZ4YC7/a/I0ZpTaeJp6auXjGrG9pgAdI3PP61u4CftQPSL2"
|
|
|
417
|
+}
|
|
|
418
|
+```
|
|
|
419
|
+The response will then look like this:
|
|
|
420
|
+```javascript
|
|
|
421
|
+{
|
|
|
422
|
+ "success": 1,
|
|
|
423
|
+ "error": 0
|
|
|
424
|
+}
|
|
|
425
|
+```
|
|
|
426
|
+The error codes are as follows, `1` indicates an invalid auth code, `2`
|
|
|
427
|
+indicates the event could not be found and `3` indicates a malformed request.
|
|
304
|
428
|
|
|
305
|
429
|
### /events/decline/:eventid
|
|
|
430
|
+To decline an event, a `POST` request should be sent with the following data:
|
|
|
431
|
+```javascript
|
|
|
432
|
+{
|
|
|
433
|
+ "auth": "$2a$10$qjkvbcPZ4YC7/a/I0ZpTaeJp6auXjGrG9pgAdI3PP61u4CftQPSL2"
|
|
|
434
|
+}
|
|
|
435
|
+```
|
|
|
436
|
+The response will then look like this:
|
|
|
437
|
+```javascript
|
|
|
438
|
+{
|
|
|
439
|
+ "success": 1,
|
|
|
440
|
+ "error": 0
|
|
|
441
|
+}
|
|
|
442
|
+```
|
|
|
443
|
+The error codes are as follows, `1` indicates an invalid auth code, `2`
|
|
|
444
|
+indicates the event could not be found and `3` indicates a malformed request.
|