From 0e88775c77df54c1d53276652ddcec8bbf898dc7 Mon Sep 17 00:00:00 2001 From: Tony Date: Fri, 16 Oct 2020 18:56:07 -0400 Subject: [PATCH 1/5] feat: add previous hackathons field to model, update tests --- constants/general.constant.js | 2 + docs/api/api_data.js | 12 +- docs/api/api_data.json | 4144 +++++++++++++++++++- middlewares/validators/hacker.validator.js | 12 + middlewares/validators/validator.helper.js | 16 +- models/hacker.model.js | 8 +- package.json | 8 +- routes/api/hacker.js | 6 + tests/util/hacker.test.util.js | 45 +- 9 files changed, 4225 insertions(+), 28 deletions(-) diff --git a/constants/general.constant.js b/constants/general.constant.js index cb0c4c06..d1f539fc 100644 --- a/constants/general.constant.js +++ b/constants/general.constant.js @@ -76,6 +76,7 @@ const SPONSOR_T5 = "SponsorT5"; // Enums (must match with frontend) const JOB_INTERESTS = ["Internship", "Full Time", "None"]; const SHIRT_SIZES = ["XS", "S", "M", "L", "XL", "XXL"]; +const HACKATHONS_COUNT = ["0", "1", "2", "3", "4", "5+"]; const ROLE_CATEGORIES = { SELF: ":self", @@ -189,6 +190,7 @@ module.exports = { REQUEST_TYPES: REQUEST_TYPES, JOB_INTERESTS: JOB_INTERESTS, SHIRT_SIZES: SHIRT_SIZES, + HACKATHONS_COUNT: HACKATHONS_COUNT, USER_TYPES: USER_TYPES, SPONSOR_TIERS: SPONSOR_TIERS, EXTENDED_USER_TYPES: EXTENDED_USER_TYPES, diff --git a/docs/api/api_data.js b/docs/api/api_data.js index 3f081e83..0971f55b 100644 --- a/docs/api/api_data.js +++ b/docs/api/api_data.js @@ -1501,7 +1501,7 @@ define({ "api": [ "examples": [ { "title": "application: ", - "content": "{\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n}", + "content": "{\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"previousHackathons\":\"5+\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n}", "type": "Json" } ] @@ -1528,7 +1528,7 @@ define({ "api": [ "examples": [ { "title": "Success-Response: ", - "content": "{\n \"message\": \"Hacker creation successful\", \n \"data\": {\n \"id\":\"5bff4d736f86be0a41badb91\",\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n}", + "content": "{\n \"message\": \"Hacker creation successful\", \n \"data\": {\n \"id\":\"5bff4d736f86be0a41badb91\",\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"previousHackathons\":\"5+\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n}", "type": "object" } ] @@ -1610,7 +1610,7 @@ define({ "api": [ "examples": [ { "title": "Success-Response: ", - "content": "{\n \"message\": \"Successfully retrieved hacker information\", \n \"data\": {\n \"id\":\"5bff4d736f86be0a41badb91\",\n \"status\": \"Applied\",\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n }\n }", + "content": "{\n \"message\": \"Successfully retrieved hacker information\", \n \"data\": {\n \"id\":\"5bff4d736f86be0a41badb91\",\n \"status\": \"Applied\",\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"previousHackathons\":\"5+\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n }\n }", "type": "object" } ] @@ -1692,7 +1692,7 @@ define({ "api": [ "examples": [ { "title": "Success-Response: ", - "content": "{\n \"message\": \"Successfully retrieved hacker information\", \n \"data\": {\n \"id\":\"5bff4d736f86be0a41badb91\",\n \"status\": \"Applied\",\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n }\n }", + "content": "{\n \"message\": \"Successfully retrieved hacker information\", \n \"data\": {\n \"id\":\"5bff4d736f86be0a41badb91\",\n \"status\": \"Applied\",\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"previousHackathons\":\"5+\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n }\n }", "type": "object" } ] @@ -1927,7 +1927,7 @@ define({ "api": [ "examples": [ { "title": "application: ", - "content": "{\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n }", + "content": "{\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"previousHackathons\":\"5+\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n }", "type": "Json" } ] @@ -1954,7 +1954,7 @@ define({ "api": [ "examples": [ { "title": "Success-Response: ", - "content": "{\n \"message\": \"Changed hacker information\", \n \"data\": {\n \"id\":\"5bff4d736f86be0a41badb91\",\n \"status\": \"Applied\",\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n }\n}", + "content": "{\n \"message\": \"Changed hacker information\", \n \"data\": {\n \"id\":\"5bff4d736f86be0a41badb91\",\n \"status\": \"Applied\",\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"previousHackathons\":\"5+\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n }\n}", "type": "object" } ] diff --git a/docs/api/api_data.json b/docs/api/api_data.json index 5f0a8c21..449ac85b 100644 --- a/docs/api/api_data.json +++ b/docs/api/api_data.json @@ -1 +1,4143 @@ -[ { "type": "post", "url": "/account/", "title": "create a new account", "name": "create", "group": "Account", "version": "0.0.8", "parameter": { "fields": { "body": [ { "group": "body", "type": "String", "optional": false, "field": "firstName", "description": "

First name of the account creator.

" }, { "group": "body", "type": "String", "optional": false, "field": "lastName", "description": "

Last name of the account creator.

" }, { "group": "body", "type": "String", "optional": false, "field": "pronoun", "description": "

the pronoun of the account creator.

" }, { "group": "body", "type": "String", "optional": false, "field": "email", "description": "

Email of the account.

" }, { "group": "body", "type": "String", "optional": false, "field": "gender", "description": "

Gender of the account creator.

" }, { "group": "body", "type": "String[]", "optional": false, "field": "dietaryRestrictions", "description": "

Any dietary restrictions for the user. 'None' if there are no restrictions

" }, { "group": "body", "type": "String", "optional": false, "field": "password", "description": "

The password of the account.

" }, { "group": "body", "type": "String", "optional": false, "field": "birthDate", "description": "

a Date parsable string.

" }, { "group": "body", "type": "Number", "optional": false, "field": "phoneNumber", "description": "

the user's phone number, represented as a string.

" } ], "header": [ { "group": "header", "type": "JWT", "optional": true, "field": "token", "description": "

the user's invite token.

" } ] }, "examples": [ { "title": "Request-Example:", "content": "{ \n \"firstName\": \"Theo\",\n \"lastName\":\"Klein\",\n \"pronoun\":\"he/him\",\n \"email\":\"theo@klein.com\",\n \"password\":\"hunter2\",\n \"phoneNumber\":1234567890,\n \"gender\":\"Male\",\n \"birthDate\":\"10/30/1997\"\n}", "type": "json" } ] }, "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "string", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "object", "optional": false, "field": "data", "description": "

Account object

" } ] }, "examples": [ { "title": "Success-Response: ", "content": "{\n \"message\": \"Account creation successful\", \n \"data\": {\n \"id\": ObjectId(\"5bff8b9f3274cf001bc71048\"),\n \t\"firstName\": \"Theo\",\n \"lastName\":\"Klein\",\n \"pronoun\":\"he/him\",\n \"email\":\"theo@klein.com\",\n \"phoneNumber\":1234567890,\n \t\"gender\":\"Male\",\n \"birthDate\":Date(\"10/30/1997\")\n }\n }", "type": "object" } ] }, "error": { "fields": { "Error 4xx": [ { "group": "Error 4xx", "type": "string", "optional": false, "field": "message", "description": "

Error message

" }, { "group": "Error 4xx", "type": "object", "optional": false, "field": "data", "description": "

empty

" } ] }, "examples": [ { "title": "Error-Response: ", "content": "{\n \"message\": \"Account already exists\", \n \"data\": {\n \"route\": \"/\"\n }\n}", "type": "object" } ] }, "filename": "routes/api/account.js", "groupTitle": "Account", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/account/" } ] }, { "type": "get", "url": "/account/:id", "title": "gets information from an account with mongoid ':id'", "name": "getAccount", "group": "Account", "version": "0.0.8", "parameter": { "fields": { "param": [ { "group": "param", "type": "ObjectId", "optional": false, "field": "id", "description": "

MongoId of an account

" } ] } }, "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "string", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "object", "optional": false, "field": "data", "description": "

Account object

" } ] }, "examples": [ { "title": "Success-Response: ", "content": "{\n \"message\": \"Account found by user id\", \n \"data\": {\n \"id\": ObjectId(\"5bff8b9f3274cf001bc71048\"),\n \"firstName\": \"Theo\",\n \"lastName\":\"Klein\",\n \"pronoun\":\"he/him\",\n \"email\":\"theo@klein.com\",\n \"phoneNumber\":1234567890,\n \"gender\":\"Male\",\n \"birthDate\":Date(\"10/30/1997\")\n }\n }", "type": "object" } ] }, "error": { "fields": { "Error 4xx": [ { "group": "Error 4xx", "type": "string", "optional": false, "field": "message", "description": "

Error message

" }, { "group": "Error 4xx", "type": "object", "optional": false, "field": "data", "description": "

empty

" } ] }, "examples": [ { "title": "Error-Response: ", "content": "{\"message\": \"Account not found\", \"data\": {}}", "type": "object" } ] }, "filename": "routes/api/account.js", "groupTitle": "Account", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/account/:id" } ] }, { "type": "get", "url": "/account/invite", "title": "Get all of the invites.", "name": "getAllInvites", "group": "Account", "version": "0.0.8", "description": "

Get all of the invites that currently exist in the database.

", "success": { "examples": [ { "title": "Success-Response: ", "content": "{\n \"message\": \"Invite retrieval successful.\", \n \"data\": [{\n \"email\":\"abc@def.com\",\n \"accountType\":\"Hacker\"\n }]\n }", "type": "object" } ] }, "filename": "routes/api/account.js", "groupTitle": "Account", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/account/invite" } ] }, { "type": "post", "url": "/account/invite", "title": "invites a user to create an account with the specified accountType", "name": "inviteAccount", "group": "Account", "version": "0.0.8", "description": "

sends link with token to be used with the account/create route

", "parameter": { "fields": { "body": [ { "group": "body", "type": "String", "optional": true, "field": "email", "description": "

email of the account to be created and where to send the link

" }, { "group": "body", "type": "String", "optional": true, "field": "accountType", "description": "

the type of the account which the user can create, for sponsor this should specify tier as well

" } ] } }, "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "string", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "object", "optional": false, "field": "data", "description": "

Account object

" } ] }, "examples": [ { "title": "Success-Response: ", "content": "{\n \"message\": \"Successfully invited user\", \n \"data\": {}\n }", "type": "object" } ] }, "error": { "fields": { "Error 4xx": [ { "group": "Error 4xx", "type": "string", "optional": false, "field": "message", "description": "

Error message

" }, { "group": "Error 4xx", "type": "object", "optional": false, "field": "data", "description": "

Error object

" } ] }, "examples": [ { "title": "Error-Response:", "content": "{\n \"message\": \"Invalid Authentication\",\n \"data\": {\n \"route\": \"/invite\"\n }\n }", "type": "object" } ] }, "filename": "routes/api/account.js", "groupTitle": "Account", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/account/invite" } ] }, { "type": "get", "url": "/account/self", "title": "get information about own account", "name": "self", "group": "Account", "version": "0.0.8", "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "string", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "object", "optional": false, "field": "data", "description": "

Account object

" } ] }, "examples": [ { "title": "Success-Response: ", "content": "{\n \"message\": \"Account found by user email\", \n \"data\": {\n \t\"id\": ObjectId(\"5bff8b9f3274cf001bc71048\"),\n \t\"firstName\": \"Theo\",\n \"lastName\":\"Klein\",\n \"pronoun\":\"he/him\",\n \"email\":\"theo@klein.com\",\n \"phoneNumber\":1234567890,\n \t\"gender\":\"Male\",\n \"birthDate\":Date(\"10/30/1997\")\n }\n }", "type": "object" } ] }, "error": { "fields": { "Error 4xx": [ { "group": "Error 4xx", "type": "string", "optional": false, "field": "message", "description": "

Error message

" }, { "group": "Error 4xx", "type": "object", "optional": false, "field": "data", "description": "

empty object

" } ] }, "examples": [ { "title": "Error-Response: ", "content": "{\"message\": \"Account not found\", \"data\": {}}", "type": "object" } ] }, "filename": "routes/api/account.js", "groupTitle": "Account", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/account/self" } ] }, { "type": "patch", "url": "/account/:id", "title": "update an account's information", "name": "updateOneUser", "group": "Account", "version": "0.0.8", "parameter": { "fields": { "body": [ { "group": "body", "type": "String", "optional": true, "field": "firstName", "description": "

First name of the account creator.

" }, { "group": "body", "type": "String", "optional": true, "field": "lastName", "description": "

Last name of the account creator.

" }, { "group": "body", "type": "String", "optional": true, "field": "pronoun", "description": "

The pronoun of the account creator.

" }, { "group": "body", "type": "String", "optional": true, "field": "email", "description": "

Email of the account.

" }, { "group": "body", "type": "String", "optional": true, "field": "gender", "description": "

Gender of the account creator.

" }, { "group": "body", "type": "String", "optional": true, "field": "birthDate", "description": "

A Date parsable string.

" }, { "group": "body", "type": "Number", "optional": true, "field": "phoneNumber", "description": "

The user's phone number, represented as a string.

" }, { "group": "body", "type": "String[]", "optional": true, "field": "dietaryRestrictions", "description": "

Any dietary restrictions for the user. 'None' if there are no restrictions

" } ] }, "examples": [ { "title": "Request-Example:", "content": "{ \"gender\": \"Male\" }", "type": "json" } ] }, "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "string", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "object", "optional": false, "field": "data", "description": "

Account object

" } ] }, "examples": [ { "title": "Success-Response: ", "content": "{\n \"message\": \"Account update successful.\", \n \"data\": {\n \"id\": ObjectId(\"5bff8b9f3274cf001bc71048\"),\n \t\"firstName\": \"Theo\",\n \"lastName\":\"Klein\",\n \"pronoun\":\"he/him\",\n \"email\":\"theo@klein.com\",\n \"phoneNumber\":1234567890,\n \t\"gender\": \"Male\",\n \"birthDate\":Date(\"10/30/1997\")\n }\n }", "type": "object" } ] }, "error": { "fields": { "Error 4xx": [ { "group": "Error 4xx", "type": "string", "optional": false, "field": "message", "description": "

Error message

" }, { "group": "Error 4xx", "type": "object", "optional": false, "field": "data", "description": "

empty

" } ] }, "examples": [ { "title": "Error-Response: ", "content": "{\"message\": \"Error while updating account\", \"data\": {}}", "type": "object" } ] }, "filename": "routes/api/account.js", "groupTitle": "Account", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/account/:id" } ] }, { "type": "patch", "url": "/auth/password/change", "title": "change password for logged in user", "name": "changePassword", "group": "Authentication", "version": "0.0.8", "parameter": { "fields": { "Parameter": [ { "group": "Parameter", "type": "String", "optional": false, "field": "oldPassword", "description": "

The current password of the user

" }, { "group": "Parameter", "type": "String", "optional": false, "field": "newPassword", "description": "

The new password of the user

" } ] }, "examples": [ { "title": "Request-Example:", "content": "{\n \"oldPassword\": \"password12345\",\n \"newPassword\": \"password123456\"\n}", "type": "json" } ] }, "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "string", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "object", "optional": false, "field": "data", "description": "

empty

" } ] }, "examples": [ { "title": "Success-Response:", "content": "{\"message\": \"Successfully reset password\", \"data\": {}}", "type": "json" } ] }, "permission": [ { "name": ": Must be logged in" } ], "filename": "routes/api/auth.js", "groupTitle": "Authentication", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/auth/password/change" } ] }, { "type": "post", "url": "/auth/confirm/:token", "title": "confirm account using the JWT in :token", "name": "confirmAccount", "group": "Authentication", "version": "0.0.8", "parameter": { "fields": { "Parameter": [ { "group": "Parameter", "type": "String", "optional": false, "field": "JWT", "description": "

for confirming the account

" } ] } }, "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "string", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "object", "optional": false, "field": "data", "description": "

empty

" } ] }, "examples": [ { "title": "Success-Response:", "content": "{\"message\": \"Successfully confirmed account\", \"data\": {}}", "type": "json" } ] }, "error": { "fields": { "Error 4xx": [ { "group": "Error 4xx", "type": "string", "optional": false, "field": "message", "description": "

Error message

" }, { "group": "Error 4xx", "type": "object", "optional": false, "field": "data", "description": "

empty

" } ] }, "examples": [ { "title": "Error-Response:", "content": "{\"message\": \"Invalid token for confirming account, \"data\": {}}", "type": "object" } ] }, "filename": "routes/api/auth.js", "groupTitle": "Authentication", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/auth/confirm/:token" } ] }, { "type": "post", "url": "/auth/password/forgot", "title": "forgot password route", "name": "forgotPassword", "group": "Authentication", "version": "0.0.8", "parameter": { "fields": { "Parameter": [ { "group": "Parameter", "type": "String", "optional": false, "field": "email", "description": "

the email address of the account

" } ] }, "examples": [ { "title": "Request-Example:", "content": "{ \"email\": \"myemail@mchacks.ca\" }", "type": "json" } ] }, "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "string", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "object", "optional": false, "field": "data", "description": "

empty

" } ] }, "examples": [ { "title": "Success-Response:", "content": "{\"message\": \"Sent reset email\", \"data\": {}}", "type": "json" } ] }, "permission": [ { "name": ": public" } ], "filename": "routes/api/auth.js", "groupTitle": "Authentication", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/auth/password/forgot" } ] }, { "type": "get", "url": "/auth/rolebindings/:id", "title": "retrieve rolebindings for a user given by their user id :id", "name": "getRoleBindings", "group": "Authentication", "version": "0.0.8", "parameter": { "fields": { "param": [ { "group": "param", "type": "ObjectId", "optional": false, "field": "id", "description": "

MongoId of an account

" } ] } }, "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "string", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "object", "optional": false, "field": "data", "description": "

Rolebindings object

" } ] }, "examples": [ { "title": "Success-Response: ", "content": "{\n \"message\": \"Successfully retrieved role bindings\",\n \"data\": {\n accountId:\"5beca4ab2e069a34f91697b2\"\n id:\"5beca4ae2e069a34f91698b1\"\n roles: [\n {\n _id:\"5beca4ab2e069a34f91697d9\",\n name:\"hacker\",\n routes: [\n {_id: \"5beca4ae2e069a34f9169852\", requestType: \"POST\", uri: \"/api/auth/login\"},\n {_id: \"5beca4ae2e069a34f9169851\", requestType: \"POST\", uri: \"/api/auth/logout\"},\n {_id: \"5beca4ae2e069a34f9169850\", requestType: \"GET\", uri: \"/api/auth/rolebindings/:self\"},\n {_id: \"5beca4ae2e069a34f916984f\", requestType: \"GET\", uri: \"/api/account/self\"},\n {_id: \"5beca4ae2e069a34f916984e\", requestType: \"GET\", uri: \"/api/account/:self\"},\n {_id: \"5beca4ae2e069a34f916984d\", requestType: \"PATCH\", uri: \"/api/account/:self\"},\n {_id: \"5beca4ae2e069a34f916984c\", requestType: \"POST\", uri: \"/api/hacker/\"},\n {_id: \"5beca4ae2e069a34f916984b\", requestType: \"GET\", uri: \"/api/hacker/:self\"},\n {_id: \"5beca4ae2e069a34f916984a\", requestType: \"GET\", uri: \"/api/hacker/:self/resume\"},\n {_id: \"5beca4ae2e069a34f9169849\", requestType: \"PATCH\", uri: \"/api/hacker/:self\"}\n ]\n }\n ]\n }\n }", "type": "object" } ] }, "error": { "fields": { "Error 4xx": [ { "group": "Error 4xx", "type": "string", "optional": false, "field": "message", "description": "

Error message

" }, { "group": "Error 4xx", "type": "object", "optional": false, "field": "data", "description": "

empty

" } ] }, "examples": [ { "title": "Error-Response: ", "content": "{\"message\": \"Role Bindings not found\", \"data\": {}}", "type": "object" } ] }, "filename": "routes/api/auth.js", "groupTitle": "Authentication", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/auth/rolebindings/:id" } ] }, { "type": "get", "url": "/auth/roles", "title": "get roles", "name": "getRoles", "description": "

get all roles that exist in the database

", "group": "Authentication", "version": "0.0.8", "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "string", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "object", "optional": false, "field": "data", "description": "

empty

" } ] }, "examples": [ { "title": "Success-Response:", "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\"}]", "type": "json" } ] }, "filename": "routes/api/auth.js", "groupTitle": "Authentication", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/auth/roles" } ] }, { "type": "post", "url": "/auth/login", "title": "login to the service", "name": "login", "group": "Authentication", "version": "0.0.8", "parameter": { "fields": { "Parameter": [ { "group": "Parameter", "type": "string", "optional": false, "field": "email", "description": "

Account email

" }, { "group": "Parameter", "type": "string", "optional": false, "field": "password", "description": "

Account password

" } ] } }, "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "string", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "object", "optional": false, "field": "data", "description": "

empty

" } ] }, "examples": [ { "title": "Success-Response: ", "content": "{\"message\": \"Successfully logged in\", \"data\": {}}", "type": "object" } ] }, "error": { "fields": { "Error 4xx": [ { "group": "Error 4xx", "type": "string", "optional": false, "field": "message", "description": "

Error message

" }, { "group": "Error 4xx", "type": "object", "optional": false, "field": "data", "description": "

empty

" } ] }, "examples": [ { "title": "Error-Response: ", "content": "{\"message\": \"Invalid Authentication\", \"data\": {}}", "type": "object" } ] }, "permission": [ { "name": ": public" } ], "filename": "routes/api/auth.js", "groupTitle": "Authentication", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/auth/login" } ] }, { "type": "get", "url": "/auth/logout", "title": "logout of service", "name": "logout", "group": "Authentication", "version": "0.0.8", "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "string", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "object", "optional": false, "field": "data", "description": "

empty

" } ] }, "examples": [ { "title": "Success-Response:", "content": "{\"message\": \"Successfully logged out\", \"data\": {}}", "type": "object" } ] }, "permission": [ { "name": ": public" } ], "filename": "routes/api/auth.js", "groupTitle": "Authentication", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/auth/logout" } ] }, { "type": "get", "url": "/auth/confirm/resend", "title": "resend confirmation token", "name": "resendConfirmAccount", "group": "Authentication", "version": "0.0.8", "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "string", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "object", "optional": false, "field": "data", "description": "

