Skip to content

Commit 026401c

Browse files
authored
Merge pull request #169 from hackmcgill/bugfix/168-accountCreation
Bugfix/168 account creation
2 parents 7e2af2d + f027a25 commit 026401c

18 files changed

Lines changed: 448 additions & 200 deletions

controllers/hacker.controller.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,16 @@ async function findById(req, res) {
4242
*/
4343
async function createHacker(req, res) {
4444
const hackerDetails = req.body.hackerDetails;
45-
4645
const success = await Services.Hacker.createHacker(hackerDetails);
47-
46+
hackerDetails.id = hackerDetails._id;
47+
delete hackerDetails._id;
4848
if (success) {
4949
return res.status(200).json({
5050
message: "Hacker creation successful",
5151
data: hackerDetails
5252
});
5353
} else {
54-
return res.status(400).json({
54+
return res.status(500).json({
5555
message: Constants.Error.HACKER_CREATE_500_MESSAGE,
5656
data: {}
5757
});

docs/api/api_data.js

Lines changed: 109 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ define({
2222
"field": "lastName",
2323
"description": "<p>Last name of the account creator.</p>"
2424
},
25+
{
26+
"group": "body",
27+
"type": "String",
28+
"optional": false,
29+
"field": "pronoun",
30+
"description": "<p>the pronoun of the account creator.</p>"
31+
},
2532
{
2633
"group": "body",
2734
"type": "String",
@@ -47,8 +54,22 @@ define({
4754
"group": "body",
4855
"type": "String",
4956
"optional": false,
50-
"field": "passowrd",
57+
"field": "password",
5158
"description": "<p>The password of the account.</p>"
59+
},
60+
{
61+
"group": "body",
62+
"type": "String",
63+
"optional": false,
64+
"field": "birthDate",
65+
"description": "<p>a Date parsable string.</p>"
66+
},
67+
{
68+
"group": "body",
69+
"type": "Number",
70+
"optional": false,
71+
"field": "phoneNumber",
72+
"description": "<p>the user's phone number, represented as a string.</p>"
5273
}
5374
]
5475
}
@@ -263,6 +284,13 @@ define({
263284
"field": "lastName",
264285
"description": "<p>Last name of the account creator.</p>"
265286
},
287+
{
288+
"group": "body",
289+
"type": "String",
290+
"optional": true,
291+
"field": "pronoun",
292+
"description": "<p>the pronoun of the account creator.</p>"
293+
},
266294
{
267295
"group": "body",
268296
"type": "String",
@@ -290,6 +318,20 @@ define({
290318
"optional": true,
291319
"field": "passowrd",
292320
"description": "<p>The password of the account.</p>"
321+
},
322+
{
323+
"group": "body",
324+
"type": "String",
325+
"optional": true,
326+
"field": "birthDate",
327+
"description": "<p>a Date parsable string.</p>"
328+
},
329+
{
330+
"group": "body",
331+
"type": "Number",
332+
"optional": true,
333+
"field": "phoneNumber",
334+
"description": "<p>the user's phone number, represented as a string.</p>"
293335
}
294336
]
295337
}
@@ -476,6 +518,44 @@ define({
476518
"url": "https://mchacks.ca/api/auth/password/forgot"
477519
}]
478520
},
521+
{
522+
"type": "get",
523+
"url": "/auth/roles",
524+
"title": "get roles",
525+
"name": "getRoles",
526+
"description": "<p>get all roles that exist in the database</p>",
527+
"group": "Authentication",
528+
"version": "0.0.8",
529+
"success": {
530+
"fields": {
531+
"Success 200": [{
532+
"group": "Success 200",
533+
"type": "string",
534+
"optional": false,
535+
"field": "message",
536+
"description": "<p>Success message</p>"
537+
},
538+
{
539+
"group": "Success 200",
540+
"type": "object",
541+
"optional": false,
542+
"field": "data",
543+
"description": "<p>empty</p>"
544+
}
545+
]
546+
},
547+
"examples": [{
548+
"title": "Success-Response:",
549+
"content": "{\"message\": \"Sucessfully retrieved all roles\", \"data\":\n[{name: \"GodStaff\", routes: Array(27), id: \"5bee20ef3ca9dd4754382880\"},\n {name: \"Hacker\", routes: Array(10), id: \"5bee20ef3ca9dd4754382881\"},\n {name: \"Volunteer\", routes: Array(4), id: \"5bee20ef3ca9dd4754382882\"}]",
550+
"type": "json"
551+
}]
552+
},
553+
"filename": "routes/api/auth.js",
554+
"groupTitle": "Authentication",
555+
"sampleRequest": [{
556+
"url": "https://mchacks.ca/api/auth/roles"
557+
}]
558+
},
479559
{
480560
"type": "post",
481561
"url": "/auth/login",
@@ -847,6 +927,34 @@ define({
847927
"field": "needsBus",
848928
"description": "<p>Whether the hacker requires a bus for transportation</p>"
849929
},
930+
{
931+
"group": "body",
932+
"type": "String[]",
933+
"optional": false,
934+
"field": "ethnicity",
935+
"description": "<p>the ethnicities of the hacker</p>"
936+
},
937+
{
938+
"group": "body",
939+
"type": "String",
940+
"optional": false,
941+
"field": "major",
942+
"description": "<p>the major of the hacker</p>"
943+
},
944+
{
945+
"group": "body",
946+
"type": "Number",
947+
"optional": false,
948+
"field": "graduationYear",
949+
"description": "<p>the graduation year of the hacker</p>"
950+
},
951+
{
952+
"group": "body",
953+
"type": "Boolean",
954+
"optional": false,
955+
"field": "codeOfConduct",
956+
"description": "<p>acceptance of the code of conduct</p>"
957+
},
850958
{
851959
"group": "body",
852960
"type": "Json",

docs/api/api_data.json

Lines changed: 109 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@
2121
"field": "lastName",
2222
"description": "<p>Last name of the account creator.</p>"
2323
},
24+
{
25+
"group": "body",
26+
"type": "String",
27+
"optional": false,
28+
"field": "pronoun",
29+
"description": "<p>the pronoun of the account creator.</p>"
30+
},
2431
{
2532
"group": "body",
2633
"type": "String",
@@ -46,8 +53,22 @@
4653
"group": "body",
4754
"type": "String",
4855
"optional": false,
49-
"field": "passowrd",
56+
"field": "password",
5057
"description": "<p>The password of the account.</p>"
58+
},
59+
{
60+
"group": "body",
61+
"type": "String",
62+
"optional": false,
63+
"field": "birthDate",
64+
"description": "<p>a Date parsable string.</p>"
65+
},
66+
{
67+
"group": "body",
68+
"type": "Number",
69+
"optional": false,
70+
"field": "phoneNumber",
71+
"description": "<p>the user's phone number, represented as a string.</p>"
5172
}
5273
]
5374
}
@@ -262,6 +283,13 @@
262283
"field": "lastName",
263284
"description": "<p>Last name of the account creator.</p>"
264285
},
286+
{
287+
"group": "body",
288+
"type": "String",
289+
"optional": true,
290+
"field": "pronoun",
291+
"description": "<p>the pronoun of the account creator.</p>"
292+
},
265293
{
266294
"group": "body",
267295
"type": "String",
@@ -289,6 +317,20 @@
289317
"optional": true,
290318
"field": "passowrd",
291319
"description": "<p>The password of the account.</p>"
320+
},
321+
{
322+
"group": "body",
323+
"type": "String",
324+
"optional": true,
325+
"field": "birthDate",
326+
"description": "<p>a Date parsable string.</p>"
327+
},
328+
{
329+
"group": "body",
330+
"type": "Number",
331+
"optional": true,
332+
"field": "phoneNumber",
333+
"description": "<p>the user's phone number, represented as a string.</p>"
292334
}
293335
]
294336
}
@@ -475,6 +517,44 @@
475517
"url": "https://mchacks.ca/api/auth/password/forgot"
476518
}]
477519
},
520+
{
521+
"type": "get",
522+
"url": "/auth/roles",
523+
"title": "get roles",
524+
"name": "getRoles",
525+
"description": "<p>get all roles that exist in the database</p>",
526+
"group": "Authentication",
527+
"version": "0.0.8",
528+
"success": {
529+
"fields": {
530+
"Success 200": [{
531+
"group": "Success 200",
532+
"type": "string",
533+
"optional": false,
534+
"field": "message",
535+
"description": "<p>Success message</p>"
536+
},
537+
{
538+
"group": "Success 200",
539+
"type": "object",
540+
"optional": false,
541+
"field": "data",
542+
"description": "<p>empty</p>"
543+
}
544+
]
545+
},
546+
"examples": [{
547+
"title": "Success-Response:",
548+
"content": "{\"message\": \"Sucessfully retrieved all roles\", \"data\":\n[{name: \"GodStaff\", routes: Array(27), id: \"5bee20ef3ca9dd4754382880\"},\n {name: \"Hacker\", routes: Array(10), id: \"5bee20ef3ca9dd4754382881\"},\n {name: \"Volunteer\", routes: Array(4), id: \"5bee20ef3ca9dd4754382882\"}]",
549+
"type": "json"
550+
}]
551+
},
552+
"filename": "routes/api/auth.js",
553+
"groupTitle": "Authentication",
554+
"sampleRequest": [{
555+
"url": "https://mchacks.ca/api/auth/roles"
556+
}]
557+
},
478558
{
479559
"type": "post",
480560
"url": "/auth/login",
@@ -846,6 +926,34 @@
846926
"field": "needsBus",
847927
"description": "<p>Whether the hacker requires a bus for transportation</p>"
848928
},
929+
{
930+
"group": "body",
931+
"type": "String[]",
932+
"optional": false,
933+
"field": "ethnicity",
934+
"description": "<p>the ethnicities of the hacker</p>"
935+
},
936+
{
937+
"group": "body",
938+
"type": "String",
939+
"optional": false,
940+
"field": "major",
941+
"description": "<p>the major of the hacker</p>"
942+
},
943+
{
944+
"group": "body",
945+
"type": "Number",
946+
"optional": false,
947+
"field": "graduationYear",
948+
"description": "<p>the graduation year of the hacker</p>"
949+
},
950+
{
951+
"group": "body",
952+
"type": "Boolean",
953+
"optional": false,
954+
"field": "codeOfConduct",
955+
"description": "<p>acceptance of the code of conduct</p>"
956+
},
849957
{
850958
"group": "body",
851959
"type": "Json",

docs/api/api_project.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ define({
99
"apidoc": "0.3.0",
1010
"generator": {
1111
"name": "apidoc",
12-
"time": "2018-11-23T00:32:38.303Z",
12+
"time": "2018-11-29T02:39:05.040Z",
1313
"url": "http://apidocjs.com",
1414
"version": "0.17.6"
1515
}

docs/api/api_project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"apidoc": "0.3.0",
1010
"generator": {
1111
"name": "apidoc",
12-
"time": "2018-11-23T00:32:38.303Z",
12+
"time": "2018-11-29T02:39:05.040Z",
1313
"url": "http://apidocjs.com",
1414
"version": "0.17.6"
1515
}

0 commit comments

Comments
 (0)