empty

" } ] }, "examples": [ { "title": "Success-Response:", "content": "{\"message\": \"Successfully resent confirmation email\", \"data\": {}}", "type": "json" } ] }, "error": { "fields": { "Error 4xx": [ { "group": "Error 4xx", "type": "string", "optional": false, "field": "message", "description": "

Error message

" }, { "group": "Error 4xx", "type": "object", "optional": false, "field": "data", "description": "

empty

" } ] }, "examples": [ { "title": "Error-Response:", "content": " HTTP/1.1 422\n{\"message\": \"Account already confirmed\", \"data\": {}}", "type": "json" }, { "title": "Error-Response:", "content": " HTTP/1.1 428\n{\"message\": \"Account confirmation token does not exist\", \"data\": {}}", "type": "json" } ] }, "filename": "routes/api/auth.js", "groupTitle": "Authentication", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/auth/confirm/resend" } ] }, { "type": "post", "url": "/auth/password/reset", "title": "reset password", "name": "resetPassword", "group": "Authentication", "version": "0.0.8", "parameter": { "fields": { "Parameter": [ { "group": "Parameter", "type": "String", "optional": false, "field": "password", "description": "

the password of the account

" } ] }, "examples": [ { "title": "Request-Example:", "content": "{ \"password\": \"hunter2\" }", "type": "json" } ] }, "header": { "fields": { "Header": [ { "group": "Header", "type": "String", "optional": false, "field": "Authentication", "description": "

the token that was provided in the reset password email

" } ] }, "examples": [ { "title": "Header-Example:", "content": "{\n \"X-Reset-Token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c\"\n}", "type": "json" } ] }, "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "string", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "object", "optional": false, "field": "data", "description": "

empty

" } ] }, "examples": [ { "title": "Success-Response:", "content": "{\"message\": \"Successfully reset password\", \"data\": {}}", "type": "json" } ] }, "permission": [ { "name": ": must have authentication token" } ], "filename": "routes/api/auth.js", "groupTitle": "Authentication", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/auth/password/reset" } ] }, { "type": "patch", "url": "/hacker/batchAccept/", "title": "accept array of Hackers", "name": "acceptHacker", "group": "Hacker", "version": "3.0.0", "parameter": { "fields": { "body) {{ids: ObjectId[]}} Array of id(s": [ { "group": "body) {{ids: ObjectId[]}} Array of id(s", "optional": false, "field": "that", "description": "

needed to be accepted

" } ] } }, "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "string", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "object", "optional": false, "field": "data", "description": "

success_ids array and errors array. Errors array will contain a detailed error for why the batch update for a given ID did not work

" } ] }, "examples": [ { "title": "Success-Response:", "content": "{\n \"message\": \"Hacker batch update successful.\",\n \"data\": {\n \"success_ids\": [\"id1\", \"id2\"]\n \"errors\": [{status: 404, message: \"ACCOUNT_NOT_FOUND\", account: null, hacker_id: \"id3\"}]\n }\n}", "type": "object" } ] }, "permission": [ { "name": "Administrator" } ], "filename": "routes/api/hacker.js", "groupTitle": "Hacker", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/hacker/batchAccept/" } ] }, { "type": "patch", "url": "/hacker/acceptEmail/:email", "title": "accept a Hacker by email", "name": "acceptHacker", "group": "Hacker", "version": "2.0.0", "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "string", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "object", "optional": false, "field": "data", "description": "

Hacker object

" } ] }, "examples": [ { "title": "Success-Response:", "content": "{\n \"message\": \"Changed hacker information\",\n \"data\": {\n \"status\": \"Accepted\"\n }\n}", "type": "object" } ] }, "permission": [ { "name": "Administrator" } ], "filename": "routes/api/hacker.js", "groupTitle": "Hacker", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/hacker/acceptEmail/:email" } ] }, { "type": "patch", "url": "/hacker/accept/:id", "title": "accept a Hacker", "name": "acceptHacker", "group": "Hacker", "version": "2.0.0", "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "string", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "object", "optional": false, "field": "data", "description": "

Hacker object

" } ] }, "examples": [ { "title": "Success-Response:", "content": "{\n \"message\": \"Changed hacker information\",\n \"data\": {\n \"status\": \"Accepted\"\n }\n}", "type": "object" } ] }, "permission": [ { "name": "Administrator" } ], "filename": "routes/api/hacker.js", "groupTitle": "Hacker", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/hacker/accept/:id" } ] }, { "type": "patch", "url": "/hacker/checkin/:id", "title": "update a hacker's status to be 'Checked-in'. Note that the Hacker must eitehr be Accepted or Confirmed.", "name": "checkinHacker", "group": "Hacker", "version": "0.0.9", "parameter": { "fields": { "body": [ { "group": "body", "type": "string", "optional": true, "field": "status", "description": "

Check-in status. "Checked-in"

" } ] } }, "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "string", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "object", "optional": false, "field": "data", "description": "

Hacker object

" } ] }, "examples": [ { "title": "Success-Response:", "content": "{\n \"message\": \"Changed hacker information\",\n \"data\": {\n \"status\": \"Checked-in\"\n }\n}", "type": "object" } ] }, "permission": [ { "name": "Administrator" }, { "name": "Volunteer" } ], "filename": "routes/api/hacker.js", "groupTitle": "Hacker", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/hacker/checkin/:id" } ] }, { "type": "post", "url": "/hacker/", "title": "create a new hacker", "name": "createHacker", "group": "Hacker", "version": "0.0.8", "parameter": { "fields": { "body": [ { "group": "body", "type": "MongoID", "optional": false, "field": "accountId", "description": "

ObjectID of the respective account

" }, { "group": "body", "type": "String", "optional": false, "field": "school", "description": "

Name of the school the hacker goes to

" }, { "group": "body", "type": "String", "optional": false, "field": "gender", "description": "

Gender of the hacker

" }, { "group": "body", "type": "Number", "optional": false, "field": "travel", "description": "

Whether the hacker requires a bus for transportation

" }, { "group": "body", "type": "String[]", "optional": false, "field": "ethnicity", "description": "

the ethnicities of the hacker

" }, { "group": "body", "type": "String[]", "optional": false, "field": "major", "description": "

the major of the hacker

" }, { "group": "body", "type": "Number", "optional": false, "field": "graduationYear", "description": "

the graduation year of the hacker

" }, { "group": "body", "type": "Boolean", "optional": false, "field": "codeOfConduct", "description": "

acceptance of the code of conduct

" }, { "group": "body", "type": "Json", "optional": false, "field": "application", "description": "

The hacker's application. Resume and jobInterest fields are required.

" } ] }, "examples": [ { "title": "application: ", "content": "{\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n}", "type": "Json" } ] }, "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "string", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "object", "optional": false, "field": "data", "description": "

Hacker object

" } ] }, "examples": [ { "title": "Success-Response: ", "content": "{\n \"message\": \"Hacker creation successful\", \n \"data\": {\n \"id\":\"5bff4d736f86be0a41badb91\",\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n}", "type": "object" } ] }, "error": { "fields": { "Error 4xx": [ { "group": "Error 4xx", "type": "string", "optional": false, "field": "message", "description": "

Error message

" }, { "group": "Error 4xx", "type": "object", "optional": false, "field": "data", "description": "

empty

" } ] }, "examples": [ { "title": "Error-Response: ", "content": "{\"message\": \"Error while creating hacker\", \"data\": {}}", "type": "object" } ] }, "filename": "routes/api/hacker.js", "groupTitle": "Hacker", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/hacker/" } ] }, { "type": "get", "url": "/hacker/:id", "title": "get a hacker's information", "name": "getHacker", "group": "Hacker", "version": "0.0.8", "parameter": { "fields": { "param": [ { "group": "param", "type": "String", "optional": false, "field": "id", "description": "

a hacker's unique mongoID

" } ] } }, "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "String", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "Object", "optional": false, "field": "data", "description": "

Hacker object

" } ] }, "examples": [ { "title": "Success-Response: ", "content": "{\n \"message\": \"Successfully retrieved hacker information\", \n \"data\": {\n \"id\":\"5bff4d736f86be0a41badb91\",\n \"status\": \"Applied\",\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n }\n }", "type": "object" } ] }, "error": { "fields": { "Error 4xx": [ { "group": "Error 4xx", "type": "String", "optional": false, "field": "message", "description": "

Error message

" }, { "group": "Error 4xx", "type": "Object", "optional": false, "field": "data", "description": "

empty

" } ] }, "examples": [ { "title": "Error-Response: ", "content": "{\"message\": \"Hacker not found\", \"data\": {}}", "type": "object" } ] }, "filename": "routes/api/hacker.js", "groupTitle": "Hacker", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/hacker/:id" } ] }, { "type": "get", "url": "/hacker/email/:email", "title": "get a hacker's information", "name": "getHacker", "group": "Hacker", "version": "0.0.8", "parameter": { "fields": { "param": [ { "group": "param", "type": "String", "optional": false, "field": "email", "description": "

a hacker's unique email

" } ] } }, "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "String", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "Object", "optional": false, "field": "data", "description": "

Hacker object

" } ] }, "examples": [ { "title": "Success-Response: ", "content": "{\n \"message\": \"Successfully retrieved hacker information\", \n \"data\": {\n \"id\":\"5bff4d736f86be0a41badb91\",\n \"status\": \"Applied\",\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n }\n }", "type": "object" } ] }, "error": { "fields": { "Error 4xx": [ { "group": "Error 4xx", "type": "String", "optional": false, "field": "message", "description": "

Error message

" }, { "group": "Error 4xx", "type": "Object", "optional": false, "field": "data", "description": "

empty

" } ] }, "examples": [ { "title": "Error-Response: ", "content": "{\"message\": \"Hacker not found\", \"data\": {}}", "type": "object" } ] }, "filename": "routes/api/hacker.js", "groupTitle": "Hacker", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/hacker/email/:email" } ] }, { "type": "get", "url": "/hacker/resume:id", "title": "get the resume for a hacker.", "name": "getHackerResume", "group": "Hacker", "version": "0.0.8", "parameter": { "fields": { "param": [ { "group": "param", "type": "ObjectId", "optional": false, "field": "id", "description": "

Hacker id

" } ] } }, "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "String", "optional": false, "field": "message", "description": "

Success message

" } ] }, "examples": [ { "title": "Success-Response:", "content": "HTTP/1.1 200 OK\n{\n message: \"Downloaded resume\",\n data: {\n id: \"507f191e810c19729de860ea\",\n resume: [Buffer]\n }\n}", "type": "json" } ] }, "error": { "fields": { "Error 4xx": [ { "group": "Error 4xx", "type": "String", "optional": false, "field": "message", "description": "

"Resume does not exist"

" } ] }, "examples": [ { "title": "Error-Response:", "content": "HTTP/1.1 404\n{\n message: \"Resume not found\",\n data: {}\n}", "type": "json" } ] }, "permission": [ { "name": "Must be logged in, and the account id must be linked to the hacker." } ], "filename": "routes/api/hacker.js", "groupTitle": "Hacker" }, { "type": "get", "url": "/hacker/stats", "title": "Gets the stats of all of the hackers who have applied.", "name": "getHackerStats", "group": "Hacker", "version": "0.0.9", "parameter": { "fields": { "query": [ { "group": "query", "type": "String", "optional": false, "field": "model", "description": "

the model to be searched (Only hacker supported)

" }, { "group": "query", "type": "Array", "optional": false, "field": "q", "description": "

the query to be executed. For more information on how to format this, please see https://docs.mchacks.ca/architecture/

" } ] } }, "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "string", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "object", "optional": false, "field": "data", "description": "

Hacker object

" } ] }, "examples": [ { "title": "Success-Response: ", "content": "{\n \"message\": \"Retrieved stats\",\n \"data\": {\n \"stats\" : {\n \"total\": 10,\n \"status\": { \"Applied\": 10 },\n \"school\": { \"McGill University\": 3, \"Harvard University\": 7 },\n degree: { \"Undergraduate\": 10 },\n gender: { \"Male\": 1, \"Female\": 9 },\n travel: { \"true\": 7, \"false\": 3 },\n ethnicity: { \"White\": 10, },\n jobInterest: { \"Internship\": 10 },\n major: { \"Computer Science\": 10 },\n graduationYear: { \"2019\": 10 },\n dietaryRestrictions: { \"None\": 10 },\n shirtSize: { \"M\": 3, \"XL\": 7 },\n age: { \"22\": 10 }\n }\n }\n}", "type": "object" } ] }, "filename": "routes/api/hacker.js", "groupTitle": "Hacker", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/hacker/stats" } ] }, { "type": "patch", "url": "/hacker/:id", "title": "update a hacker's information.", "description": "

This route only contains the ability to update a subset of a hacker's information. If you want to update a status, you must have Admin priviledges and use PATCH /hacker/status/:id.

", "name": "patchHacker", "group": "Hacker", "version": "0.0.8", "parameter": { "fields": { "body": [ { "group": "body", "type": "String", "optional": true, "field": "school", "description": "

Name of the school the hacker goes to

" }, { "group": "body", "type": "String", "optional": true, "field": "gender", "description": "

Gender of the hacker

" }, { "group": "body", "type": "Number", "optional": true, "field": "travel", "description": "

How much the hacker requires a bus for transportation

" }, { "group": "body", "type": "String[]", "optional": true, "field": "ethnicity", "description": "

the ethnicities of the hacker

" }, { "group": "body", "type": "String[]", "optional": true, "field": "major", "description": "

the major of the hacker

" }, { "group": "body", "type": "Number", "optional": true, "field": "graduationYear", "description": "

the graduation year of the hacker

" }, { "group": "body", "type": "Json", "optional": true, "field": "application", "description": "

The hacker's application

" } ] }, "examples": [ { "title": "application: ", "content": "{\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n }", "type": "Json" } ] }, "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "string", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "object", "optional": false, "field": "data", "description": "

Hacker object

" } ] }, "examples": [ { "title": "Success-Response: ", "content": "{\n \"message\": \"Changed hacker information\", \n \"data\": {\n \"id\":\"5bff4d736f86be0a41badb91\",\n \"status\": \"Applied\",\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n }\n}", "type": "object" } ] }, "error": { "fields": { "Error 4xx": [ { "group": "Error 4xx", "type": "string", "optional": false, "field": "message", "description": "

Error message

" }, { "group": "Error 4xx", "type": "object", "optional": false, "field": "data", "description": "

empty

" } ] }, "examples": [ { "title": "Error-Response: ", "content": "{\"message\": \"Error while updating hacker\", \"data\": {}}", "type": "object" } ] }, "filename": "routes/api/hacker.js", "groupTitle": "Hacker", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/hacker/:id" } ] }, { "type": "patch", "url": "/hacker/confirmation/:id", "title": "Allows confirmation of hacker attendence if they are accepted. Also allows change from 'confirmed' to 'withdrawn'.", "name": "patchHackerConfirmed", "group": "Hacker", "version": "0.0.9", "parameter": { "fields": { "body": [ { "group": "body", "type": "string", "optional": true, "field": "status", "description": "

The new status of the hacker. "Accepted", "Confirmed", or "Withdrawn"

" } ] } }, "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "string", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "object", "optional": false, "field": "data", "description": "

Hacker object

" } ] }, "examples": [ { "title": "Success-Response:", "content": "{\n \"message\": \"Changed hacker information\",\n \"data\": {\n \"status\": \"Confirmed\"\n }\n}", "type": "object" } ] }, "permission": [ { "name": "Administrator" }, { "name": "Hacker" } ], "filename": "routes/api/hacker.js", "groupTitle": "Hacker", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/hacker/confirmation/:id" } ] }, { "type": "patch", "url": "/hacker/status/:id", "title": "update a hacker's status", "name": "patchHackerStatus", "group": "Hacker", "version": "0.0.9", "parameter": { "fields": { "body": [ { "group": "body", "type": "string", "optional": true, "field": "status", "description": "

Status of the hacker's application ("None"|"Applied"|"Accepted"|"Declined"|"Waitlisted"|"Confirmed"|"Withdrawn"|"Checked-in")

" } ] } }, "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "string", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "object", "optional": false, "field": "data", "description": "

Hacker object

" } ] }, "examples": [ { "title": "Success-Response:", "content": "{\n \"message\": \"Changed hacker information\",\n \"data\": {\n \"status\": \"Accepted\"\n }\n}", "type": "object" } ] }, "permission": [ { "name": "Administrator" } ], "filename": "routes/api/hacker.js", "groupTitle": "Hacker", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/hacker/status/:id" } ] }, { "type": "post", "url": "/hacker/resume/:id", "title": "upload or update resume for a hacker.", "name": "postHackerResume", "group": "Hacker", "version": "0.0.8", "description": "

NOTE: This must be sent via multipart/form-data POST request

", "parameter": { "fields": { "param": [ { "group": "param", "type": "ObjectId", "optional": false, "field": "id", "description": "

Hacker id

" } ], "body": [ { "group": "body", "type": "File", "optional": false, "field": "resume", "description": "

The uploaded file.

" } ] } }, "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "String", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "Object", "optional": false, "field": "data", "description": "

Location in the bucket that the file was stored.

" } ] }, "examples": [ { "title": "Success-Response:", "content": "HTTP/1.1 200 OK\n{\n message: \"Uploaded resume\",\n data: {\n filename: \"resumes/1535032624768-507f191e810c19729de860ea\"\n }\n}", "type": "json" } ] }, "permission": [ { "name": "Must be logged in, and the account id must be linked to the hacker." } ], "filename": "routes/api/hacker.js", "groupTitle": "Hacker", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/hacker/resume/:id" } ] }, { "type": "post", "url": "/hacker/email/dayOf/:id", "title": "", "description": "

Sends a hacker the day-of email, along with the HackPass QR code to view their hacker profile (for checkin purposes). Hackers must be either confirmed, or checked in.

", "name": "postHackerSendDayOfEmail", "group": "Hacker", "version": "0.0.9", "parameter": { "fields": { "param": [ { "group": "param", "type": "string", "optional": true, "field": "status", "description": "

The hacker ID

" } ] } }, "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "string", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "object", "optional": false, "field": "data", "description": "

empty

" } ] }, "examples": [ { "title": "Success-Response:", "content": "{\n \"message\": \"Hacker day-of email sent.\",\n \"data\": {}\n}", "type": "object" } ] }, "permission": [ { "name": "Administrator" } ], "filename": "routes/api/hacker.js", "groupTitle": "Hacker", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/hacker/email/dayOf/:id" } ] }, { "type": "post", "url": "/hacker/email/weekOf/:id", "title": "", "description": "

Sends a hacker the week-of email, along with the HackPass QR code to view their hacker profile (for checkin purposes). Hackers must be either confirmed, or checked in.

", "name": "postHackerSendWeekOfEmail", "group": "Hacker", "version": "0.0.9", "parameter": { "fields": { "param": [ { "group": "param", "type": "string", "optional": true, "field": "status", "description": "

The hacker ID

" } ] } }, "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "string", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "object", "optional": false, "field": "data", "description": "

empty

" } ] }, "examples": [ { "title": "Success-Response:", "content": "{\n \"message\": \"Hacker week-of email sent.\",\n \"data\": {}\n}", "type": "object" } ] }, "permission": [ { "name": "Administrator" } ], "filename": "routes/api/hacker.js", "groupTitle": "Hacker", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/hacker/email/weekOf/:id" } ] }, { "type": "post", "url": "/hacker/email/weekOf/:id", "title": "", "description": "

Sends a hacker the week-of email, along with the HackPass QR code to view their hacker profile (for checkin purposes). Hackers must be eitherconfirmed, or checked in.

", "name": "postHackerSendWeekOfEmail", "group": "Hacker", "version": "0.0.9", "parameter": { "fields": { "param": [ { "group": "param", "type": "string", "optional": true, "field": "status", "description": "

The hacker ID

" } ] } }, "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "string", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "object", "optional": false, "field": "data", "description": "

empty

" } ] }, "examples": [ { "title": "Success-Response:", "content": "{\n \"message\": \"Hacker week-of email sent.\",\n \"data\": {}\n}", "type": "object" } ] }, "permission": [ { "name": "Administrator" } ], "filename": "routes/api/hacker.js", "groupTitle": "Hacker", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/hacker/email/weekOf/:id" } ] }, { "type": "get", "url": "/sponsor/self", "title": "get information about logged in sponsor", "name": "self", "group": "Hacker", "version": "1.4.1", "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "String", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "Object", "optional": false, "field": "data", "description": "

Sponsor object

" } ] }, "examples": [ { "title": "Success-Response: ", "content": "{\n \"message\": \"Successfully retrieved sponsor information\", \n \"data\": {\n \"id\": \"5bff4d736f86be0a41badb91\",\n \"accountId\": \"5bff4d736f86be0a41badb99\",\n \"tier\": 3,\n \"company\": \"companyName\",\n \"contractURL\": \"https://www.contractHere.com\",\n \"nominees\": [\"5bff4d736f86be0a41badb93\",\"5bff4d736f86be0a41badb94\"]\n }\n }", "type": "object" } ] }, "error": { "fields": { "Error 4xx": [ { "group": "Error 4xx", "type": "String", "optional": false, "field": "message", "description": "

Error message

" }, { "group": "Error 4xx", "type": "Object", "optional": false, "field": "data", "description": "

empty

" } ] }, "examples": [ { "title": "Error-Response: ", "content": "{\"message\": \"Sponsor not found\", \"data\": {}}", "type": "object" } ] }, "permission": [ { "name": ": Sponsor" } ], "filename": "routes/api/sponsor.js", "groupTitle": "Hacker", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/sponsor/self" } ] }, { "type": "get", "url": "/hacker/self", "title": "get information about own hacker", "name": "self", "group": "Hacker", "version": "0.0.8", "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "string", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "object", "optional": false, "field": "data", "description": "

Hacker object

" } ] }, "examples": [ { "title": "Success-Response: ", "content": "{\n \"message\": \"Hacker found by logged in account id\", \n \"data\": {\n \"id\":\"5bff4d736f86be0a41badb91\",\n \"application\":{\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n \"jobInterest\":\"Internship\",\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"comments\":\"hi!\",\n \"essay\":\"Pls accept me\"\n },\n \"status\":\"Applied\",\n \"ethnicity\":[\"White or Caucasian\",\" Asian or Pacific Islander\"],\n \"accountId\":\"5bff2a35e533b0f6562b4998\",\n \"school\":\"McPherson College\",\n \"gender\":\"Female\",\n \"travel\":0,\n \"major\":[\"Accounting\"],\n \"graduationYear\":2019,\n \"codeOfConduct\":true,\n } \n }", "type": "object" } ] }, "error": { "fields": { "Error 4xx": [ { "group": "Error 4xx", "type": "string", "optional": false, "field": "message", "description": "

Error message

" }, { "group": "Error 4xx", "type": "object", "optional": false, "field": "data", "description": "

empty

" } ] }, "examples": [ { "title": "Error-Response: ", "content": "{\"message\": \"Hacker not found\", \"data\": {}}", "type": "object" } ] }, "filename": "routes/api/hacker.js", "groupTitle": "Hacker", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/hacker/self" } ] }, { "type": "get", "url": "/", "title": "version", "version": "0.0.8", "name": "index", "group": "Index", "permission": [ { "name": "public" } ], "filename": "routes/index.js", "groupTitle": "Index", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/" } ] }, { "type": "post", "url": "/api/role/", "title": "create a new role", "name": "createRole", "group": "Role", "version": "1.1.1", "parameter": { "fields": { "body": [ { "group": "body", "type": "String", "optional": false, "field": "name", "description": "

Name of the route

" }, { "group": "body", "type": "Route[]", "optional": false, "field": "routes", "description": "

The routes that this role gives access to

" } ] }, "examples": [ { "title": "application: ", "content": "{\n \"name\": \"routename\",\n \"routes\": [\n {\n uri: \"/api/hacker/\"\n requestType: \"POST\"\n }\n ]\n}", "type": "Json" } ] }, "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "string", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "object", "optional": false, "field": "data", "description": "

Role object

" } ] }, "examples": [ { "title": "Success-Response: ", "content": "{\n \"message\": \"Role creation successful\", \n \"data\": {\n \"name\": \"routename\",\n \"routes\": [\n {\n uri: \"/api/hacker/\"\n requestType: \"POST\"\n }\n ]\n }\n}", "type": "object" } ] }, "error": { "fields": { "Error 4xx": [ { "group": "Error 4xx", "type": "string", "optional": false, "field": "message", "description": "

Error message

" }, { "group": "Error 4xx", "type": "object", "optional": false, "field": "data", "description": "

empty

" } ] }, "examples": [ { "title": "Error-Response: ", "content": "{\"message\": \"Error while creating role\", \"data\": {}}", "type": "object" } ] }, "filename": "routes/api/role.js", "groupTitle": "Role", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/api/role/" } ] }, { "type": "get", "url": "/search/", "title": "provide a specific query for any defined model", "name": "search", "group": "Search", "version": "0.0.8", "parameter": { "fields": { "query": [ { "group": "query", "type": "String", "optional": false, "field": "model", "description": "

the model to be searched

" }, { "group": "query", "type": "Array", "optional": false, "field": "q", "description": "

the query to be executed. For more information on how to format this, please see https://docs.mchacks.ca/architecture/

" }, { "group": "query", "type": "String", "optional": false, "field": "sort", "description": "

either "asc" or "desc"

" }, { "group": "query", "type": "number", "optional": false, "field": "page", "description": "

the page number that you would like

" }, { "group": "query", "type": "number", "optional": false, "field": "limit", "description": "

the maximum number of results that you would like returned

" }, { "group": "query", "type": "any", "optional": false, "field": "sort_by", "description": "

any parameter you want to sort the results by

" }, { "group": "query", "type": "boolean", "optional": false, "field": "expand", "description": "

whether you want to expand sub documents within the results

" } ] } }, "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "String", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "Object", "optional": false, "field": "data", "description": "

Results

" } ] }, "examples": [ { "title": "Success-Response:", "content": "{\n \"message\": \"Successfully executed query, returning all results\",\n \"data\": [\n {...}\n ]\n }", "type": "object" }, { "title": "Success-Response:", "content": "{\n \"message\": \"No results found.\",\n \"data\": {}\n }", "type": "object" } ] }, "error": { "fields": { "Error 4xx": [ { "group": "Error 4xx", "type": "String", "optional": false, "field": "message", "description": "

Error message

" }, { "group": "Error 4xx", "type": "Object", "optional": false, "field": "data", "description": "

empty

" } ] }, "examples": [ { "title": "Error-Response:", "content": "{\"message\": \"Validation failed\", \"data\": {}}", "type": "object" } ] }, "filename": "routes/api/search.js", "groupTitle": "Search", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/search/" } ] }, { "type": "get", "url": "/settings/", "title": "Get the settings for the current hackathon", "name": "getSettings", "group": "Settings", "version": "1.1.1", "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "string", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "object", "optional": false, "field": "data", "description": "

Settings Object

" } ] }, "examples": [ { "title": "Success-Response:", "content": "{\n \"message\": \"Settings creation successful.\",\n \"data\": {\n \"settings\": {\n openTime: \"Wed Feb 06 2019 00:00:00 GMT-0500 (GMT-05:00)\",\n closeTime: \"Sat Feb 01 2020 00:00:00 GMT-0500 (GMT-05:00)\",\n confirmTime: \"Sat Feb 20 2020 00:00:00 GMT-0500 (GMT-05:00)\"\n }\n }\n}", "type": "object" } ] }, "permission": [ { "name": "public" } ], "filename": "routes/api/settings.js", "groupTitle": "Settings", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/settings/" } ] }, { "type": "patch", "url": "/settings/", "title": "Patch the settings for the current hackathon", "name": "patchSettings", "group": "Settings", "version": "1.1.1", "parameter": { "fields": { "body": [ { "group": "body", "type": "Date", "optional": true, "field": "openTime", "description": "

The opening time for the hackathon.

" }, { "group": "body", "type": "Date", "optional": true, "field": "closeTime", "description": "

The closing time for the hackathon.

" }, { "group": "body", "type": "Date", "optional": true, "field": "confirmTime", "description": "

The deadline for confirmation for the hackathon.

" } ] } }, "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "string", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "object", "optional": false, "field": "data", "description": "

Settings Object

" } ] }, "examples": [ { "title": "Success-Response:", "content": "{\n \"message\": \"Settings patch successful.\",\n \"data\": {\n \"settings\": {\n openTime: \"Wed Feb 06 2019 00:00:00 GMT-0500 (GMT-05:00)\",\n closeTime: \"Sat Feb 01 2020 00:00:00 GMT-0500 (GMT-05:00)\",\n confirmTime: \"Sat Feb 20 2020 00:00:00 GMT-0500 (GMT-05:00)\"\n }\n }\n}", "type": "object" } ] }, "permission": [ { "name": "Administrators" } ], "filename": "routes/api/settings.js", "groupTitle": "Settings", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/settings/" } ] }, { "type": "post", "url": "/sponsor/", "title": "create a new sponsor", "name": "createSponsor", "group": "Sponsor", "version": "0.0.8", "parameter": { "fields": { "body": [ { "group": "body", "type": "MongoID", "optional": false, "field": "accountId", "description": "

ObjectID of the respective account.

" }, { "group": "body", "type": "Number", "optional": false, "field": "tier", "description": "

Tier of the sponsor, from 0 to 5. 0 is lowest tier, and 5 is the custom tier.

" }, { "group": "body", "type": "String", "optional": false, "field": "company", "description": "

Name of the company.

" }, { "group": "body", "type": "String", "optional": false, "field": "contractURL", "description": "

URL link to the contract with the company.

" }, { "group": "body", "type": "MongoID[]", "optional": false, "field": "nominees", "description": "

Array of accounts that the company wish to nominate as hackers.

" } ] } }, "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "String", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "Object", "optional": false, "field": "data", "description": "

Sponsor object

" } ] }, "examples": [ { "title": "Success-Response: ", "content": "{\n \"message\": \"Sponsor creation successful\", \n \"data\": {...}\n }", "type": "object" } ] }, "error": { "fields": { "Error 4xx": [ { "group": "Error 4xx", "type": "String", "optional": false, "field": "message", "description": "

Error message

" }, { "group": "Error 4xx", "type": "Object", "optional": false, "field": "data", "description": "

empty

" } ] }, "examples": [ { "title": "Error-Response: ", "content": "{\"message\": \"Error while creating sponsor\", \"data\": {}}", "type": "object" } ] }, "filename": "routes/api/sponsor.js", "groupTitle": "Sponsor", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/sponsor/" } ] }, { "type": "get", "url": "/sponsor/:id", "title": "get a sponsor's information", "name": "getSponsor", "group": "Sponsor", "version": "0.0.8", "parameter": { "fields": { "param": [ { "group": "param", "type": "string", "optional": false, "field": "id", "description": "

a sponsor's unique mongoID

" } ] } }, "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "String", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "Object", "optional": false, "field": "data", "description": "

Sponsor object

" } ] }, "examples": [ { "title": "Success-Response: ", "content": "{\n \"message\": \"Successfully retrieved sponsor information\", \n \"data\": {\n \"id\": \"5bff4d736f86be0a41badb91\",\n \"accountId\": \"5bff4d736f86be0a41badb99\",\n \"tier\": 3,\n \"company\": \"companyName\",\n \"contractURL\": \"https://www.contractHere.com\",\n \"nominees\": [\"5bff4d736f86be0a41badb93\",\"5bff4d736f86be0a41badb94\"]\n }\n }", "type": "object" } ] }, "error": { "fields": { "Error 4xx": [ { "group": "Error 4xx", "type": "String", "optional": false, "field": "message", "description": "

Error message

" }, { "group": "Error 4xx", "type": "Object", "optional": false, "field": "data", "description": "

empty

" } ] }, "examples": [ { "title": "Error-Response: ", "content": "{\"message\": \"Sponsor not found\", \"data\": {}}", "type": "object" } ] }, "filename": "routes/api/sponsor.js", "groupTitle": "Sponsor", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/sponsor/:id" } ] }, { "type": "patch", "url": "/sponsor/", "title": "update a sponsor", "name": "patchSponsor", "group": "Sponsor", "version": "1.3.0", "parameter": { "fields": { "param": [ { "group": "param", "type": "ObjectId", "optional": false, "field": "id", "description": "

ObjectID of the sponsor

" } ], "body": [ { "group": "body", "type": "String", "optional": false, "field": "company", "description": "

Name of the company.

" }, { "group": "body", "type": "String", "optional": false, "field": "contractURL", "description": "

URL link to the contract with the company.

" }, { "group": "body", "type": "ObjectId[]", "optional": false, "field": "nominees", "description": "

Array of accounts that the company wish to nominate as hackers.

" } ] } }, "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "String", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "Object", "optional": false, "field": "data", "description": "

Sponsor object

" } ] }, "examples": [ { "title": "Success-Response: ", "content": "{\n \"message\": \"Sponsor update successful\", \n \"data\": {...}\n }", "type": "object" } ] }, "error": { "fields": { "Error 4xx": [ { "group": "Error 4xx", "type": "String", "optional": false, "field": "message", "description": "

Error message

" }, { "group": "Error 4xx", "type": "Object", "optional": false, "field": "data", "description": "

empty

" } ] }, "examples": [ { "title": "Error-Response: ", "content": "{\"message\": \"Error while updating sponsor\", \"data\": {}}", "type": "object" } ] }, "filename": "routes/api/sponsor.js", "groupTitle": "Sponsor", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/sponsor/" } ] }, { "type": "post", "url": "/team/", "title": "create a new team consisting of only the logged in user", "name": "createTeam", "group": "Team", "version": "0.0.8", "parameter": { "fields": { "body": [ { "group": "body", "type": "String", "optional": false, "field": "name", "description": "

Name of the team.

" }, { "group": "body", "type": "String", "optional": true, "field": "devpostURL", "description": "

Devpost link to hack. Once the link is sent, the hack will be considered to be submitted.

" }, { "group": "body", "type": "String", "optional": true, "field": "projectName", "description": "

Name of the team.

" } ] } }, "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "string", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "object", "optional": false, "field": "data", "description": "

Team object

" } ] }, "examples": [ { "title": "Success-Response: ", "content": "{\n \"message\": \"Team creation successful\", \n \"data\": {...}\n }", "type": "object" } ] }, "error": { "fields": { "Error 4xx": [ { "group": "Error 4xx", "type": "string", "optional": false, "field": "message", "description": "

Error message

" }, { "group": "Error 4xx", "type": "object", "optional": false, "field": "data", "description": "

empty

" } ] }, "examples": [ { "title": "Error-Response: ", "content": "{\"message\": \"Error while creating team\", \"data\": {}}", "type": "object" } ] }, "filename": "routes/api/team.js", "groupTitle": "Team", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/team/" } ] }, { "type": "patch", "url": "/team/leave/", "title": "Allows a logged in hacker to leave current team", "name": "deleteSelfFromTeam", "group": "Team", "version": "1.1.1", "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "string", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "object", "optional": false, "field": "data", "description": "

{}

" } ] }, "examples": [ { "title": "Success-Response:", "content": "{\n \"message\": \"Removal from team successful.\",\n \"data\": {}\n}", "type": "object" } ] }, "filename": "routes/api/team.js", "groupTitle": "Team", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/team/leave/" } ] }, { "type": "get", "url": "/team/:id", "title": "get a team's information", "name": "getTeam", "group": "Team", "version": "0.0.8", "parameter": { "fields": { "param": [ { "group": "param", "type": "ObjectId", "optional": false, "field": "id", "description": "

MongoId of the team

" } ] } }, "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "String", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "Object", "optional": false, "field": "data", "description": "

Team object

" } ] }, "examples": [ { "title": "Success-Response: ", "content": "{\n \"message\": \"Team retrieval successful\", \n \"data\": { \n \"team\": {\n \"name\":\"foo\",\n \"members\": [\n ObjectId('...')\n ],\n \"devpostURL\": \"www.devpost.com/foo\",\n \"projectName\": \"fooey\"\n },\n \"members\": [\n {\n \"firstName\": \"John\",\n \"lastName\": \"Doe\"\n }\n ],\n }\n }", "type": "object" } ] }, "error": { "fields": { "Error 4xx": [ { "group": "Error 4xx", "type": "String", "optional": false, "field": "message", "description": "

Error message

" }, { "group": "Error 4xx", "type": "Object", "optional": false, "field": "data", "description": "

empty

" } ] }, "examples": [ { "title": "Error-Response: ", "content": "{\"message\": \"Team not found\", \"data\": {}}", "type": "object" } ] }, "filename": "routes/api/team.js", "groupTitle": "Team", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/team/:id" } ] }, { "type": "patch", "url": "/team/join/", "title": "Allows a logged in hacker to join a team by name", "name": "patchJoinTeam", "group": "Team", "version": "1.1.1", "parameter": { "fields": { "body": [ { "group": "body", "type": "string", "optional": true, "field": "name", "description": "

Name of the team to join

" } ] } }, "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "string", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "object", "optional": false, "field": "data", "description": "

{}

" } ] }, "examples": [ { "title": "Success-Response:", "content": "{\n \"message\": \"Team join successful.\",\n \"data\": {}\n}", "type": "object" } ] }, "filename": "routes/api/team.js", "groupTitle": "Team", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/team/join/" } ] }, { "type": "patch", "url": "/team/:hackerId", "title": "Update a team's information. The team is specified by the hacker belonging to it.", "name": "patchTeam", "group": "Team", "version": "0.0.8", "description": "

We use hackerId instead of teamId because authorization requires a one-to-one mapping from param id to accountId, but we are not able to have that from teamId to accountId due to multiple members in a team. Instead, we use hackerId, as there is a 1 to 1 link between hackerId to teamId, and a 1 to 1 link between hackerId and accountId

", "parameter": { "fields": { "param": [ { "group": "param", "type": "ObjectId", "optional": false, "field": "hackerId", "description": "

a hacker's unique Id

" } ] } }, "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "String", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "Object", "optional": false, "field": "data", "description": "

Team object

" } ] }, "examples": [ { "title": "Success-Response: ", "content": "{\n \"message\": \"Team update successful.\", \n \"data\": {...}\n }", "type": "object" } ] }, "error": { "fields": { "Error 4xx": [ { "group": "Error 4xx", "type": "String", "optional": false, "field": "message", "description": "

Error message

" }, { "group": "Error 4xx", "type": "Object", "optional": false, "field": "data", "description": "

Query input that caused the error.

" } ] }, "examples": [ { "title": "Error-Response: ", "content": "{\"message\": \"Team not found\", \"data\": {teamId}}", "type": "object" } ] }, "filename": "routes/api/team.js", "groupTitle": "Team", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/team/:hackerId" } ] }, { "type": "post", "url": "/travel/", "title": "create a new travel", "name": "createTravel", "group": "Travel", "version": "2.0.1", "parameter": { "fields": { "body": [ { "group": "body", "type": "MongoID", "optional": false, "field": "accountId", "description": "

ObjectID of the respective account

" }, { "group": "body", "type": "MongoID", "optional": false, "field": "hackerId", "description": "

ObjectID of the respective hacker

" } ] } }, "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "string", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "object", "optional": false, "field": "data", "description": "

Travel object

" } ] }, "examples": [ { "title": "Success-Response: ", "content": "{\n \"message\": \"Travel creation successful\", \n \"data\": {\n \"id\":\"5bff4d736f86be0a41badb91\",\n \"status\": \"None\",\n \"request\": 50,\n \"offer\": 0\n }\n}", "type": "object" } ] }, "error": { "fields": { "Error 4xx": [ { "group": "Error 4xx", "type": "string", "optional": false, "field": "message", "description": "

Error message

" }, { "group": "Error 4xx", "type": "object", "optional": false, "field": "data", "description": "

empty

" } ] }, "examples": [ { "title": "Error-Response: ", "content": "{\"message\": \"Error while creating travel\", \"data\": {}}", "type": "object" } ] }, "filename": "routes/api/travel.js", "groupTitle": "Travel", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/travel/" } ] }, { "type": "get", "url": "/travel/email/:email", "title": "get a travel's information", "name": "getTravel", "group": "Travel", "version": "2.0.1", "parameter": { "fields": { "param": [ { "group": "param", "type": "String", "optional": false, "field": "email", "description": "

a travel's unique email

" } ] } }, "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "String", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "Object", "optional": false, "field": "data", "description": "

Travel object

" } ] }, "examples": [ { "title": "Success-Response: ", "content": "{\n \"message\": \"Successfully retrieved travel information\", \n \"data\": {\n \"id\":\"5bff4d736f86be0a41badb91\",\n \"status\": \"Valid\",\n \"request\": 100,\n \"offer\": 50\n }\n }", "type": "object" } ] }, "error": { "fields": { "Error 4xx": [ { "group": "Error 4xx", "type": "String", "optional": false, "field": "message", "description": "

Error message

" }, { "group": "Error 4xx", "type": "Object", "optional": false, "field": "data", "description": "

empty

" } ] }, "examples": [ { "title": "Error-Response: ", "content": "{\"message\": \"Travel not found\", \"data\": {}}", "type": "object" } ] }, "filename": "routes/api/travel.js", "groupTitle": "Travel", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/travel/email/:email" } ] }, { "type": "get", "url": "/travel/:id", "title": "get a traveler's information", "name": "getTravel", "group": "Travel", "version": "2.0.1", "parameter": { "fields": { "param": [ { "group": "param", "type": "String", "optional": false, "field": "id", "description": "

a travel's unique mongoID

" } ] } }, "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "String", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "Object", "optional": false, "field": "data", "description": "

Travel object

" } ] }, "examples": [ { "title": "Success-Response: ", "content": "{\n \"message\": \"Successfully retrieved travel information\", \n \"data\": {\n \"id\":\"5bff4d736f86be0a41badb91\",\n \"status\": \"Valid\",\n \"request\": 100,\n \"offer\": 50\n }\n }", "type": "object" } ] }, "error": { "fields": { "Error 4xx": [ { "group": "Error 4xx", "type": "String", "optional": false, "field": "message", "description": "

Error message

" }, { "group": "Error 4xx", "type": "Object", "optional": false, "field": "data", "description": "

empty

" } ] }, "examples": [ { "title": "Error-Response: ", "content": "{\"message\": \"Travel not found\", \"data\": {}}", "type": "object" } ] }, "filename": "routes/api/travel.js", "groupTitle": "Travel", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/travel/:id" } ] }, { "type": "patch", "url": "/travel/offer/:id", "title": "update a traveler's offer", "name": "patchTravelOffer", "group": "Travel", "version": "2.0.1", "parameter": { "fields": { "body": [ { "group": "body", "type": "number", "optional": true, "field": "offer", "description": "

Amount of money offered for travel

" } ] } }, "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "string", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "object", "optional": false, "field": "data", "description": "

Travel object

" } ] }, "examples": [ { "title": "Success-Response:", "content": "{\n \"message\": \"Changed travel information\",\n \"data\": {\n \"offer\": 75\n }\n}", "type": "object" } ] }, "permission": [ { "name": "Administrator" } ], "filename": "routes/api/travel.js", "groupTitle": "Travel", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/travel/offer/:id" } ] }, { "type": "patch", "url": "/travel/status/:id", "title": "update a traveler's status", "name": "patchTravelStatus", "group": "Travel", "version": "2.0.1", "parameter": { "fields": { "body": [ { "group": "body", "type": "string", "optional": true, "field": "status", "description": "

Status of the travel's reimbursement ("None"|"Bus"|"Offered"|"Valid"|"Invalid"|"Claimed")

" } ] } }, "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "string", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "object", "optional": false, "field": "data", "description": "

Travel object

" } ] }, "examples": [ { "title": "Success-Response:", "content": "{\n \"message\": \"Changed travel information\",\n \"data\": {\n \"status\": \"Accepted\"\n }\n}", "type": "object" } ] }, "permission": [ { "name": "Administrator" } ], "filename": "routes/api/travel.js", "groupTitle": "Travel", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/travel/status/:id" } ] }, { "type": "get", "url": "/travel/self", "title": "get information about own hacker's travel", "name": "self", "group": "Travel", "version": "2.0.1", "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "string", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "object", "optional": false, "field": "data", "description": "

Travel object

" } ] }, "examples": [ { "title": "Success-Response: ", "content": "{\n \"message\": \"Travel found by logged in account id\", \n \"data\": {\n \"id\":\"5bff4d736f86be0a41badb91\",\n \"status\": \"Claimed\"\n \"request\": 90,\n \"offer\": 80\n } \n }", "type": "object" } ] }, "error": { "fields": { "Error 4xx": [ { "group": "Error 4xx", "type": "string", "optional": false, "field": "message", "description": "

Error message

" }, { "group": "Error 4xx", "type": "object", "optional": false, "field": "data", "description": "

empty

" } ] }, "examples": [ { "title": "Error-Response: ", "content": "{\"message\": \"Travel not found\", \"data\": {}}", "type": "object" } ] }, "filename": "routes/api/travel.js", "groupTitle": "Travel", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/travel/self" } ] }, { "type": "post", "url": "/volunteer/", "title": "create a new volunteer", "name": "createVolunteer", "group": "Volunteer", "version": "0.0.8", "parameter": { "fields": { "body": [ { "group": "body", "type": "MongoID", "optional": false, "field": "accountId", "description": "

MongoID of the account of the volunteer

" } ] } }, "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "string", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "object", "optional": false, "field": "data", "description": "

Volunteer object

" } ] }, "examples": [ { "title": "Success-Response: ", "content": "{\n \"message\": \"Volunteer creation successful\", \n \"data\": {...}\n }", "type": "object" } ] }, "error": { "fields": { "Error 4xx": [ { "group": "Error 4xx", "type": "string", "optional": false, "field": "message", "description": "

Error message

" }, { "group": "Error 4xx", "type": "object", "optional": false, "field": "data", "description": "

empty

" } ] }, "examples": [ { "title": "Error-Response: ", "content": "{\"message\": \"Error while creating volunteer\", \"data\": {}}", "type": "object" } ] }, "filename": "routes/api/volunteer.js", "groupTitle": "Volunteer", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/volunteer/" } ] }, { "type": "get", "url": "/volunteer/:id", "title": "get a volunteer's information", "name": "getVolunteer", "group": "Volunteer", "version": "1.3.0", "parameter": { "fields": { "param": [ { "group": "param", "type": "ObjectId", "optional": false, "field": "id", "description": "

a volunteer's unique mongoID

" } ] } }, "success": { "fields": { "Success 200": [ { "group": "Success 200", "type": "String", "optional": false, "field": "message", "description": "

Success message

" }, { "group": "Success 200", "type": "Object", "optional": false, "field": "data", "description": "

Volunteer object

" } ] }, "examples": [ { "title": "Success-Response: ", "content": "{\n \"message\": \"Successfully retrieved volunteer information\", \n \"data\": {...}\n }", "type": "object" } ] }, "error": { "fields": { "Error 4xx": [ { "group": "Error 4xx", "type": "String", "optional": false, "field": "message", "description": "

Error message

" }, { "group": "Error 4xx", "type": "Object", "optional": false, "field": "data", "description": "

empty

" } ] }, "examples": [ { "title": "Error-Response: ", "content": "{\"message\": \"Volunteer not found\", \"data\": {}}", "type": "object" } ] }, "filename": "routes/api/volunteer.js", "groupTitle": "Volunteer", "sampleRequest": [ { "url": "https://api.mchacks.ca/api/volunteer/:id" } ] } ] +[ + { + "type": "post", + "url": "/account/", + "title": "create a new account", + "name": "create", + "group": "Account", + "version": "0.0.8", + "parameter": { + "fields": { + "body": [ + { + "group": "body", + "type": "String", + "optional": false, + "field": "firstName", + "description": "

First name of the account creator.

" + }, + { + "group": "body", + "type": "String", + "optional": false, + "field": "lastName", + "description": "

Last name of the account creator.

" + }, + { + "group": "body", + "type": "String", + "optional": false, + "field": "pronoun", + "description": "

the pronoun of the account creator.

" + }, + { + "group": "body", + "type": "String", + "optional": false, + "field": "email", + "description": "

Email of the account.

" + }, + { + "group": "body", + "type": "String", + "optional": false, + "field": "gender", + "description": "

Gender of the account creator.

" + }, + { + "group": "body", + "type": "String[]", + "optional": false, + "field": "dietaryRestrictions", + "description": "

Any dietary restrictions for the user. 'None' if there are no restrictions

" + }, + { + "group": "body", + "type": "String", + "optional": false, + "field": "password", + "description": "

The password of the account.

" + }, + { + "group": "body", + "type": "String", + "optional": false, + "field": "birthDate", + "description": "

a Date parsable string.

" + }, + { + "group": "body", + "type": "Number", + "optional": false, + "field": "phoneNumber", + "description": "

the user's phone number, represented as a string.

" + } + ], + "header": [ + { + "group": "header", + "type": "JWT", + "optional": true, + "field": "token", + "description": "

the user's invite token.

" + } + ] + }, + "examples": [ + { + "title": "Request-Example:", + "content": "{ \n \"firstName\": \"Theo\",\n \"lastName\":\"Klein\",\n \"pronoun\":\"he/him\",\n \"email\":\"theo@klein.com\",\n \"password\":\"hunter2\",\n \"phoneNumber\":1234567890,\n \"gender\":\"Male\",\n \"birthDate\":\"10/30/1997\"\n}", + "type": "json" + } + ] + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "string", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "object", + "optional": false, + "field": "data", + "description": "

Account object

" + } + ] + }, + "examples": [ + { + "title": "Success-Response: ", + "content": "{\n \"message\": \"Account creation successful\", \n \"data\": {\n \"id\": ObjectId(\"5bff8b9f3274cf001bc71048\"),\n \t\"firstName\": \"Theo\",\n \"lastName\":\"Klein\",\n \"pronoun\":\"he/him\",\n \"email\":\"theo@klein.com\",\n \"phoneNumber\":1234567890,\n \t\"gender\":\"Male\",\n \"birthDate\":Date(\"10/30/1997\")\n }\n }", + "type": "object" + } + ] + }, + "error": { + "fields": { + "Error 4xx": [ + { + "group": "Error 4xx", + "type": "string", + "optional": false, + "field": "message", + "description": "

Error message

" + }, + { + "group": "Error 4xx", + "type": "object", + "optional": false, + "field": "data", + "description": "

empty

" + } + ] + }, + "examples": [ + { + "title": "Error-Response: ", + "content": "{\n \"message\": \"Account already exists\", \n \"data\": {\n \"route\": \"/\"\n }\n}", + "type": "object" + } + ] + }, + "filename": "routes/api/account.js", + "groupTitle": "Account", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/account/" + } + ] + }, + { + "type": "get", + "url": "/account/:id", + "title": "gets information from an account with mongoid ':id'", + "name": "getAccount", + "group": "Account", + "version": "0.0.8", + "parameter": { + "fields": { + "param": [ + { + "group": "param", + "type": "ObjectId", + "optional": false, + "field": "id", + "description": "

MongoId of an account

" + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "string", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "object", + "optional": false, + "field": "data", + "description": "

Account object

" + } + ] + }, + "examples": [ + { + "title": "Success-Response: ", + "content": "{\n \"message\": \"Account found by user id\", \n \"data\": {\n \"id\": ObjectId(\"5bff8b9f3274cf001bc71048\"),\n \"firstName\": \"Theo\",\n \"lastName\":\"Klein\",\n \"pronoun\":\"he/him\",\n \"email\":\"theo@klein.com\",\n \"phoneNumber\":1234567890,\n \"gender\":\"Male\",\n \"birthDate\":Date(\"10/30/1997\")\n }\n }", + "type": "object" + } + ] + }, + "error": { + "fields": { + "Error 4xx": [ + { + "group": "Error 4xx", + "type": "string", + "optional": false, + "field": "message", + "description": "

Error message

" + }, + { + "group": "Error 4xx", + "type": "object", + "optional": false, + "field": "data", + "description": "

empty

" + } + ] + }, + "examples": [ + { + "title": "Error-Response: ", + "content": "{\"message\": \"Account not found\", \"data\": {}}", + "type": "object" + } + ] + }, + "filename": "routes/api/account.js", + "groupTitle": "Account", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/account/:id" + } + ] + }, + { + "type": "get", + "url": "/account/invite", + "title": "Get all of the invites.", + "name": "getAllInvites", + "group": "Account", + "version": "0.0.8", + "description": "

Get all of the invites that currently exist in the database.

", + "success": { + "examples": [ + { + "title": "Success-Response: ", + "content": "{\n \"message\": \"Invite retrieval successful.\", \n \"data\": [{\n \"email\":\"abc@def.com\",\n \"accountType\":\"Hacker\"\n }]\n }", + "type": "object" + } + ] + }, + "filename": "routes/api/account.js", + "groupTitle": "Account", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/account/invite" + } + ] + }, + { + "type": "post", + "url": "/account/invite", + "title": "invites a user to create an account with the specified accountType", + "name": "inviteAccount", + "group": "Account", + "version": "0.0.8", + "description": "

sends link with token to be used with the account/create route

", + "parameter": { + "fields": { + "body": [ + { + "group": "body", + "type": "String", + "optional": true, + "field": "email", + "description": "

email of the account to be created and where to send the link

" + }, + { + "group": "body", + "type": "String", + "optional": true, + "field": "accountType", + "description": "

the type of the account which the user can create, for sponsor this should specify tier as well

" + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "string", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "object", + "optional": false, + "field": "data", + "description": "

Account object

" + } + ] + }, + "examples": [ + { + "title": "Success-Response: ", + "content": "{\n \"message\": \"Successfully invited user\", \n \"data\": {}\n }", + "type": "object" + } + ] + }, + "error": { + "fields": { + "Error 4xx": [ + { + "group": "Error 4xx", + "type": "string", + "optional": false, + "field": "message", + "description": "

Error message

" + }, + { + "group": "Error 4xx", + "type": "object", + "optional": false, + "field": "data", + "description": "

Error object

" + } + ] + }, + "examples": [ + { + "title": "Error-Response:", + "content": "{\n \"message\": \"Invalid Authentication\",\n \"data\": {\n \"route\": \"/invite\"\n }\n }", + "type": "object" + } + ] + }, + "filename": "routes/api/account.js", + "groupTitle": "Account", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/account/invite" + } + ] + }, + { + "type": "get", + "url": "/account/self", + "title": "get information about own account", + "name": "self", + "group": "Account", + "version": "0.0.8", + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "string", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "object", + "optional": false, + "field": "data", + "description": "

Account object

" + } + ] + }, + "examples": [ + { + "title": "Success-Response: ", + "content": "{\n \"message\": \"Account found by user email\", \n \"data\": {\n \t\"id\": ObjectId(\"5bff8b9f3274cf001bc71048\"),\n \t\"firstName\": \"Theo\",\n \"lastName\":\"Klein\",\n \"pronoun\":\"he/him\",\n \"email\":\"theo@klein.com\",\n \"phoneNumber\":1234567890,\n \t\"gender\":\"Male\",\n \"birthDate\":Date(\"10/30/1997\")\n }\n }", + "type": "object" + } + ] + }, + "error": { + "fields": { + "Error 4xx": [ + { + "group": "Error 4xx", + "type": "string", + "optional": false, + "field": "message", + "description": "

Error message

" + }, + { + "group": "Error 4xx", + "type": "object", + "optional": false, + "field": "data", + "description": "

empty object

" + } + ] + }, + "examples": [ + { + "title": "Error-Response: ", + "content": "{\"message\": \"Account not found\", \"data\": {}}", + "type": "object" + } + ] + }, + "filename": "routes/api/account.js", + "groupTitle": "Account", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/account/self" + } + ] + }, + { + "type": "patch", + "url": "/account/:id", + "title": "update an account's information", + "name": "updateOneUser", + "group": "Account", + "version": "0.0.8", + "parameter": { + "fields": { + "body": [ + { + "group": "body", + "type": "String", + "optional": true, + "field": "firstName", + "description": "

First name of the account creator.

" + }, + { + "group": "body", + "type": "String", + "optional": true, + "field": "lastName", + "description": "

Last name of the account creator.

" + }, + { + "group": "body", + "type": "String", + "optional": true, + "field": "pronoun", + "description": "

The pronoun of the account creator.

" + }, + { + "group": "body", + "type": "String", + "optional": true, + "field": "email", + "description": "

Email of the account.

" + }, + { + "group": "body", + "type": "String", + "optional": true, + "field": "gender", + "description": "

Gender of the account creator.

" + }, + { + "group": "body", + "type": "String", + "optional": true, + "field": "birthDate", + "description": "

A Date parsable string.

" + }, + { + "group": "body", + "type": "Number", + "optional": true, + "field": "phoneNumber", + "description": "

The user's phone number, represented as a string.

" + }, + { + "group": "body", + "type": "String[]", + "optional": true, + "field": "dietaryRestrictions", + "description": "

Any dietary restrictions for the user. 'None' if there are no restrictions

" + } + ] + }, + "examples": [ + { + "title": "Request-Example:", + "content": "{ \"gender\": \"Male\" }", + "type": "json" + } + ] + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "string", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "object", + "optional": false, + "field": "data", + "description": "

Account object

" + } + ] + }, + "examples": [ + { + "title": "Success-Response: ", + "content": "{\n \"message\": \"Account update successful.\", \n \"data\": {\n \"id\": ObjectId(\"5bff8b9f3274cf001bc71048\"),\n \t\"firstName\": \"Theo\",\n \"lastName\":\"Klein\",\n \"pronoun\":\"he/him\",\n \"email\":\"theo@klein.com\",\n \"phoneNumber\":1234567890,\n \t\"gender\": \"Male\",\n \"birthDate\":Date(\"10/30/1997\")\n }\n }", + "type": "object" + } + ] + }, + "error": { + "fields": { + "Error 4xx": [ + { + "group": "Error 4xx", + "type": "string", + "optional": false, + "field": "message", + "description": "

Error message

" + }, + { + "group": "Error 4xx", + "type": "object", + "optional": false, + "field": "data", + "description": "

empty

" + } + ] + }, + "examples": [ + { + "title": "Error-Response: ", + "content": "{\"message\": \"Error while updating account\", \"data\": {}}", + "type": "object" + } + ] + }, + "filename": "routes/api/account.js", + "groupTitle": "Account", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/account/:id" + } + ] + }, + { + "type": "patch", + "url": "/auth/password/change", + "title": "change password for logged in user", + "name": "changePassword", + "group": "Authentication", + "version": "0.0.8", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "oldPassword", + "description": "

The current password of the user

" + }, + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "newPassword", + "description": "

The new password of the user

" + } + ] + }, + "examples": [ + { + "title": "Request-Example:", + "content": "{\n \"oldPassword\": \"password12345\",\n \"newPassword\": \"password123456\"\n}", + "type": "json" + } + ] + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "string", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "object", + "optional": false, + "field": "data", + "description": "

empty

" + } + ] + }, + "examples": [ + { + "title": "Success-Response:", + "content": "{\"message\": \"Successfully reset password\", \"data\": {}}", + "type": "json" + } + ] + }, + "permission": [ + { + "name": ": Must be logged in" + } + ], + "filename": "routes/api/auth.js", + "groupTitle": "Authentication", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/auth/password/change" + } + ] + }, + { + "type": "post", + "url": "/auth/confirm/:token", + "title": "confirm account using the JWT in :token", + "name": "confirmAccount", + "group": "Authentication", + "version": "0.0.8", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "JWT", + "description": "

for confirming the account

" + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "string", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "object", + "optional": false, + "field": "data", + "description": "

empty

" + } + ] + }, + "examples": [ + { + "title": "Success-Response:", + "content": "{\"message\": \"Successfully confirmed account\", \"data\": {}}", + "type": "json" + } + ] + }, + "error": { + "fields": { + "Error 4xx": [ + { + "group": "Error 4xx", + "type": "string", + "optional": false, + "field": "message", + "description": "

Error message

" + }, + { + "group": "Error 4xx", + "type": "object", + "optional": false, + "field": "data", + "description": "

empty

" + } + ] + }, + "examples": [ + { + "title": "Error-Response:", + "content": "{\"message\": \"Invalid token for confirming account, \"data\": {}}", + "type": "object" + } + ] + }, + "filename": "routes/api/auth.js", + "groupTitle": "Authentication", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/auth/confirm/:token" + } + ] + }, + { + "type": "post", + "url": "/auth/password/forgot", + "title": "forgot password route", + "name": "forgotPassword", + "group": "Authentication", + "version": "0.0.8", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "email", + "description": "

the email address of the account

" + } + ] + }, + "examples": [ + { + "title": "Request-Example:", + "content": "{ \"email\": \"myemail@mchacks.ca\" }", + "type": "json" + } + ] + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "string", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "object", + "optional": false, + "field": "data", + "description": "

empty

" + } + ] + }, + "examples": [ + { + "title": "Success-Response:", + "content": "{\"message\": \"Sent reset email\", \"data\": {}}", + "type": "json" + } + ] + }, + "permission": [ + { + "name": ": public" + } + ], + "filename": "routes/api/auth.js", + "groupTitle": "Authentication", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/auth/password/forgot" + } + ] + }, + { + "type": "get", + "url": "/auth/rolebindings/:id", + "title": "retrieve rolebindings for a user given by their user id :id", + "name": "getRoleBindings", + "group": "Authentication", + "version": "0.0.8", + "parameter": { + "fields": { + "param": [ + { + "group": "param", + "type": "ObjectId", + "optional": false, + "field": "id", + "description": "

MongoId of an account

" + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "string", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "object", + "optional": false, + "field": "data", + "description": "

Rolebindings object

" + } + ] + }, + "examples": [ + { + "title": "Success-Response: ", + "content": "{\n \"message\": \"Successfully retrieved role bindings\",\n \"data\": {\n accountId:\"5beca4ab2e069a34f91697b2\"\n id:\"5beca4ae2e069a34f91698b1\"\n roles: [\n {\n _id:\"5beca4ab2e069a34f91697d9\",\n name:\"hacker\",\n routes: [\n {_id: \"5beca4ae2e069a34f9169852\", requestType: \"POST\", uri: \"/api/auth/login\"},\n {_id: \"5beca4ae2e069a34f9169851\", requestType: \"POST\", uri: \"/api/auth/logout\"},\n {_id: \"5beca4ae2e069a34f9169850\", requestType: \"GET\", uri: \"/api/auth/rolebindings/:self\"},\n {_id: \"5beca4ae2e069a34f916984f\", requestType: \"GET\", uri: \"/api/account/self\"},\n {_id: \"5beca4ae2e069a34f916984e\", requestType: \"GET\", uri: \"/api/account/:self\"},\n {_id: \"5beca4ae2e069a34f916984d\", requestType: \"PATCH\", uri: \"/api/account/:self\"},\n {_id: \"5beca4ae2e069a34f916984c\", requestType: \"POST\", uri: \"/api/hacker/\"},\n {_id: \"5beca4ae2e069a34f916984b\", requestType: \"GET\", uri: \"/api/hacker/:self\"},\n {_id: \"5beca4ae2e069a34f916984a\", requestType: \"GET\", uri: \"/api/hacker/:self/resume\"},\n {_id: \"5beca4ae2e069a34f9169849\", requestType: \"PATCH\", uri: \"/api/hacker/:self\"}\n ]\n }\n ]\n }\n }", + "type": "object" + } + ] + }, + "error": { + "fields": { + "Error 4xx": [ + { + "group": "Error 4xx", + "type": "string", + "optional": false, + "field": "message", + "description": "

Error message

" + }, + { + "group": "Error 4xx", + "type": "object", + "optional": false, + "field": "data", + "description": "

empty

" + } + ] + }, + "examples": [ + { + "title": "Error-Response: ", + "content": "{\"message\": \"Role Bindings not found\", \"data\": {}}", + "type": "object" + } + ] + }, + "filename": "routes/api/auth.js", + "groupTitle": "Authentication", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/auth/rolebindings/:id" + } + ] + }, + { + "type": "get", + "url": "/auth/roles", + "title": "get roles", + "name": "getRoles", + "description": "

get all roles that exist in the database

", + "group": "Authentication", + "version": "0.0.8", + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "string", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "object", + "optional": false, + "field": "data", + "description": "

empty

" + } + ] + }, + "examples": [ + { + "title": "Success-Response:", + "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\"}]", + "type": "json" + } + ] + }, + "filename": "routes/api/auth.js", + "groupTitle": "Authentication", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/auth/roles" + } + ] + }, + { + "type": "post", + "url": "/auth/login", + "title": "login to the service", + "name": "login", + "group": "Authentication", + "version": "0.0.8", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "string", + "optional": false, + "field": "email", + "description": "

Account email

" + }, + { + "group": "Parameter", + "type": "string", + "optional": false, + "field": "password", + "description": "

Account password

" + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "string", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "object", + "optional": false, + "field": "data", + "description": "

empty

" + } + ] + }, + "examples": [ + { + "title": "Success-Response: ", + "content": "{\"message\": \"Successfully logged in\", \"data\": {}}", + "type": "object" + } + ] + }, + "error": { + "fields": { + "Error 4xx": [ + { + "group": "Error 4xx", + "type": "string", + "optional": false, + "field": "message", + "description": "

Error message

" + }, + { + "group": "Error 4xx", + "type": "object", + "optional": false, + "field": "data", + "description": "

empty

" + } + ] + }, + "examples": [ + { + "title": "Error-Response: ", + "content": "{\"message\": \"Invalid Authentication\", \"data\": {}}", + "type": "object" + } + ] + }, + "permission": [ + { + "name": ": public" + } + ], + "filename": "routes/api/auth.js", + "groupTitle": "Authentication", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/auth/login" + } + ] + }, + { + "type": "get", + "url": "/auth/logout", + "title": "logout of service", + "name": "logout", + "group": "Authentication", + "version": "0.0.8", + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "string", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "object", + "optional": false, + "field": "data", + "description": "

empty

" + } + ] + }, + "examples": [ + { + "title": "Success-Response:", + "content": "{\"message\": \"Successfully logged out\", \"data\": {}}", + "type": "object" + } + ] + }, + "permission": [ + { + "name": ": public" + } + ], + "filename": "routes/api/auth.js", + "groupTitle": "Authentication", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/auth/logout" + } + ] + }, + { + "type": "get", + "url": "/auth/confirm/resend", + "title": "resend confirmation token", + "name": "resendConfirmAccount", + "group": "Authentication", + "version": "0.0.8", + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "string", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "object", + "optional": false, + "field": "data", + "description": "

empty

" + } + ] + }, + "examples": [ + { + "title": "Success-Response:", + "content": "{\"message\": \"Successfully resent confirmation email\", \"data\": {}}", + "type": "json" + } + ] + }, + "error": { + "fields": { + "Error 4xx": [ + { + "group": "Error 4xx", + "type": "string", + "optional": false, + "field": "message", + "description": "

Error message

" + }, + { + "group": "Error 4xx", + "type": "object", + "optional": false, + "field": "data", + "description": "

empty

" + } + ] + }, + "examples": [ + { + "title": "Error-Response:", + "content": " HTTP/1.1 422\n{\"message\": \"Account already confirmed\", \"data\": {}}", + "type": "json" + }, + { + "title": "Error-Response:", + "content": " HTTP/1.1 428\n{\"message\": \"Account confirmation token does not exist\", \"data\": {}}", + "type": "json" + } + ] + }, + "filename": "routes/api/auth.js", + "groupTitle": "Authentication", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/auth/confirm/resend" + } + ] + }, + { + "type": "post", + "url": "/auth/password/reset", + "title": "reset password", + "name": "resetPassword", + "group": "Authentication", + "version": "0.0.8", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "String", + "optional": false, + "field": "password", + "description": "

the password of the account

" + } + ] + }, + "examples": [ + { + "title": "Request-Example:", + "content": "{ \"password\": \"hunter2\" }", + "type": "json" + } + ] + }, + "header": { + "fields": { + "Header": [ + { + "group": "Header", + "type": "String", + "optional": false, + "field": "Authentication", + "description": "

the token that was provided in the reset password email

" + } + ] + }, + "examples": [ + { + "title": "Header-Example:", + "content": "{\n \"X-Reset-Token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c\"\n}", + "type": "json" + } + ] + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "string", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "object", + "optional": false, + "field": "data", + "description": "

empty

" + } + ] + }, + "examples": [ + { + "title": "Success-Response:", + "content": "{\"message\": \"Successfully reset password\", \"data\": {}}", + "type": "json" + } + ] + }, + "permission": [ + { + "name": ": must have authentication token" + } + ], + "filename": "routes/api/auth.js", + "groupTitle": "Authentication", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/auth/password/reset" + } + ] + }, + { + "type": "patch", + "url": "/hacker/batchAccept/", + "title": "accept array of Hackers", + "name": "acceptHacker", + "group": "Hacker", + "version": "3.0.0", + "parameter": { + "fields": { + "body) {{ids: ObjectId[]}} Array of id(s": [ + { + "group": "body) {{ids: ObjectId[]}} Array of id(s", + "optional": false, + "field": "that", + "description": "

needed to be accepted

" + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "string", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "object", + "optional": false, + "field": "data", + "description": "

success_ids array and errors array. Errors array will contain a detailed error for why the batch update for a given ID did not work

" + } + ] + }, + "examples": [ + { + "title": "Success-Response:", + "content": "{\n \"message\": \"Hacker batch update successful.\",\n \"data\": {\n \"success_ids\": [\"id1\", \"id2\"]\n \"errors\": [{status: 404, message: \"ACCOUNT_NOT_FOUND\", account: null, hacker_id: \"id3\"}]\n }\n}", + "type": "object" + } + ] + }, + "permission": [ + { + "name": "Administrator" + } + ], + "filename": "routes/api/hacker.js", + "groupTitle": "Hacker", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/hacker/batchAccept/" + } + ] + }, + { + "type": "patch", + "url": "/hacker/acceptEmail/:email", + "title": "accept a Hacker by email", + "name": "acceptHacker", + "group": "Hacker", + "version": "2.0.0", + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "string", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "object", + "optional": false, + "field": "data", + "description": "

Hacker object

" + } + ] + }, + "examples": [ + { + "title": "Success-Response:", + "content": "{\n \"message\": \"Changed hacker information\",\n \"data\": {\n \"status\": \"Accepted\"\n }\n}", + "type": "object" + } + ] + }, + "permission": [ + { + "name": "Administrator" + } + ], + "filename": "routes/api/hacker.js", + "groupTitle": "Hacker", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/hacker/acceptEmail/:email" + } + ] + }, + { + "type": "patch", + "url": "/hacker/accept/:id", + "title": "accept a Hacker", + "name": "acceptHacker", + "group": "Hacker", + "version": "2.0.0", + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "string", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "object", + "optional": false, + "field": "data", + "description": "

Hacker object

" + } + ] + }, + "examples": [ + { + "title": "Success-Response:", + "content": "{\n \"message\": \"Changed hacker information\",\n \"data\": {\n \"status\": \"Accepted\"\n }\n}", + "type": "object" + } + ] + }, + "permission": [ + { + "name": "Administrator" + } + ], + "filename": "routes/api/hacker.js", + "groupTitle": "Hacker", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/hacker/accept/:id" + } + ] + }, + { + "type": "patch", + "url": "/hacker/checkin/:id", + "title": "update a hacker's status to be 'Checked-in'. Note that the Hacker must eitehr be Accepted or Confirmed.", + "name": "checkinHacker", + "group": "Hacker", + "version": "0.0.9", + "parameter": { + "fields": { + "body": [ + { + "group": "body", + "type": "string", + "optional": true, + "field": "status", + "description": "

Check-in status. "Checked-in"

" + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "string", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "object", + "optional": false, + "field": "data", + "description": "

Hacker object

" + } + ] + }, + "examples": [ + { + "title": "Success-Response:", + "content": "{\n \"message\": \"Changed hacker information\",\n \"data\": {\n \"status\": \"Checked-in\"\n }\n}", + "type": "object" + } + ] + }, + "permission": [ + { + "name": "Administrator" + }, + { + "name": "Volunteer" + } + ], + "filename": "routes/api/hacker.js", + "groupTitle": "Hacker", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/hacker/checkin/:id" + } + ] + }, + { + "type": "post", + "url": "/hacker/", + "title": "create a new hacker", + "name": "createHacker", + "group": "Hacker", + "version": "0.0.8", + "parameter": { + "fields": { + "body": [ + { + "group": "body", + "type": "MongoID", + "optional": false, + "field": "accountId", + "description": "

ObjectID of the respective account

" + }, + { + "group": "body", + "type": "String", + "optional": false, + "field": "school", + "description": "

Name of the school the hacker goes to

" + }, + { + "group": "body", + "type": "String", + "optional": false, + "field": "gender", + "description": "

Gender of the hacker

" + }, + { + "group": "body", + "type": "Number", + "optional": false, + "field": "travel", + "description": "

Whether the hacker requires a bus for transportation

" + }, + { + "group": "body", + "type": "String[]", + "optional": false, + "field": "ethnicity", + "description": "

the ethnicities of the hacker

" + }, + { + "group": "body", + "type": "String[]", + "optional": false, + "field": "major", + "description": "

the major of the hacker

" + }, + { + "group": "body", + "type": "Number", + "optional": false, + "field": "graduationYear", + "description": "

the graduation year of the hacker

" + }, + { + "group": "body", + "type": "Boolean", + "optional": false, + "field": "codeOfConduct", + "description": "

acceptance of the code of conduct

" + }, + { + "group": "body", + "type": "Json", + "optional": false, + "field": "application", + "description": "

The hacker's application. Resume and jobInterest fields are required.

" + } + ] + }, + "examples": [ + { + "title": "application: ", + "content": "{\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"previousHackathons\":\"5+\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n}", + "type": "Json" + } + ] + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "string", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "object", + "optional": false, + "field": "data", + "description": "

Hacker object

" + } + ] + }, + "examples": [ + { + "title": "Success-Response: ", + "content": "{\n \"message\": \"Hacker creation successful\", \n \"data\": {\n \"id\":\"5bff4d736f86be0a41badb91\",\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"previousHackathons\":\"5+\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n}", + "type": "object" + } + ] + }, + "error": { + "fields": { + "Error 4xx": [ + { + "group": "Error 4xx", + "type": "string", + "optional": false, + "field": "message", + "description": "

Error message

" + }, + { + "group": "Error 4xx", + "type": "object", + "optional": false, + "field": "data", + "description": "

empty

" + } + ] + }, + "examples": [ + { + "title": "Error-Response: ", + "content": "{\"message\": \"Error while creating hacker\", \"data\": {}}", + "type": "object" + } + ] + }, + "filename": "routes/api/hacker.js", + "groupTitle": "Hacker", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/hacker/" + } + ] + }, + { + "type": "get", + "url": "/hacker/:id", + "title": "get a hacker's information", + "name": "getHacker", + "group": "Hacker", + "version": "0.0.8", + "parameter": { + "fields": { + "param": [ + { + "group": "param", + "type": "String", + "optional": false, + "field": "id", + "description": "

a hacker's unique mongoID

" + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "String", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "Object", + "optional": false, + "field": "data", + "description": "

Hacker object

" + } + ] + }, + "examples": [ + { + "title": "Success-Response: ", + "content": "{\n \"message\": \"Successfully retrieved hacker information\", \n \"data\": {\n \"id\":\"5bff4d736f86be0a41badb91\",\n \"status\": \"Applied\",\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"previousHackathons\":\"5+\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n }\n }", + "type": "object" + } + ] + }, + "error": { + "fields": { + "Error 4xx": [ + { + "group": "Error 4xx", + "type": "String", + "optional": false, + "field": "message", + "description": "

Error message

" + }, + { + "group": "Error 4xx", + "type": "Object", + "optional": false, + "field": "data", + "description": "

empty

" + } + ] + }, + "examples": [ + { + "title": "Error-Response: ", + "content": "{\"message\": \"Hacker not found\", \"data\": {}}", + "type": "object" + } + ] + }, + "filename": "routes/api/hacker.js", + "groupTitle": "Hacker", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/hacker/:id" + } + ] + }, + { + "type": "get", + "url": "/hacker/email/:email", + "title": "get a hacker's information", + "name": "getHacker", + "group": "Hacker", + "version": "0.0.8", + "parameter": { + "fields": { + "param": [ + { + "group": "param", + "type": "String", + "optional": false, + "field": "email", + "description": "

a hacker's unique email

" + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "String", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "Object", + "optional": false, + "field": "data", + "description": "

Hacker object

" + } + ] + }, + "examples": [ + { + "title": "Success-Response: ", + "content": "{\n \"message\": \"Successfully retrieved hacker information\", \n \"data\": {\n \"id\":\"5bff4d736f86be0a41badb91\",\n \"status\": \"Applied\",\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"previousHackathons\":\"5+\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n }\n }", + "type": "object" + } + ] + }, + "error": { + "fields": { + "Error 4xx": [ + { + "group": "Error 4xx", + "type": "String", + "optional": false, + "field": "message", + "description": "

Error message

" + }, + { + "group": "Error 4xx", + "type": "Object", + "optional": false, + "field": "data", + "description": "

empty

" + } + ] + }, + "examples": [ + { + "title": "Error-Response: ", + "content": "{\"message\": \"Hacker not found\", \"data\": {}}", + "type": "object" + } + ] + }, + "filename": "routes/api/hacker.js", + "groupTitle": "Hacker", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/hacker/email/:email" + } + ] + }, + { + "type": "get", + "url": "/hacker/resume:id", + "title": "get the resume for a hacker.", + "name": "getHackerResume", + "group": "Hacker", + "version": "0.0.8", + "parameter": { + "fields": { + "param": [ + { + "group": "param", + "type": "ObjectId", + "optional": false, + "field": "id", + "description": "

Hacker id

" + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "String", + "optional": false, + "field": "message", + "description": "

Success message

" + } + ] + }, + "examples": [ + { + "title": "Success-Response:", + "content": "HTTP/1.1 200 OK\n{\n message: \"Downloaded resume\",\n data: {\n id: \"507f191e810c19729de860ea\",\n resume: [Buffer]\n }\n}", + "type": "json" + } + ] + }, + "error": { + "fields": { + "Error 4xx": [ + { + "group": "Error 4xx", + "type": "String", + "optional": false, + "field": "message", + "description": "

"Resume does not exist"

" + } + ] + }, + "examples": [ + { + "title": "Error-Response:", + "content": "HTTP/1.1 404\n{\n message: \"Resume not found\",\n data: {}\n}", + "type": "json" + } + ] + }, + "permission": [ + { + "name": "Must be logged in, and the account id must be linked to the hacker." + } + ], + "filename": "routes/api/hacker.js", + "groupTitle": "Hacker" + }, + { + "type": "get", + "url": "/hacker/stats", + "title": "Gets the stats of all of the hackers who have applied.", + "name": "getHackerStats", + "group": "Hacker", + "version": "0.0.9", + "parameter": { + "fields": { + "query": [ + { + "group": "query", + "type": "String", + "optional": false, + "field": "model", + "description": "

the model to be searched (Only hacker supported)

" + }, + { + "group": "query", + "type": "Array", + "optional": false, + "field": "q", + "description": "

the query to be executed. For more information on how to format this, please see https://docs.mchacks.ca/architecture/

" + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "string", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "object", + "optional": false, + "field": "data", + "description": "

Hacker object

" + } + ] + }, + "examples": [ + { + "title": "Success-Response: ", + "content": "{\n \"message\": \"Retrieved stats\",\n \"data\": {\n \"stats\" : {\n \"total\": 10,\n \"status\": { \"Applied\": 10 },\n \"school\": { \"McGill University\": 3, \"Harvard University\": 7 },\n degree: { \"Undergraduate\": 10 },\n gender: { \"Male\": 1, \"Female\": 9 },\n travel: { \"true\": 7, \"false\": 3 },\n ethnicity: { \"White\": 10, },\n jobInterest: { \"Internship\": 10 },\n major: { \"Computer Science\": 10 },\n graduationYear: { \"2019\": 10 },\n dietaryRestrictions: { \"None\": 10 },\n shirtSize: { \"M\": 3, \"XL\": 7 },\n age: { \"22\": 10 }\n }\n }\n}", + "type": "object" + } + ] + }, + "filename": "routes/api/hacker.js", + "groupTitle": "Hacker", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/hacker/stats" + } + ] + }, + { + "type": "patch", + "url": "/hacker/:id", + "title": "update a hacker's information.", + "description": "

This route only contains the ability to update a subset of a hacker's information. If you want to update a status, you must have Admin priviledges and use PATCH /hacker/status/:id.

", + "name": "patchHacker", + "group": "Hacker", + "version": "0.0.8", + "parameter": { + "fields": { + "body": [ + { + "group": "body", + "type": "String", + "optional": true, + "field": "school", + "description": "

Name of the school the hacker goes to

" + }, + { + "group": "body", + "type": "String", + "optional": true, + "field": "gender", + "description": "

Gender of the hacker

" + }, + { + "group": "body", + "type": "Number", + "optional": true, + "field": "travel", + "description": "

How much the hacker requires a bus for transportation

" + }, + { + "group": "body", + "type": "String[]", + "optional": true, + "field": "ethnicity", + "description": "

the ethnicities of the hacker

" + }, + { + "group": "body", + "type": "String[]", + "optional": true, + "field": "major", + "description": "

the major of the hacker

" + }, + { + "group": "body", + "type": "Number", + "optional": true, + "field": "graduationYear", + "description": "

the graduation year of the hacker

" + }, + { + "group": "body", + "type": "Json", + "optional": true, + "field": "application", + "description": "

The hacker's application

" + } + ] + }, + "examples": [ + { + "title": "application: ", + "content": "{\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"previousHackathons\":\"5+\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n }", + "type": "Json" + } + ] + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "string", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "object", + "optional": false, + "field": "data", + "description": "

Hacker object

" + } + ] + }, + "examples": [ + { + "title": "Success-Response: ", + "content": "{\n \"message\": \"Changed hacker information\", \n \"data\": {\n \"id\":\"5bff4d736f86be0a41badb91\",\n \"status\": \"Applied\",\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"previousHackathons\":\"5+\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n }\n}", + "type": "object" + } + ] + }, + "error": { + "fields": { + "Error 4xx": [ + { + "group": "Error 4xx", + "type": "string", + "optional": false, + "field": "message", + "description": "

Error message

" + }, + { + "group": "Error 4xx", + "type": "object", + "optional": false, + "field": "data", + "description": "

empty

" + } + ] + }, + "examples": [ + { + "title": "Error-Response: ", + "content": "{\"message\": \"Error while updating hacker\", \"data\": {}}", + "type": "object" + } + ] + }, + "filename": "routes/api/hacker.js", + "groupTitle": "Hacker", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/hacker/:id" + } + ] + }, + { + "type": "patch", + "url": "/hacker/confirmation/:id", + "title": "Allows confirmation of hacker attendence if they are accepted. Also allows change from 'confirmed' to 'withdrawn'.", + "name": "patchHackerConfirmed", + "group": "Hacker", + "version": "0.0.9", + "parameter": { + "fields": { + "body": [ + { + "group": "body", + "type": "string", + "optional": true, + "field": "status", + "description": "

The new status of the hacker. "Accepted", "Confirmed", or "Withdrawn"

" + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "string", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "object", + "optional": false, + "field": "data", + "description": "

Hacker object

" + } + ] + }, + "examples": [ + { + "title": "Success-Response:", + "content": "{\n \"message\": \"Changed hacker information\",\n \"data\": {\n \"status\": \"Confirmed\"\n }\n}", + "type": "object" + } + ] + }, + "permission": [ + { + "name": "Administrator" + }, + { + "name": "Hacker" + } + ], + "filename": "routes/api/hacker.js", + "groupTitle": "Hacker", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/hacker/confirmation/:id" + } + ] + }, + { + "type": "patch", + "url": "/hacker/status/:id", + "title": "update a hacker's status", + "name": "patchHackerStatus", + "group": "Hacker", + "version": "0.0.9", + "parameter": { + "fields": { + "body": [ + { + "group": "body", + "type": "string", + "optional": true, + "field": "status", + "description": "

Status of the hacker's application ("None"|"Applied"|"Accepted"|"Declined"|"Waitlisted"|"Confirmed"|"Withdrawn"|"Checked-in")

" + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "string", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "object", + "optional": false, + "field": "data", + "description": "

Hacker object

" + } + ] + }, + "examples": [ + { + "title": "Success-Response:", + "content": "{\n \"message\": \"Changed hacker information\",\n \"data\": {\n \"status\": \"Accepted\"\n }\n}", + "type": "object" + } + ] + }, + "permission": [ + { + "name": "Administrator" + } + ], + "filename": "routes/api/hacker.js", + "groupTitle": "Hacker", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/hacker/status/:id" + } + ] + }, + { + "type": "post", + "url": "/hacker/resume/:id", + "title": "upload or update resume for a hacker.", + "name": "postHackerResume", + "group": "Hacker", + "version": "0.0.8", + "description": "

NOTE: This must be sent via multipart/form-data POST request

", + "parameter": { + "fields": { + "param": [ + { + "group": "param", + "type": "ObjectId", + "optional": false, + "field": "id", + "description": "

Hacker id

" + } + ], + "body": [ + { + "group": "body", + "type": "File", + "optional": false, + "field": "resume", + "description": "

The uploaded file.

" + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "String", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "Object", + "optional": false, + "field": "data", + "description": "

Location in the bucket that the file was stored.

" + } + ] + }, + "examples": [ + { + "title": "Success-Response:", + "content": "HTTP/1.1 200 OK\n{\n message: \"Uploaded resume\",\n data: {\n filename: \"resumes/1535032624768-507f191e810c19729de860ea\"\n }\n}", + "type": "json" + } + ] + }, + "permission": [ + { + "name": "Must be logged in, and the account id must be linked to the hacker." + } + ], + "filename": "routes/api/hacker.js", + "groupTitle": "Hacker", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/hacker/resume/:id" + } + ] + }, + { + "type": "post", + "url": "/hacker/email/dayOf/:id", + "title": "", + "description": "

Sends a hacker the day-of email, along with the HackPass QR code to view their hacker profile (for checkin purposes). Hackers must be either confirmed, or checked in.

", + "name": "postHackerSendDayOfEmail", + "group": "Hacker", + "version": "0.0.9", + "parameter": { + "fields": { + "param": [ + { + "group": "param", + "type": "string", + "optional": true, + "field": "status", + "description": "

The hacker ID

" + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "string", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "object", + "optional": false, + "field": "data", + "description": "

empty

" + } + ] + }, + "examples": [ + { + "title": "Success-Response:", + "content": "{\n \"message\": \"Hacker day-of email sent.\",\n \"data\": {}\n}", + "type": "object" + } + ] + }, + "permission": [ + { + "name": "Administrator" + } + ], + "filename": "routes/api/hacker.js", + "groupTitle": "Hacker", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/hacker/email/dayOf/:id" + } + ] + }, + { + "type": "post", + "url": "/hacker/email/weekOf/:id", + "title": "", + "description": "

Sends a hacker the week-of email, along with the HackPass QR code to view their hacker profile (for checkin purposes). Hackers must be either confirmed, or checked in.

", + "name": "postHackerSendWeekOfEmail", + "group": "Hacker", + "version": "0.0.9", + "parameter": { + "fields": { + "param": [ + { + "group": "param", + "type": "string", + "optional": true, + "field": "status", + "description": "

The hacker ID

" + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "string", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "object", + "optional": false, + "field": "data", + "description": "

empty

" + } + ] + }, + "examples": [ + { + "title": "Success-Response:", + "content": "{\n \"message\": \"Hacker week-of email sent.\",\n \"data\": {}\n}", + "type": "object" + } + ] + }, + "permission": [ + { + "name": "Administrator" + } + ], + "filename": "routes/api/hacker.js", + "groupTitle": "Hacker", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/hacker/email/weekOf/:id" + } + ] + }, + { + "type": "post", + "url": "/hacker/email/weekOf/:id", + "title": "", + "description": "

Sends a hacker the week-of email, along with the HackPass QR code to view their hacker profile (for checkin purposes). Hackers must be eitherconfirmed, or checked in.

", + "name": "postHackerSendWeekOfEmail", + "group": "Hacker", + "version": "0.0.9", + "parameter": { + "fields": { + "param": [ + { + "group": "param", + "type": "string", + "optional": true, + "field": "status", + "description": "

The hacker ID

" + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "string", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "object", + "optional": false, + "field": "data", + "description": "

empty

" + } + ] + }, + "examples": [ + { + "title": "Success-Response:", + "content": "{\n \"message\": \"Hacker week-of email sent.\",\n \"data\": {}\n}", + "type": "object" + } + ] + }, + "permission": [ + { + "name": "Administrator" + } + ], + "filename": "routes/api/hacker.js", + "groupTitle": "Hacker", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/hacker/email/weekOf/:id" + } + ] + }, + { + "type": "get", + "url": "/sponsor/self", + "title": "get information about logged in sponsor", + "name": "self", + "group": "Hacker", + "version": "1.4.1", + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "String", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "Object", + "optional": false, + "field": "data", + "description": "

Sponsor object

" + } + ] + }, + "examples": [ + { + "title": "Success-Response: ", + "content": "{\n \"message\": \"Successfully retrieved sponsor information\", \n \"data\": {\n \"id\": \"5bff4d736f86be0a41badb91\",\n \"accountId\": \"5bff4d736f86be0a41badb99\",\n \"tier\": 3,\n \"company\": \"companyName\",\n \"contractURL\": \"https://www.contractHere.com\",\n \"nominees\": [\"5bff4d736f86be0a41badb93\",\"5bff4d736f86be0a41badb94\"]\n }\n }", + "type": "object" + } + ] + }, + "error": { + "fields": { + "Error 4xx": [ + { + "group": "Error 4xx", + "type": "String", + "optional": false, + "field": "message", + "description": "

Error message

" + }, + { + "group": "Error 4xx", + "type": "Object", + "optional": false, + "field": "data", + "description": "

empty

" + } + ] + }, + "examples": [ + { + "title": "Error-Response: ", + "content": "{\"message\": \"Sponsor not found\", \"data\": {}}", + "type": "object" + } + ] + }, + "permission": [ + { + "name": ": Sponsor" + } + ], + "filename": "routes/api/sponsor.js", + "groupTitle": "Hacker", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/sponsor/self" + } + ] + }, + { + "type": "get", + "url": "/hacker/self", + "title": "get information about own hacker", + "name": "self", + "group": "Hacker", + "version": "0.0.8", + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "string", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "object", + "optional": false, + "field": "data", + "description": "

Hacker object

" + } + ] + }, + "examples": [ + { + "title": "Success-Response: ", + "content": "{\n \"message\": \"Hacker found by logged in account id\", \n \"data\": {\n \"id\":\"5bff4d736f86be0a41badb91\",\n \"application\":{\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n \"jobInterest\":\"Internship\",\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"comments\":\"hi!\",\n \"essay\":\"Pls accept me\"\n },\n \"status\":\"Applied\",\n \"ethnicity\":[\"White or Caucasian\",\" Asian or Pacific Islander\"],\n \"accountId\":\"5bff2a35e533b0f6562b4998\",\n \"school\":\"McPherson College\",\n \"gender\":\"Female\",\n \"travel\":0,\n \"major\":[\"Accounting\"],\n \"graduationYear\":2019,\n \"codeOfConduct\":true,\n } \n }", + "type": "object" + } + ] + }, + "error": { + "fields": { + "Error 4xx": [ + { + "group": "Error 4xx", + "type": "string", + "optional": false, + "field": "message", + "description": "

Error message

" + }, + { + "group": "Error 4xx", + "type": "object", + "optional": false, + "field": "data", + "description": "

empty

" + } + ] + }, + "examples": [ + { + "title": "Error-Response: ", + "content": "{\"message\": \"Hacker not found\", \"data\": {}}", + "type": "object" + } + ] + }, + "filename": "routes/api/hacker.js", + "groupTitle": "Hacker", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/hacker/self" + } + ] + }, + { + "type": "get", + "url": "/", + "title": "version", + "version": "0.0.8", + "name": "index", + "group": "Index", + "permission": [ + { + "name": "public" + } + ], + "filename": "routes/index.js", + "groupTitle": "Index", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/" + } + ] + }, + { + "type": "post", + "url": "/api/role/", + "title": "create a new role", + "name": "createRole", + "group": "Role", + "version": "1.1.1", + "parameter": { + "fields": { + "body": [ + { + "group": "body", + "type": "String", + "optional": false, + "field": "name", + "description": "

Name of the route

" + }, + { + "group": "body", + "type": "Route[]", + "optional": false, + "field": "routes", + "description": "

The routes that this role gives access to

" + } + ] + }, + "examples": [ + { + "title": "application: ", + "content": "{\n \"name\": \"routename\",\n \"routes\": [\n {\n uri: \"/api/hacker/\"\n requestType: \"POST\"\n }\n ]\n}", + "type": "Json" + } + ] + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "string", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "object", + "optional": false, + "field": "data", + "description": "

Role object

" + } + ] + }, + "examples": [ + { + "title": "Success-Response: ", + "content": "{\n \"message\": \"Role creation successful\", \n \"data\": {\n \"name\": \"routename\",\n \"routes\": [\n {\n uri: \"/api/hacker/\"\n requestType: \"POST\"\n }\n ]\n }\n}", + "type": "object" + } + ] + }, + "error": { + "fields": { + "Error 4xx": [ + { + "group": "Error 4xx", + "type": "string", + "optional": false, + "field": "message", + "description": "

Error message

" + }, + { + "group": "Error 4xx", + "type": "object", + "optional": false, + "field": "data", + "description": "

empty

" + } + ] + }, + "examples": [ + { + "title": "Error-Response: ", + "content": "{\"message\": \"Error while creating role\", \"data\": {}}", + "type": "object" + } + ] + }, + "filename": "routes/api/role.js", + "groupTitle": "Role", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/api/role/" + } + ] + }, + { + "type": "get", + "url": "/search/", + "title": "provide a specific query for any defined model", + "name": "search", + "group": "Search", + "version": "0.0.8", + "parameter": { + "fields": { + "query": [ + { + "group": "query", + "type": "String", + "optional": false, + "field": "model", + "description": "

the model to be searched

" + }, + { + "group": "query", + "type": "Array", + "optional": false, + "field": "q", + "description": "

the query to be executed. For more information on how to format this, please see https://docs.mchacks.ca/architecture/

" + }, + { + "group": "query", + "type": "String", + "optional": false, + "field": "sort", + "description": "

either "asc" or "desc"

" + }, + { + "group": "query", + "type": "number", + "optional": false, + "field": "page", + "description": "

the page number that you would like

" + }, + { + "group": "query", + "type": "number", + "optional": false, + "field": "limit", + "description": "

the maximum number of results that you would like returned

" + }, + { + "group": "query", + "type": "any", + "optional": false, + "field": "sort_by", + "description": "

any parameter you want to sort the results by

" + }, + { + "group": "query", + "type": "boolean", + "optional": false, + "field": "expand", + "description": "

whether you want to expand sub documents within the results

" + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "String", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "Object", + "optional": false, + "field": "data", + "description": "

Results

" + } + ] + }, + "examples": [ + { + "title": "Success-Response:", + "content": "{\n \"message\": \"Successfully executed query, returning all results\",\n \"data\": [\n {...}\n ]\n }", + "type": "object" + }, + { + "title": "Success-Response:", + "content": "{\n \"message\": \"No results found.\",\n \"data\": {}\n }", + "type": "object" + } + ] + }, + "error": { + "fields": { + "Error 4xx": [ + { + "group": "Error 4xx", + "type": "String", + "optional": false, + "field": "message", + "description": "

Error message

" + }, + { + "group": "Error 4xx", + "type": "Object", + "optional": false, + "field": "data", + "description": "

empty

" + } + ] + }, + "examples": [ + { + "title": "Error-Response:", + "content": "{\"message\": \"Validation failed\", \"data\": {}}", + "type": "object" + } + ] + }, + "filename": "routes/api/search.js", + "groupTitle": "Search", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/search/" + } + ] + }, + { + "type": "get", + "url": "/settings/", + "title": "Get the settings for the current hackathon", + "name": "getSettings", + "group": "Settings", + "version": "1.1.1", + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "string", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "object", + "optional": false, + "field": "data", + "description": "

Settings Object

" + } + ] + }, + "examples": [ + { + "title": "Success-Response:", + "content": "{\n \"message\": \"Settings creation successful.\",\n \"data\": {\n \"settings\": {\n openTime: \"Wed Feb 06 2019 00:00:00 GMT-0500 (GMT-05:00)\",\n closeTime: \"Sat Feb 01 2020 00:00:00 GMT-0500 (GMT-05:00)\",\n confirmTime: \"Sat Feb 20 2020 00:00:00 GMT-0500 (GMT-05:00)\"\n }\n }\n}", + "type": "object" + } + ] + }, + "permission": [ + { + "name": "public" + } + ], + "filename": "routes/api/settings.js", + "groupTitle": "Settings", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/settings/" + } + ] + }, + { + "type": "patch", + "url": "/settings/", + "title": "Patch the settings for the current hackathon", + "name": "patchSettings", + "group": "Settings", + "version": "1.1.1", + "parameter": { + "fields": { + "body": [ + { + "group": "body", + "type": "Date", + "optional": true, + "field": "openTime", + "description": "

The opening time for the hackathon.

" + }, + { + "group": "body", + "type": "Date", + "optional": true, + "field": "closeTime", + "description": "

The closing time for the hackathon.

" + }, + { + "group": "body", + "type": "Date", + "optional": true, + "field": "confirmTime", + "description": "

The deadline for confirmation for the hackathon.

" + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "string", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "object", + "optional": false, + "field": "data", + "description": "

Settings Object

" + } + ] + }, + "examples": [ + { + "title": "Success-Response:", + "content": "{\n \"message\": \"Settings patch successful.\",\n \"data\": {\n \"settings\": {\n openTime: \"Wed Feb 06 2019 00:00:00 GMT-0500 (GMT-05:00)\",\n closeTime: \"Sat Feb 01 2020 00:00:00 GMT-0500 (GMT-05:00)\",\n confirmTime: \"Sat Feb 20 2020 00:00:00 GMT-0500 (GMT-05:00)\"\n }\n }\n}", + "type": "object" + } + ] + }, + "permission": [ + { + "name": "Administrators" + } + ], + "filename": "routes/api/settings.js", + "groupTitle": "Settings", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/settings/" + } + ] + }, + { + "type": "post", + "url": "/sponsor/", + "title": "create a new sponsor", + "name": "createSponsor", + "group": "Sponsor", + "version": "0.0.8", + "parameter": { + "fields": { + "body": [ + { + "group": "body", + "type": "MongoID", + "optional": false, + "field": "accountId", + "description": "

ObjectID of the respective account.

" + }, + { + "group": "body", + "type": "Number", + "optional": false, + "field": "tier", + "description": "

Tier of the sponsor, from 0 to 5. 0 is lowest tier, and 5 is the custom tier.

" + }, + { + "group": "body", + "type": "String", + "optional": false, + "field": "company", + "description": "

Name of the company.

" + }, + { + "group": "body", + "type": "String", + "optional": false, + "field": "contractURL", + "description": "

URL link to the contract with the company.

" + }, + { + "group": "body", + "type": "MongoID[]", + "optional": false, + "field": "nominees", + "description": "

Array of accounts that the company wish to nominate as hackers.

" + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "String", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "Object", + "optional": false, + "field": "data", + "description": "

Sponsor object

" + } + ] + }, + "examples": [ + { + "title": "Success-Response: ", + "content": "{\n \"message\": \"Sponsor creation successful\", \n \"data\": {...}\n }", + "type": "object" + } + ] + }, + "error": { + "fields": { + "Error 4xx": [ + { + "group": "Error 4xx", + "type": "String", + "optional": false, + "field": "message", + "description": "

Error message

" + }, + { + "group": "Error 4xx", + "type": "Object", + "optional": false, + "field": "data", + "description": "

empty

" + } + ] + }, + "examples": [ + { + "title": "Error-Response: ", + "content": "{\"message\": \"Error while creating sponsor\", \"data\": {}}", + "type": "object" + } + ] + }, + "filename": "routes/api/sponsor.js", + "groupTitle": "Sponsor", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/sponsor/" + } + ] + }, + { + "type": "get", + "url": "/sponsor/:id", + "title": "get a sponsor's information", + "name": "getSponsor", + "group": "Sponsor", + "version": "0.0.8", + "parameter": { + "fields": { + "param": [ + { + "group": "param", + "type": "string", + "optional": false, + "field": "id", + "description": "

a sponsor's unique mongoID

" + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "String", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "Object", + "optional": false, + "field": "data", + "description": "

Sponsor object

" + } + ] + }, + "examples": [ + { + "title": "Success-Response: ", + "content": "{\n \"message\": \"Successfully retrieved sponsor information\", \n \"data\": {\n \"id\": \"5bff4d736f86be0a41badb91\",\n \"accountId\": \"5bff4d736f86be0a41badb99\",\n \"tier\": 3,\n \"company\": \"companyName\",\n \"contractURL\": \"https://www.contractHere.com\",\n \"nominees\": [\"5bff4d736f86be0a41badb93\",\"5bff4d736f86be0a41badb94\"]\n }\n }", + "type": "object" + } + ] + }, + "error": { + "fields": { + "Error 4xx": [ + { + "group": "Error 4xx", + "type": "String", + "optional": false, + "field": "message", + "description": "

Error message

" + }, + { + "group": "Error 4xx", + "type": "Object", + "optional": false, + "field": "data", + "description": "

empty

" + } + ] + }, + "examples": [ + { + "title": "Error-Response: ", + "content": "{\"message\": \"Sponsor not found\", \"data\": {}}", + "type": "object" + } + ] + }, + "filename": "routes/api/sponsor.js", + "groupTitle": "Sponsor", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/sponsor/:id" + } + ] + }, + { + "type": "patch", + "url": "/sponsor/", + "title": "update a sponsor", + "name": "patchSponsor", + "group": "Sponsor", + "version": "1.3.0", + "parameter": { + "fields": { + "param": [ + { + "group": "param", + "type": "ObjectId", + "optional": false, + "field": "id", + "description": "

ObjectID of the sponsor

" + } + ], + "body": [ + { + "group": "body", + "type": "String", + "optional": false, + "field": "company", + "description": "

Name of the company.

" + }, + { + "group": "body", + "type": "String", + "optional": false, + "field": "contractURL", + "description": "

URL link to the contract with the company.

" + }, + { + "group": "body", + "type": "ObjectId[]", + "optional": false, + "field": "nominees", + "description": "

Array of accounts that the company wish to nominate as hackers.

" + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "String", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "Object", + "optional": false, + "field": "data", + "description": "

Sponsor object

" + } + ] + }, + "examples": [ + { + "title": "Success-Response: ", + "content": "{\n \"message\": \"Sponsor update successful\", \n \"data\": {...}\n }", + "type": "object" + } + ] + }, + "error": { + "fields": { + "Error 4xx": [ + { + "group": "Error 4xx", + "type": "String", + "optional": false, + "field": "message", + "description": "

Error message

" + }, + { + "group": "Error 4xx", + "type": "Object", + "optional": false, + "field": "data", + "description": "

empty

" + } + ] + }, + "examples": [ + { + "title": "Error-Response: ", + "content": "{\"message\": \"Error while updating sponsor\", \"data\": {}}", + "type": "object" + } + ] + }, + "filename": "routes/api/sponsor.js", + "groupTitle": "Sponsor", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/sponsor/" + } + ] + }, + { + "type": "post", + "url": "/team/", + "title": "create a new team consisting of only the logged in user", + "name": "createTeam", + "group": "Team", + "version": "0.0.8", + "parameter": { + "fields": { + "body": [ + { + "group": "body", + "type": "String", + "optional": false, + "field": "name", + "description": "

Name of the team.

" + }, + { + "group": "body", + "type": "String", + "optional": true, + "field": "devpostURL", + "description": "

Devpost link to hack. Once the link is sent, the hack will be considered to be submitted.

" + }, + { + "group": "body", + "type": "String", + "optional": true, + "field": "projectName", + "description": "

Name of the team.

" + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "string", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "object", + "optional": false, + "field": "data", + "description": "

Team object

" + } + ] + }, + "examples": [ + { + "title": "Success-Response: ", + "content": "{\n \"message\": \"Team creation successful\", \n \"data\": {...}\n }", + "type": "object" + } + ] + }, + "error": { + "fields": { + "Error 4xx": [ + { + "group": "Error 4xx", + "type": "string", + "optional": false, + "field": "message", + "description": "

Error message

" + }, + { + "group": "Error 4xx", + "type": "object", + "optional": false, + "field": "data", + "description": "

empty

" + } + ] + }, + "examples": [ + { + "title": "Error-Response: ", + "content": "{\"message\": \"Error while creating team\", \"data\": {}}", + "type": "object" + } + ] + }, + "filename": "routes/api/team.js", + "groupTitle": "Team", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/team/" + } + ] + }, + { + "type": "patch", + "url": "/team/leave/", + "title": "Allows a logged in hacker to leave current team", + "name": "deleteSelfFromTeam", + "group": "Team", + "version": "1.1.1", + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "string", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "object", + "optional": false, + "field": "data", + "description": "

{}

" + } + ] + }, + "examples": [ + { + "title": "Success-Response:", + "content": "{\n \"message\": \"Removal from team successful.\",\n \"data\": {}\n}", + "type": "object" + } + ] + }, + "filename": "routes/api/team.js", + "groupTitle": "Team", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/team/leave/" + } + ] + }, + { + "type": "get", + "url": "/team/:id", + "title": "get a team's information", + "name": "getTeam", + "group": "Team", + "version": "0.0.8", + "parameter": { + "fields": { + "param": [ + { + "group": "param", + "type": "ObjectId", + "optional": false, + "field": "id", + "description": "

MongoId of the team

" + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "String", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "Object", + "optional": false, + "field": "data", + "description": "

Team object

" + } + ] + }, + "examples": [ + { + "title": "Success-Response: ", + "content": "{\n \"message\": \"Team retrieval successful\", \n \"data\": { \n \"team\": {\n \"name\":\"foo\",\n \"members\": [\n ObjectId('...')\n ],\n \"devpostURL\": \"www.devpost.com/foo\",\n \"projectName\": \"fooey\"\n },\n \"members\": [\n {\n \"firstName\": \"John\",\n \"lastName\": \"Doe\"\n }\n ],\n }\n }", + "type": "object" + } + ] + }, + "error": { + "fields": { + "Error 4xx": [ + { + "group": "Error 4xx", + "type": "String", + "optional": false, + "field": "message", + "description": "

Error message

" + }, + { + "group": "Error 4xx", + "type": "Object", + "optional": false, + "field": "data", + "description": "

empty

" + } + ] + }, + "examples": [ + { + "title": "Error-Response: ", + "content": "{\"message\": \"Team not found\", \"data\": {}}", + "type": "object" + } + ] + }, + "filename": "routes/api/team.js", + "groupTitle": "Team", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/team/:id" + } + ] + }, + { + "type": "patch", + "url": "/team/join/", + "title": "Allows a logged in hacker to join a team by name", + "name": "patchJoinTeam", + "group": "Team", + "version": "1.1.1", + "parameter": { + "fields": { + "body": [ + { + "group": "body", + "type": "string", + "optional": true, + "field": "name", + "description": "

Name of the team to join

" + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "string", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "object", + "optional": false, + "field": "data", + "description": "

{}

" + } + ] + }, + "examples": [ + { + "title": "Success-Response:", + "content": "{\n \"message\": \"Team join successful.\",\n \"data\": {}\n}", + "type": "object" + } + ] + }, + "filename": "routes/api/team.js", + "groupTitle": "Team", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/team/join/" + } + ] + }, + { + "type": "patch", + "url": "/team/:hackerId", + "title": "Update a team's information. The team is specified by the hacker belonging to it.", + "name": "patchTeam", + "group": "Team", + "version": "0.0.8", + "description": "

We use hackerId instead of teamId because authorization requires a one-to-one mapping from param id to accountId, but we are not able to have that from teamId to accountId due to multiple members in a team. Instead, we use hackerId, as there is a 1 to 1 link between hackerId to teamId, and a 1 to 1 link between hackerId and accountId

", + "parameter": { + "fields": { + "param": [ + { + "group": "param", + "type": "ObjectId", + "optional": false, + "field": "hackerId", + "description": "

a hacker's unique Id

" + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "String", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "Object", + "optional": false, + "field": "data", + "description": "

Team object

" + } + ] + }, + "examples": [ + { + "title": "Success-Response: ", + "content": "{\n \"message\": \"Team update successful.\", \n \"data\": {...}\n }", + "type": "object" + } + ] + }, + "error": { + "fields": { + "Error 4xx": [ + { + "group": "Error 4xx", + "type": "String", + "optional": false, + "field": "message", + "description": "

Error message

" + }, + { + "group": "Error 4xx", + "type": "Object", + "optional": false, + "field": "data", + "description": "

Query input that caused the error.

" + } + ] + }, + "examples": [ + { + "title": "Error-Response: ", + "content": "{\"message\": \"Team not found\", \"data\": {teamId}}", + "type": "object" + } + ] + }, + "filename": "routes/api/team.js", + "groupTitle": "Team", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/team/:hackerId" + } + ] + }, + { + "type": "post", + "url": "/travel/", + "title": "create a new travel", + "name": "createTravel", + "group": "Travel", + "version": "2.0.1", + "parameter": { + "fields": { + "body": [ + { + "group": "body", + "type": "MongoID", + "optional": false, + "field": "accountId", + "description": "

ObjectID of the respective account

" + }, + { + "group": "body", + "type": "MongoID", + "optional": false, + "field": "hackerId", + "description": "

ObjectID of the respective hacker

" + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "string", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "object", + "optional": false, + "field": "data", + "description": "

Travel object

" + } + ] + }, + "examples": [ + { + "title": "Success-Response: ", + "content": "{\n \"message\": \"Travel creation successful\", \n \"data\": {\n \"id\":\"5bff4d736f86be0a41badb91\",\n \"status\": \"None\",\n \"request\": 50,\n \"offer\": 0\n }\n}", + "type": "object" + } + ] + }, + "error": { + "fields": { + "Error 4xx": [ + { + "group": "Error 4xx", + "type": "string", + "optional": false, + "field": "message", + "description": "

Error message

" + }, + { + "group": "Error 4xx", + "type": "object", + "optional": false, + "field": "data", + "description": "

empty

" + } + ] + }, + "examples": [ + { + "title": "Error-Response: ", + "content": "{\"message\": \"Error while creating travel\", \"data\": {}}", + "type": "object" + } + ] + }, + "filename": "routes/api/travel.js", + "groupTitle": "Travel", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/travel/" + } + ] + }, + { + "type": "get", + "url": "/travel/email/:email", + "title": "get a travel's information", + "name": "getTravel", + "group": "Travel", + "version": "2.0.1", + "parameter": { + "fields": { + "param": [ + { + "group": "param", + "type": "String", + "optional": false, + "field": "email", + "description": "

a travel's unique email

" + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "String", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "Object", + "optional": false, + "field": "data", + "description": "

Travel object

" + } + ] + }, + "examples": [ + { + "title": "Success-Response: ", + "content": "{\n \"message\": \"Successfully retrieved travel information\", \n \"data\": {\n \"id\":\"5bff4d736f86be0a41badb91\",\n \"status\": \"Valid\",\n \"request\": 100,\n \"offer\": 50\n }\n }", + "type": "object" + } + ] + }, + "error": { + "fields": { + "Error 4xx": [ + { + "group": "Error 4xx", + "type": "String", + "optional": false, + "field": "message", + "description": "

Error message

" + }, + { + "group": "Error 4xx", + "type": "Object", + "optional": false, + "field": "data", + "description": "

empty

" + } + ] + }, + "examples": [ + { + "title": "Error-Response: ", + "content": "{\"message\": \"Travel not found\", \"data\": {}}", + "type": "object" + } + ] + }, + "filename": "routes/api/travel.js", + "groupTitle": "Travel", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/travel/email/:email" + } + ] + }, + { + "type": "get", + "url": "/travel/:id", + "title": "get a traveler's information", + "name": "getTravel", + "group": "Travel", + "version": "2.0.1", + "parameter": { + "fields": { + "param": [ + { + "group": "param", + "type": "String", + "optional": false, + "field": "id", + "description": "

a travel's unique mongoID

" + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "String", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "Object", + "optional": false, + "field": "data", + "description": "

Travel object

" + } + ] + }, + "examples": [ + { + "title": "Success-Response: ", + "content": "{\n \"message\": \"Successfully retrieved travel information\", \n \"data\": {\n \"id\":\"5bff4d736f86be0a41badb91\",\n \"status\": \"Valid\",\n \"request\": 100,\n \"offer\": 50\n }\n }", + "type": "object" + } + ] + }, + "error": { + "fields": { + "Error 4xx": [ + { + "group": "Error 4xx", + "type": "String", + "optional": false, + "field": "message", + "description": "

Error message

" + }, + { + "group": "Error 4xx", + "type": "Object", + "optional": false, + "field": "data", + "description": "

empty

" + } + ] + }, + "examples": [ + { + "title": "Error-Response: ", + "content": "{\"message\": \"Travel not found\", \"data\": {}}", + "type": "object" + } + ] + }, + "filename": "routes/api/travel.js", + "groupTitle": "Travel", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/travel/:id" + } + ] + }, + { + "type": "patch", + "url": "/travel/offer/:id", + "title": "update a traveler's offer", + "name": "patchTravelOffer", + "group": "Travel", + "version": "2.0.1", + "parameter": { + "fields": { + "body": [ + { + "group": "body", + "type": "number", + "optional": true, + "field": "offer", + "description": "

Amount of money offered for travel

" + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "string", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "object", + "optional": false, + "field": "data", + "description": "

Travel object

" + } + ] + }, + "examples": [ + { + "title": "Success-Response:", + "content": "{\n \"message\": \"Changed travel information\",\n \"data\": {\n \"offer\": 75\n }\n}", + "type": "object" + } + ] + }, + "permission": [ + { + "name": "Administrator" + } + ], + "filename": "routes/api/travel.js", + "groupTitle": "Travel", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/travel/offer/:id" + } + ] + }, + { + "type": "patch", + "url": "/travel/status/:id", + "title": "update a traveler's status", + "name": "patchTravelStatus", + "group": "Travel", + "version": "2.0.1", + "parameter": { + "fields": { + "body": [ + { + "group": "body", + "type": "string", + "optional": true, + "field": "status", + "description": "

Status of the travel's reimbursement ("None"|"Bus"|"Offered"|"Valid"|"Invalid"|"Claimed")

" + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "string", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "object", + "optional": false, + "field": "data", + "description": "

Travel object

" + } + ] + }, + "examples": [ + { + "title": "Success-Response:", + "content": "{\n \"message\": \"Changed travel information\",\n \"data\": {\n \"status\": \"Accepted\"\n }\n}", + "type": "object" + } + ] + }, + "permission": [ + { + "name": "Administrator" + } + ], + "filename": "routes/api/travel.js", + "groupTitle": "Travel", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/travel/status/:id" + } + ] + }, + { + "type": "get", + "url": "/travel/self", + "title": "get information about own hacker's travel", + "name": "self", + "group": "Travel", + "version": "2.0.1", + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "string", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "object", + "optional": false, + "field": "data", + "description": "

Travel object

" + } + ] + }, + "examples": [ + { + "title": "Success-Response: ", + "content": "{\n \"message\": \"Travel found by logged in account id\", \n \"data\": {\n \"id\":\"5bff4d736f86be0a41badb91\",\n \"status\": \"Claimed\"\n \"request\": 90,\n \"offer\": 80\n } \n }", + "type": "object" + } + ] + }, + "error": { + "fields": { + "Error 4xx": [ + { + "group": "Error 4xx", + "type": "string", + "optional": false, + "field": "message", + "description": "

Error message

" + }, + { + "group": "Error 4xx", + "type": "object", + "optional": false, + "field": "data", + "description": "

empty

" + } + ] + }, + "examples": [ + { + "title": "Error-Response: ", + "content": "{\"message\": \"Travel not found\", \"data\": {}}", + "type": "object" + } + ] + }, + "filename": "routes/api/travel.js", + "groupTitle": "Travel", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/travel/self" + } + ] + }, + { + "type": "post", + "url": "/volunteer/", + "title": "create a new volunteer", + "name": "createVolunteer", + "group": "Volunteer", + "version": "0.0.8", + "parameter": { + "fields": { + "body": [ + { + "group": "body", + "type": "MongoID", + "optional": false, + "field": "accountId", + "description": "

MongoID of the account of the volunteer

" + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "string", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "object", + "optional": false, + "field": "data", + "description": "

Volunteer object

" + } + ] + }, + "examples": [ + { + "title": "Success-Response: ", + "content": "{\n \"message\": \"Volunteer creation successful\", \n \"data\": {...}\n }", + "type": "object" + } + ] + }, + "error": { + "fields": { + "Error 4xx": [ + { + "group": "Error 4xx", + "type": "string", + "optional": false, + "field": "message", + "description": "

Error message

" + }, + { + "group": "Error 4xx", + "type": "object", + "optional": false, + "field": "data", + "description": "

empty

" + } + ] + }, + "examples": [ + { + "title": "Error-Response: ", + "content": "{\"message\": \"Error while creating volunteer\", \"data\": {}}", + "type": "object" + } + ] + }, + "filename": "routes/api/volunteer.js", + "groupTitle": "Volunteer", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/volunteer/" + } + ] + }, + { + "type": "get", + "url": "/volunteer/:id", + "title": "get a volunteer's information", + "name": "getVolunteer", + "group": "Volunteer", + "version": "1.3.0", + "parameter": { + "fields": { + "param": [ + { + "group": "param", + "type": "ObjectId", + "optional": false, + "field": "id", + "description": "

a volunteer's unique mongoID

" + } + ] + } + }, + "success": { + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "String", + "optional": false, + "field": "message", + "description": "

Success message

" + }, + { + "group": "Success 200", + "type": "Object", + "optional": false, + "field": "data", + "description": "

Volunteer object

" + } + ] + }, + "examples": [ + { + "title": "Success-Response: ", + "content": "{\n \"message\": \"Successfully retrieved volunteer information\", \n \"data\": {...}\n }", + "type": "object" + } + ] + }, + "error": { + "fields": { + "Error 4xx": [ + { + "group": "Error 4xx", + "type": "String", + "optional": false, + "field": "message", + "description": "

Error message

" + }, + { + "group": "Error 4xx", + "type": "Object", + "optional": false, + "field": "data", + "description": "

empty

" + } + ] + }, + "examples": [ + { + "title": "Error-Response: ", + "content": "{\"message\": \"Volunteer not found\", \"data\": {}}", + "type": "object" + } + ] + }, + "filename": "routes/api/volunteer.js", + "groupTitle": "Volunteer", + "sampleRequest": [ + { + "url": "https://api.mchacks.ca/api/volunteer/:id" + } + ] + } +] diff --git a/middlewares/validators/hacker.validator.js b/middlewares/validators/hacker.validator.js index 44004afd..fcafb714 100644 --- a/middlewares/validators/hacker.validator.js +++ b/middlewares/validators/hacker.validator.js @@ -94,6 +94,12 @@ module.exports = { "application.shortAnswer.question2", false ), + VALIDATOR.enumValidator( + "body", + "application.shortAnswer.previousHackathons", + Constants.HACKATHONS_COUNT, + false + ), VALIDATOR.alphaArrayValidator( "body", @@ -216,6 +222,12 @@ module.exports = { "application.shortAnswer.question2", false ), + VALIDATOR.enumValidator( + "body", + "application.shortAnswer.previousHackathons", + Constants.HACKATHONS_COUNT, + false + ), VALIDATOR.alphaArrayValidator( "body", diff --git a/middlewares/validators/validator.helper.js b/middlewares/validators/validator.helper.js index e64096f4..85150f0d 100644 --- a/middlewares/validators/validator.helper.js +++ b/middlewares/validators/validator.helper.js @@ -387,6 +387,7 @@ function applicationValidator(fieldLocation, fieldname, optional = true) { shortAnswer: false, question1: false, question2: false, + previousHackathons: false, accommodation: false, shirtSize: false, other: false, @@ -425,6 +426,9 @@ function applicationValidator(fieldLocation, fieldname, optional = true) { hasValid.question2 = app.shortAnswer.hasOwnProperty( "question2" ); + hasValid.previousHackathons = app.shortAnswer.hasOwnProperty( + "previousHackathons" + ); } hasValid.accommodation = app.hasOwnProperty("accommodation"); if (hasValid.accommodation) { @@ -472,6 +476,9 @@ function applicationValidator(fieldLocation, fieldname, optional = true) { // hasValid.question2 = // !!app.shortAnswer.question2 && // typeof app.shortAnswer.question2 === "string"; + // hasValid.previousHackathons = + // !!app.shortAnswer.previousHackathons && + // typeof app.shortAnswer.previousHackathons === "string"; // hasValid.team = // !app.team || mongoose.Types.ObjectId.isValid(app.team); @@ -525,6 +532,9 @@ function applicationValidator(fieldLocation, fieldname, optional = true) { hasValid.question2 = app.shortAnswer.hasOwnProperty( "question2" ); + hasValid.previousHackathons = app.shortAnswer.hasOwnProperty( + "previousHackathons" + ); } hasValid.accommodation = app.hasOwnProperty("accommodation"); if (hasValid.accommodation) { @@ -572,6 +582,9 @@ function applicationValidator(fieldLocation, fieldname, optional = true) { // hasValid.question2 = // !!app.shortAnswer.question2 && // typeof app.shortAnswer.question2 === "string"; + // hasValid.previousHackathons = + // !!app.shortAnswer.previousHackathons && + // typeof app.shortAnswer.previousHackathons === "string"; // hasValid.team = // !app.team || mongoose.Types.ObjectId.isValid(app.team); return ( @@ -585,6 +598,7 @@ function applicationValidator(fieldLocation, fieldname, optional = true) { hasValid.shortAnswer && hasValid.question1 && hasValid.question2 && + hasValid.previousHackathons && hasValid.accommodation && hasValid.shirtSize && hasValid.other && @@ -777,7 +791,7 @@ function searchSortValidator(fieldLocation, fieldName) { } else { return false; } - if (!!model.searchableField(value)) { + if (model.searchableField(value)) { let sortOrder = param("sort", "Sorting order not found"); if (!sortOrder.equals("asc") || !sortOrder.equals("desc")) { return false; diff --git a/models/hacker.model.js b/models/hacker.model.js index b370ebc0..7e95f464 100644 --- a/models/hacker.model.js +++ b/models/hacker.model.js @@ -86,6 +86,11 @@ const HackerSchema = new mongoose.Schema({ type: String, default: "", required: true + }, + previousHackathons: { + type: String, + enum: Constants.HACKATHONS_COUNT, + required: true } }, other: { @@ -147,7 +152,8 @@ HackerSchema.methods.isApplicationComplete = function() { const jobInterestDone = !!hs.application.general.jobInterest; const question1Done = !!hs.application.shortAnswer.question1; const question2Done = !!hs.application.shortAnswer.question2; - return portfolioDone && jobInterestDone && question1Done && question2Done; + const previousHackathonsDone = !!hs.application.shortAnswer.previousHackathons; + return portfolioDone && jobInterestDone && question1Done && question2Done && previousHackathonsDone; }; /** diff --git a/package.json b/package.json index f37b7ae3..bd64e3f9 100644 --- a/package.json +++ b/package.json @@ -3,11 +3,11 @@ "version": "3.0.0", "private": true, "scripts": { - "start": "DEBUG=hackboard:* NODE_ENV=development nodemon --ignore gcp_creds.json ./bin/www.js", - "deploy": "NODE_ENV=deployment node ./bin/www.js", - "debug": "DEBUG=hackboard:* NODE_ENV=deployment nodemon --ignore gcp_creds.json ./bin/www.js", + "start": "DEBUG=hackboard:* NODE_ENV=test nodemon --ignore gcp_creds.json ./bin/www.js", + "deploy": "NODE_ENV=test node ./bin/www.js", + "debug": "DEBUG=hackboard:* NODE_ENV=test nodemon --ignore gcp_creds.json ./bin/www.js", "test": "DEBUG=hackboard:* NODE_ENV=test mocha --reporter spec tests/**.js --exit", - "seed": "NODE_ENV=development node ./seed/index.js", + "seed": "NODE_ENV=test node ./seed/index.js", "docs": "apidoc -i ./routes -o ./docs/api/", "format": "prettier --write '**/*.js'", "lint": "eslint --fix '**/*.js'" diff --git a/routes/api/hacker.js b/routes/api/hacker.js index 1d4b108d..df163861 100644 --- a/routes/api/hacker.js +++ b/routes/api/hacker.js @@ -116,6 +116,7 @@ module.exports = { "skills":["Javascript","Typescript"], "question1": "I love McHacks", "question2":"Pls accept me", + "previousHackathons": "5+", "comments":"hi!", }, "other:" { @@ -158,6 +159,7 @@ module.exports = { "skills":["Javascript","Typescript"], "question1": "I love McHacks", "question2":"Pls accept me", + "previousHackathons": "5+", "comments":"hi!", }, "other:" { @@ -447,6 +449,7 @@ module.exports = { "skills":["Javascript","Typescript"], "question1": "I love McHacks", "question2":"Pls accept me", + "previousHackathons": "5+", "comments":"hi!", }, "other:" { @@ -489,6 +492,7 @@ module.exports = { "skills":["Javascript","Typescript"], "question1": "I love McHacks", "question2":"Pls accept me", + "previousHackathons": "5+", "comments":"hi!", }, "other:" { @@ -560,6 +564,7 @@ module.exports = { "skills":["Javascript","Typescript"], "question1": "I love McHacks", "question2":"Pls accept me", + "previousHackathons": "5+", "comments":"hi!", }, "other:" { @@ -627,6 +632,7 @@ module.exports = { "skills":["Javascript","Typescript"], "question1": "I love McHacks", "question2":"Pls accept me", + "previousHackathons": "5+", "comments":"hi!", }, "other:" { diff --git a/tests/util/hacker.test.util.js b/tests/util/hacker.test.util.js index dd392560..8d5132b1 100644 --- a/tests/util/hacker.test.util.js +++ b/tests/util/hacker.test.util.js @@ -34,7 +34,8 @@ const TeamHacker0 = { shortAnswer: { skills: ["CSS", "HTML", "JS"], question1: "a", - question2: "a" + question2: "a", + previousHackathons: "1" }, other: { ethnicity: ["Native American"], @@ -74,7 +75,8 @@ const TeamHacker1 = { shortAnswer: { skills: ["CSS", "HTML", "JS"], question1: "a", - question2: "a" + question2: "a", + previousHackathons: "2" }, other: { ethnicity: ["European"], @@ -114,7 +116,8 @@ const TeamHacker2 = { shortAnswer: { skills: ["CSS", "HTML", "JS"], question1: "a", - question2: "a" + question2: "a", + previousHackathons: "3" }, other: { ethnicity: ["European"], @@ -154,7 +157,8 @@ const TeamHacker3 = { shortAnswer: { skills: ["CSS", "HTML", "JS"], question1: "a", - question2: "a" + question2: "a", + previousHackathons: "4" }, other: { ethnicity: ["European"], @@ -194,7 +198,8 @@ const TeamHacker4 = { shortAnswer: { skills: ["CSS", "HTML", "JS"], question1: "a", - question2: "a" + question2: "a", + previousHackathons: "5+" }, other: { ethnicity: ["European"], @@ -234,7 +239,8 @@ const NoTeamHacker0 = { shortAnswer: { skills: ["CSS", "HTML", "JS"], question1: "a", - question2: "a" + question2: "a", + previousHackathons: "1" }, other: { ethnicity: ["European"], @@ -271,7 +277,8 @@ const newHacker0 = { shortAnswer: { skills: ["CSS", "HTML", "JS"], question1: "a", - question2: "a" + question2: "a", + previousHackathons: "2" }, other: { ethnicity: ["Caucasian"], @@ -308,7 +315,8 @@ const newHacker1 = { shortAnswer: { skills: ["CSS", "HTML", "JS"], question1: "a", - question2: "a" + question2: "a", + previousHackathons: "3" }, other: { ethnicity: ["African American"], @@ -346,7 +354,8 @@ const invalidHacker0 = { shortAnswer: { skills: ["CSS", "HTML", "JS"], question1: "a", - question2: "a" + question2: "a", + previousHackathons: "4" }, other: { ethnicity: ["Caucasian"], @@ -381,7 +390,8 @@ const invalidHacker1 = { shortAnswer: { skills: ["CSS", "HTML", "JS"], question1: "a", - question2: "a" + question2: "a", + previousHackathons: "5+" }, other: { ethnicity: ["Caucasian"], @@ -419,7 +429,8 @@ const invalidHacker2 = { shortAnswer: { skills: ["CSS", "HTML", "JS"], question1: "a", - question2: "a" + question2: "a", + previousHackathons: "1" }, other: { ethnicity: ["Caucasian"], @@ -459,7 +470,8 @@ const duplicateAccountLinkHacker0 = { shortAnswer: { skills: ["CSS", "HTML", "JS"], question1: "a", - question2: "a" + question2: "a", + previousHackathons: "2" }, other: { ethnicity: ["Caucasian"], @@ -498,7 +510,8 @@ const waitlistedHacker0 = { shortAnswer: { skills: ["CSS", "HTML", "JS"], question1: "a", - question2: "a" + question2: "a", + previousHackathons: "3" }, other: { ethnicity: ["European"], @@ -538,7 +551,8 @@ const unconfirmedAccountHacker0 = { shortAnswer: { skills: ["CSS", "HTML", "JS"], question1: "a", - question2: "a" + question2: "a", + previousHackathons: "4" }, other: { ethnicity: ["European"], @@ -577,7 +591,8 @@ const unconfirmedAccountHacker1 = { shortAnswer: { skills: ["CSS", "HTML", "JS"], question1: "a", - question2: "a" + question2: "a", + previousHackathons: "5+" }, other: { ethnicity: ["European"], From c572ef6b1ceedf0cc40c2fff82c28f1885bff9a7 Mon Sep 17 00:00:00 2001 From: Tony Date: Sat, 17 Oct 2020 22:06:25 -0400 Subject: [PATCH 2/5] fix: restore pushed package.json changes --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index bd64e3f9..5aefd511 100644 --- a/package.json +++ b/package.json @@ -3,11 +3,11 @@ "version": "3.0.0", "private": true, "scripts": { - "start": "DEBUG=hackboard:* NODE_ENV=test nodemon --ignore gcp_creds.json ./bin/www.js", - "deploy": "NODE_ENV=test node ./bin/www.js", - "debug": "DEBUG=hackboard:* NODE_ENV=test nodemon --ignore gcp_creds.json ./bin/www.js", + "start": "DEBUG=hackboard:* NODE_ENV=development nodemon --ignore gcp_creds.json ./bin/www.js", + "deploy": "NODE_ENV=development node ./bin/www.js", + "debug": "DEBUG=hackboard:* NODE_ENV=development nodemon --ignore gcp_creds.json ./bin/www.js", "test": "DEBUG=hackboard:* NODE_ENV=test mocha --reporter spec tests/**.js --exit", - "seed": "NODE_ENV=test node ./seed/index.js", + "seed": "NODE_ENV=development node ./seed/index.js", "docs": "apidoc -i ./routes -o ./docs/api/", "format": "prettier --write '**/*.js'", "lint": "eslint --fix '**/*.js'" From 796d42035ffc8d6841eb7f57f4f1753df2c26f0c Mon Sep 17 00:00:00 2001 From: Tony Date: Thu, 22 Oct 2020 16:42:50 -0400 Subject: [PATCH 3/5] fix: change type of previousHackathons from enum to number --- constants/general.constant.js | 2 -- docs/api/api_data.js | 12 ++++----- docs/api/api_data.json | 12 ++++----- middlewares/validators/hacker.validator.js | 14 +++++----- middlewares/validators/validator.helper.js | 4 +-- models/hacker.model.js | 3 +-- routes/api/hacker.js | 12 ++++----- tests/util/hacker.test.util.js | 30 +++++++++++----------- 8 files changed, 44 insertions(+), 45 deletions(-) diff --git a/constants/general.constant.js b/constants/general.constant.js index d1f539fc..cb0c4c06 100644 --- a/constants/general.constant.js +++ b/constants/general.constant.js @@ -76,7 +76,6 @@ const SPONSOR_T5 = "SponsorT5"; // Enums (must match with frontend) const JOB_INTERESTS = ["Internship", "Full Time", "None"]; const SHIRT_SIZES = ["XS", "S", "M", "L", "XL", "XXL"]; -const HACKATHONS_COUNT = ["0", "1", "2", "3", "4", "5+"]; const ROLE_CATEGORIES = { SELF: ":self", @@ -190,7 +189,6 @@ module.exports = { REQUEST_TYPES: REQUEST_TYPES, JOB_INTERESTS: JOB_INTERESTS, SHIRT_SIZES: SHIRT_SIZES, - HACKATHONS_COUNT: HACKATHONS_COUNT, USER_TYPES: USER_TYPES, SPONSOR_TIERS: SPONSOR_TIERS, EXTENDED_USER_TYPES: EXTENDED_USER_TYPES, diff --git a/docs/api/api_data.js b/docs/api/api_data.js index 0971f55b..dc10ccd0 100644 --- a/docs/api/api_data.js +++ b/docs/api/api_data.js @@ -1501,7 +1501,7 @@ define({ "api": [ "examples": [ { "title": "application: ", - "content": "{\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"previousHackathons\":\"5+\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n}", + "content": "{\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"previousHackathons\":\"5\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n}", "type": "Json" } ] @@ -1528,7 +1528,7 @@ define({ "api": [ "examples": [ { "title": "Success-Response: ", - "content": "{\n \"message\": \"Hacker creation successful\", \n \"data\": {\n \"id\":\"5bff4d736f86be0a41badb91\",\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"previousHackathons\":\"5+\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n}", + "content": "{\n \"message\": \"Hacker creation successful\", \n \"data\": {\n \"id\":\"5bff4d736f86be0a41badb91\",\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"previousHackathons\":\"5\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n}", "type": "object" } ] @@ -1610,7 +1610,7 @@ define({ "api": [ "examples": [ { "title": "Success-Response: ", - "content": "{\n \"message\": \"Successfully retrieved hacker information\", \n \"data\": {\n \"id\":\"5bff4d736f86be0a41badb91\",\n \"status\": \"Applied\",\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"previousHackathons\":\"5+\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n }\n }", + "content": "{\n \"message\": \"Successfully retrieved hacker information\", \n \"data\": {\n \"id\":\"5bff4d736f86be0a41badb91\",\n \"status\": \"Applied\",\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"previousHackathons\":\"5\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n }\n }", "type": "object" } ] @@ -1692,7 +1692,7 @@ define({ "api": [ "examples": [ { "title": "Success-Response: ", - "content": "{\n \"message\": \"Successfully retrieved hacker information\", \n \"data\": {\n \"id\":\"5bff4d736f86be0a41badb91\",\n \"status\": \"Applied\",\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"previousHackathons\":\"5+\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n }\n }", + "content": "{\n \"message\": \"Successfully retrieved hacker information\", \n \"data\": {\n \"id\":\"5bff4d736f86be0a41badb91\",\n \"status\": \"Applied\",\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"previousHackathons\":\"5\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n }\n }", "type": "object" } ] @@ -1927,7 +1927,7 @@ define({ "api": [ "examples": [ { "title": "application: ", - "content": "{\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"previousHackathons\":\"5+\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n }", + "content": "{\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"previousHackathons\":\"5\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n }", "type": "Json" } ] @@ -1954,7 +1954,7 @@ define({ "api": [ "examples": [ { "title": "Success-Response: ", - "content": "{\n \"message\": \"Changed hacker information\", \n \"data\": {\n \"id\":\"5bff4d736f86be0a41badb91\",\n \"status\": \"Applied\",\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"previousHackathons\":\"5+\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n }\n}", + "content": "{\n \"message\": \"Changed hacker information\", \n \"data\": {\n \"id\":\"5bff4d736f86be0a41badb91\",\n \"status\": \"Applied\",\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"previousHackathons\":\"5\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n }\n}", "type": "object" } ] diff --git a/docs/api/api_data.json b/docs/api/api_data.json index 449ac85b..08e0bcd1 100644 --- a/docs/api/api_data.json +++ b/docs/api/api_data.json @@ -1501,7 +1501,7 @@ "examples": [ { "title": "application: ", - "content": "{\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"previousHackathons\":\"5+\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n}", + "content": "{\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"previousHackathons\":\"5\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n}", "type": "Json" } ] @@ -1528,7 +1528,7 @@ "examples": [ { "title": "Success-Response: ", - "content": "{\n \"message\": \"Hacker creation successful\", \n \"data\": {\n \"id\":\"5bff4d736f86be0a41badb91\",\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"previousHackathons\":\"5+\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n}", + "content": "{\n \"message\": \"Hacker creation successful\", \n \"data\": {\n \"id\":\"5bff4d736f86be0a41badb91\",\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"previousHackathons\":\"5\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n}", "type": "object" } ] @@ -1610,7 +1610,7 @@ "examples": [ { "title": "Success-Response: ", - "content": "{\n \"message\": \"Successfully retrieved hacker information\", \n \"data\": {\n \"id\":\"5bff4d736f86be0a41badb91\",\n \"status\": \"Applied\",\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"previousHackathons\":\"5+\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n }\n }", + "content": "{\n \"message\": \"Successfully retrieved hacker information\", \n \"data\": {\n \"id\":\"5bff4d736f86be0a41badb91\",\n \"status\": \"Applied\",\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"previousHackathons\":\"5\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n }\n }", "type": "object" } ] @@ -1692,7 +1692,7 @@ "examples": [ { "title": "Success-Response: ", - "content": "{\n \"message\": \"Successfully retrieved hacker information\", \n \"data\": {\n \"id\":\"5bff4d736f86be0a41badb91\",\n \"status\": \"Applied\",\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"previousHackathons\":\"5+\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n }\n }", + "content": "{\n \"message\": \"Successfully retrieved hacker information\", \n \"data\": {\n \"id\":\"5bff4d736f86be0a41badb91\",\n \"status\": \"Applied\",\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"previousHackathons\":\"5\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n }\n }", "type": "object" } ] @@ -1927,7 +1927,7 @@ "examples": [ { "title": "application: ", - "content": "{\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"previousHackathons\":\"5+\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n }", + "content": "{\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"previousHackathons\":\"5\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n }", "type": "Json" } ] @@ -1954,7 +1954,7 @@ "examples": [ { "title": "Success-Response: ", - "content": "{\n \"message\": \"Changed hacker information\", \n \"data\": {\n \"id\":\"5bff4d736f86be0a41badb91\",\n \"status\": \"Applied\",\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"previousHackathons\":\"5+\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n }\n}", + "content": "{\n \"message\": \"Changed hacker information\", \n \"data\": {\n \"id\":\"5bff4d736f86be0a41badb91\",\n \"status\": \"Applied\",\n \"application\":{\n \"general\":{\n \"school\": \"McGill University\",\n \"degree\": \"Undergraduate\",\n \"fieldOfStudy\": \"Computer Science\",\n \"graduationYear\": \"2021\",\n \"jobInterest\":\"Internship\",\n \"URL\":{\n \"resume\":\"resumes/1543458163426-5bff4d736f86be0a41badb91\",\n \"github\":\"https://github.com/abcd\",\n \"dropler\":\"https://dribbble.com/abcd\",\n \"personal\":\"https://www.hi.com/\",\n \"linkedIn\":\"https://linkedin.com/in/abcd\",\n \"other\":\"https://github.com/hackmcgill/hackerAPI/issues/168\"\n },\n },\n \"shortAnswer\": {\n \"skills\":[\"Javascript\",\"Typescript\"],\n \"question1\": \"I love McHacks\",\n \"question2\":\"Pls accept me\",\n \"previousHackathons\":\"5\",\n \"comments\":\"hi!\",\n },\n \"other:\" {\n \"gender\": \"male\",\n \"ethnicity\": \"Asian or Pacific Islander\",\n \"privacyPolicy\": true,\n \"codeOfConduct\": true,\n }\n \"accomodation\": {\n \"travel\": 0\n },\n }\n }\n}", "type": "object" } ] diff --git a/middlewares/validators/hacker.validator.js b/middlewares/validators/hacker.validator.js index fcafb714..1d5a608a 100644 --- a/middlewares/validators/hacker.validator.js +++ b/middlewares/validators/hacker.validator.js @@ -94,11 +94,12 @@ module.exports = { "application.shortAnswer.question2", false ), - VALIDATOR.enumValidator( + VALIDATOR.integerValidator( "body", "application.shortAnswer.previousHackathons", - Constants.HACKATHONS_COUNT, - false + false, + 0, + 5 ), VALIDATOR.alphaArrayValidator( @@ -222,11 +223,12 @@ module.exports = { "application.shortAnswer.question2", false ), - VALIDATOR.enumValidator( + VALIDATOR.integerValidator( "body", "application.shortAnswer.previousHackathons", - Constants.HACKATHONS_COUNT, - false + false, + 0, + 5 ), VALIDATOR.alphaArrayValidator( diff --git a/middlewares/validators/validator.helper.js b/middlewares/validators/validator.helper.js index 85150f0d..25154791 100644 --- a/middlewares/validators/validator.helper.js +++ b/middlewares/validators/validator.helper.js @@ -478,7 +478,7 @@ function applicationValidator(fieldLocation, fieldname, optional = true) { // typeof app.shortAnswer.question2 === "string"; // hasValid.previousHackathons = // !!app.shortAnswer.previousHackathons && - // typeof app.shortAnswer.previousHackathons === "string"; + // typeof app.shortAnswer.previousHackathons === "number"; // hasValid.team = // !app.team || mongoose.Types.ObjectId.isValid(app.team); @@ -584,7 +584,7 @@ function applicationValidator(fieldLocation, fieldname, optional = true) { // typeof app.shortAnswer.question2 === "string"; // hasValid.previousHackathons = // !!app.shortAnswer.previousHackathons && - // typeof app.shortAnswer.previousHackathons === "string"; + // typeof app.shortAnswer.previousHackathons === "number"; // hasValid.team = // !app.team || mongoose.Types.ObjectId.isValid(app.team); return ( diff --git a/models/hacker.model.js b/models/hacker.model.js index 7e95f464..5be1d06f 100644 --- a/models/hacker.model.js +++ b/models/hacker.model.js @@ -88,8 +88,7 @@ const HackerSchema = new mongoose.Schema({ required: true }, previousHackathons: { - type: String, - enum: Constants.HACKATHONS_COUNT, + type: Number, required: true } }, diff --git a/routes/api/hacker.js b/routes/api/hacker.js index df163861..c6d73598 100644 --- a/routes/api/hacker.js +++ b/routes/api/hacker.js @@ -116,7 +116,7 @@ module.exports = { "skills":["Javascript","Typescript"], "question1": "I love McHacks", "question2":"Pls accept me", - "previousHackathons": "5+", + "previousHackathons": "5", "comments":"hi!", }, "other:" { @@ -159,7 +159,7 @@ module.exports = { "skills":["Javascript","Typescript"], "question1": "I love McHacks", "question2":"Pls accept me", - "previousHackathons": "5+", + "previousHackathons": "5", "comments":"hi!", }, "other:" { @@ -449,7 +449,7 @@ module.exports = { "skills":["Javascript","Typescript"], "question1": "I love McHacks", "question2":"Pls accept me", - "previousHackathons": "5+", + "previousHackathons": "5", "comments":"hi!", }, "other:" { @@ -492,7 +492,7 @@ module.exports = { "skills":["Javascript","Typescript"], "question1": "I love McHacks", "question2":"Pls accept me", - "previousHackathons": "5+", + "previousHackathons": "5", "comments":"hi!", }, "other:" { @@ -564,7 +564,7 @@ module.exports = { "skills":["Javascript","Typescript"], "question1": "I love McHacks", "question2":"Pls accept me", - "previousHackathons": "5+", + "previousHackathons": "5", "comments":"hi!", }, "other:" { @@ -632,7 +632,7 @@ module.exports = { "skills":["Javascript","Typescript"], "question1": "I love McHacks", "question2":"Pls accept me", - "previousHackathons": "5+", + "previousHackathons": "5", "comments":"hi!", }, "other:" { diff --git a/tests/util/hacker.test.util.js b/tests/util/hacker.test.util.js index 8d5132b1..25287159 100644 --- a/tests/util/hacker.test.util.js +++ b/tests/util/hacker.test.util.js @@ -35,7 +35,7 @@ const TeamHacker0 = { skills: ["CSS", "HTML", "JS"], question1: "a", question2: "a", - previousHackathons: "1" + previousHackathons: 1 }, other: { ethnicity: ["Native American"], @@ -76,7 +76,7 @@ const TeamHacker1 = { skills: ["CSS", "HTML", "JS"], question1: "a", question2: "a", - previousHackathons: "2" + previousHackathons: 2 }, other: { ethnicity: ["European"], @@ -117,7 +117,7 @@ const TeamHacker2 = { skills: ["CSS", "HTML", "JS"], question1: "a", question2: "a", - previousHackathons: "3" + previousHackathons: 3 }, other: { ethnicity: ["European"], @@ -158,7 +158,7 @@ const TeamHacker3 = { skills: ["CSS", "HTML", "JS"], question1: "a", question2: "a", - previousHackathons: "4" + previousHackathons: 4 }, other: { ethnicity: ["European"], @@ -199,7 +199,7 @@ const TeamHacker4 = { skills: ["CSS", "HTML", "JS"], question1: "a", question2: "a", - previousHackathons: "5+" + previousHackathons: 5 }, other: { ethnicity: ["European"], @@ -240,7 +240,7 @@ const NoTeamHacker0 = { skills: ["CSS", "HTML", "JS"], question1: "a", question2: "a", - previousHackathons: "1" + previousHackathons: 1 }, other: { ethnicity: ["European"], @@ -278,7 +278,7 @@ const newHacker0 = { skills: ["CSS", "HTML", "JS"], question1: "a", question2: "a", - previousHackathons: "2" + previousHackathons: 2 }, other: { ethnicity: ["Caucasian"], @@ -316,7 +316,7 @@ const newHacker1 = { skills: ["CSS", "HTML", "JS"], question1: "a", question2: "a", - previousHackathons: "3" + previousHackathons: 3 }, other: { ethnicity: ["African American"], @@ -355,7 +355,7 @@ const invalidHacker0 = { skills: ["CSS", "HTML", "JS"], question1: "a", question2: "a", - previousHackathons: "4" + previousHackathons: 4 }, other: { ethnicity: ["Caucasian"], @@ -391,7 +391,7 @@ const invalidHacker1 = { skills: ["CSS", "HTML", "JS"], question1: "a", question2: "a", - previousHackathons: "5+" + previousHackathons: 5 }, other: { ethnicity: ["Caucasian"], @@ -430,7 +430,7 @@ const invalidHacker2 = { skills: ["CSS", "HTML", "JS"], question1: "a", question2: "a", - previousHackathons: "1" + previousHackathons: 1 }, other: { ethnicity: ["Caucasian"], @@ -471,7 +471,7 @@ const duplicateAccountLinkHacker0 = { skills: ["CSS", "HTML", "JS"], question1: "a", question2: "a", - previousHackathons: "2" + previousHackathons: 2 }, other: { ethnicity: ["Caucasian"], @@ -511,7 +511,7 @@ const waitlistedHacker0 = { skills: ["CSS", "HTML", "JS"], question1: "a", question2: "a", - previousHackathons: "3" + previousHackathons: 3 }, other: { ethnicity: ["European"], @@ -552,7 +552,7 @@ const unconfirmedAccountHacker0 = { skills: ["CSS", "HTML", "JS"], question1: "a", question2: "a", - previousHackathons: "4" + previousHackathons: 4 }, other: { ethnicity: ["European"], @@ -592,7 +592,7 @@ const unconfirmedAccountHacker1 = { skills: ["CSS", "HTML", "JS"], question1: "a", question2: "a", - previousHackathons: "5+" + previousHackathons: 5 }, other: { ethnicity: ["European"], From 612bbf2531c328728251ed5b96ac1489ad16fd86 Mon Sep 17 00:00:00 2001 From: Tony Date: Thu, 22 Oct 2020 16:54:46 -0400 Subject: [PATCH 4/5] fix: change previousHackathons to enum of numbers --- constants/general.constant.js | 2 ++ middlewares/validators/hacker.validator.js | 18 ++++++++---------- models/hacker.model.js | 1 + 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/constants/general.constant.js b/constants/general.constant.js index cb0c4c06..04d8ff36 100644 --- a/constants/general.constant.js +++ b/constants/general.constant.js @@ -76,6 +76,7 @@ const SPONSOR_T5 = "SponsorT5"; // Enums (must match with frontend) const JOB_INTERESTS = ["Internship", "Full Time", "None"]; const SHIRT_SIZES = ["XS", "S", "M", "L", "XL", "XXL"]; +const PREVIOUS_HACKATHONS = [0, 1, 2, 3, 4, 5]; const ROLE_CATEGORIES = { SELF: ":self", @@ -189,6 +190,7 @@ module.exports = { REQUEST_TYPES: REQUEST_TYPES, JOB_INTERESTS: JOB_INTERESTS, SHIRT_SIZES: SHIRT_SIZES, + PREVIOUS_HACKATHONS: PREVIOUS_HACKATHONS, USER_TYPES: USER_TYPES, SPONSOR_TIERS: SPONSOR_TIERS, EXTENDED_USER_TYPES: EXTENDED_USER_TYPES, diff --git a/middlewares/validators/hacker.validator.js b/middlewares/validators/hacker.validator.js index 1d5a608a..4df44513 100644 --- a/middlewares/validators/hacker.validator.js +++ b/middlewares/validators/hacker.validator.js @@ -94,12 +94,11 @@ module.exports = { "application.shortAnswer.question2", false ), - VALIDATOR.integerValidator( + VALIDATOR.enumValidator( "body", - "application.shortAnswer.previousHackathons", - false, - 0, - 5 + "application.accommodation.previousHackathons", + Constants.PREVIOUS_HACKATHONS, + false ), VALIDATOR.alphaArrayValidator( @@ -223,12 +222,11 @@ module.exports = { "application.shortAnswer.question2", false ), - VALIDATOR.integerValidator( + VALIDATOR.enumValidator( "body", - "application.shortAnswer.previousHackathons", - false, - 0, - 5 + "application.accommodation.previousHackathons", + Constants.PREVIOUS_HACKATHONS, + false ), VALIDATOR.alphaArrayValidator( diff --git a/models/hacker.model.js b/models/hacker.model.js index 5be1d06f..8d46ba21 100644 --- a/models/hacker.model.js +++ b/models/hacker.model.js @@ -89,6 +89,7 @@ const HackerSchema = new mongoose.Schema({ }, previousHackathons: { type: Number, + enum: Constants.PREVIOUS_HACKATHONS, required: true } }, From 6c345d1c12362eefb5c4baa1c625c808308f05d3 Mon Sep 17 00:00:00 2001 From: Tony Date: Thu, 22 Oct 2020 19:57:03 -0400 Subject: [PATCH 5/5] fix: fix failing tests and restore package.json --- middlewares/validators/hacker.validator.js | 4 ++-- package.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/middlewares/validators/hacker.validator.js b/middlewares/validators/hacker.validator.js index 4df44513..d23737c6 100644 --- a/middlewares/validators/hacker.validator.js +++ b/middlewares/validators/hacker.validator.js @@ -96,7 +96,7 @@ module.exports = { ), VALIDATOR.enumValidator( "body", - "application.accommodation.previousHackathons", + "application.shortAnswer.previousHackathons", Constants.PREVIOUS_HACKATHONS, false ), @@ -224,7 +224,7 @@ module.exports = { ), VALIDATOR.enumValidator( "body", - "application.accommodation.previousHackathons", + "application.shortAnswer.previousHackathons", Constants.PREVIOUS_HACKATHONS, false ), diff --git a/package.json b/package.json index 5aefd511..f37b7ae3 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,8 @@ "private": true, "scripts": { "start": "DEBUG=hackboard:* NODE_ENV=development nodemon --ignore gcp_creds.json ./bin/www.js", - "deploy": "NODE_ENV=development node ./bin/www.js", - "debug": "DEBUG=hackboard:* NODE_ENV=development nodemon --ignore gcp_creds.json ./bin/www.js", + "deploy": "NODE_ENV=deployment node ./bin/www.js", + "debug": "DEBUG=hackboard:* NODE_ENV=deployment nodemon --ignore gcp_creds.json ./bin/www.js", "test": "DEBUG=hackboard:* NODE_ENV=test mocha --reporter spec tests/**.js --exit", "seed": "NODE_ENV=development node ./seed/index.js", "docs": "apidoc -i ./routes -o ./docs/api/",