diff --git a/docs/api/api_data.js b/docs/api/api_data.js index d2b5cc09..5b0bd3af 100644 --- a/docs/api/api_data.js +++ b/docs/api/api_data.js @@ -1250,7 +1250,7 @@ define({ }, { "type": "get", - "url": "/hacker/email/:email", + "url": "/hacker/:id", "title": "get a hacker's information", "name": "getHacker", "group": "Hacker", @@ -1261,8 +1261,8 @@ define({ "group": "param", "type": "String", "optional": false, - "field": "email", - "description": "

a hacker's unique email

" + "field": "id", + "description": "

a hacker's unique mongoID

" }] } }, @@ -1317,12 +1317,12 @@ define({ "filename": "routes/api/hacker.js", "groupTitle": "Hacker", "sampleRequest": [{ - "url": "https://api.mchacks.ca/api/hacker/email/:email" + "url": "https://api.mchacks.ca/api/hacker/:id" }] }, { "type": "get", - "url": "/hacker/:id", + "url": "/hacker/email/:email", "title": "get a hacker's information", "name": "getHacker", "group": "Hacker", @@ -1333,8 +1333,8 @@ define({ "group": "param", "type": "String", "optional": false, - "field": "id", - "description": "

a hacker's unique mongoID

" + "field": "email", + "description": "

a hacker's unique email

" }] } }, @@ -1389,7 +1389,7 @@ define({ "filename": "routes/api/hacker.js", "groupTitle": "Hacker", "sampleRequest": [{ - "url": "https://api.mchacks.ca/api/hacker/:id" + "url": "https://api.mchacks.ca/api/hacker/email/:email" }] }, { @@ -1628,7 +1628,7 @@ define({ { "type": "patch", "url": "/hacker/confirmation/:id", - "title": "Allows confirmation of hacker attendence if they are accepted. Also allows change from 'confirmed' back to 'accepted'", + "title": "Allows confirmation of hacker attendence if they are accepted. Also allows change from 'confirmed' to 'cancelled'.", "name": "patchHackerConfirmed", "group": "Hacker", "version": "0.0.9", @@ -1639,7 +1639,7 @@ define({ "type": "string", "optional": true, "field": "status", - "description": "

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

" + "description": "

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

" }] } }, diff --git a/docs/api/api_data.json b/docs/api/api_data.json index 04a94c3f..6f4a30e4 100644 --- a/docs/api/api_data.json +++ b/docs/api/api_data.json @@ -1249,7 +1249,7 @@ }, { "type": "get", - "url": "/hacker/email/:email", + "url": "/hacker/:id", "title": "get a hacker's information", "name": "getHacker", "group": "Hacker", @@ -1260,8 +1260,8 @@ "group": "param", "type": "String", "optional": false, - "field": "email", - "description": "

a hacker's unique email

" + "field": "id", + "description": "

a hacker's unique mongoID

" }] } }, @@ -1316,12 +1316,12 @@ "filename": "routes/api/hacker.js", "groupTitle": "Hacker", "sampleRequest": [{ - "url": "https://api.mchacks.ca/api/hacker/email/:email" + "url": "https://api.mchacks.ca/api/hacker/:id" }] }, { "type": "get", - "url": "/hacker/:id", + "url": "/hacker/email/:email", "title": "get a hacker's information", "name": "getHacker", "group": "Hacker", @@ -1332,8 +1332,8 @@ "group": "param", "type": "String", "optional": false, - "field": "id", - "description": "

a hacker's unique mongoID

" + "field": "email", + "description": "

a hacker's unique email

" }] } }, @@ -1388,7 +1388,7 @@ "filename": "routes/api/hacker.js", "groupTitle": "Hacker", "sampleRequest": [{ - "url": "https://api.mchacks.ca/api/hacker/:id" + "url": "https://api.mchacks.ca/api/hacker/email/:email" }] }, { @@ -1627,7 +1627,7 @@ { "type": "patch", "url": "/hacker/confirmation/:id", - "title": "Allows confirmation of hacker attendence if they are accepted. Also allows change from 'confirmed' back to 'accepted'", + "title": "Allows confirmation of hacker attendence if they are accepted. Also allows change from 'confirmed' to 'cancelled'.", "name": "patchHackerConfirmed", "group": "Hacker", "version": "0.0.9", @@ -1638,7 +1638,7 @@ "type": "string", "optional": true, "field": "status", - "description": "

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

" + "description": "

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

" }] } }, diff --git a/docs/api/api_project.js b/docs/api/api_project.js index 0cd83632..e3449be3 100644 --- a/docs/api/api_project.js +++ b/docs/api/api_project.js @@ -1,16 +1,16 @@ -define({ - "name": "hackerAPI", - "version": "0.0.8", - "description": "Documentation for the API used for mchacks", - "defaultVersion": "0.0.8", - "title": "hackerAPI documentation", - "url": "https://api.mchacks.ca/api", - "sampleUrl": "https://api.mchacks.ca/api", - "apidoc": "0.3.0", - "generator": { - "name": "apidoc", - "time": "2019-01-10T23:24:21.462Z", - "url": "http://apidocjs.com", - "version": "0.17.7" - } +define({ + "name": "hackerAPI", + "version": "0.0.8", + "description": "Documentation for the API used for mchacks", + "defaultVersion": "0.0.8", + "title": "hackerAPI documentation", + "url": "https://api.mchacks.ca/api", + "sampleUrl": "https://api.mchacks.ca/api", + "apidoc": "0.3.0", + "generator": { + "name": "apidoc", + "time": "2019-01-14T00:33:25.620Z", + "url": "http://apidocjs.com", + "version": "0.17.7" + } }); \ No newline at end of file diff --git a/docs/api/api_project.json b/docs/api/api_project.json index 8ad885dc..18887846 100644 --- a/docs/api/api_project.json +++ b/docs/api/api_project.json @@ -1,16 +1,16 @@ -{ - "name": "hackerAPI", - "version": "0.0.8", - "description": "Documentation for the API used for mchacks", - "defaultVersion": "0.0.8", - "title": "hackerAPI documentation", - "url": "https://api.mchacks.ca/api", - "sampleUrl": "https://api.mchacks.ca/api", - "apidoc": "0.3.0", - "generator": { - "name": "apidoc", - "time": "2019-01-10T23:24:21.462Z", - "url": "http://apidocjs.com", - "version": "0.17.7" - } +{ + "name": "hackerAPI", + "version": "0.0.8", + "description": "Documentation for the API used for mchacks", + "defaultVersion": "0.0.8", + "title": "hackerAPI documentation", + "url": "https://api.mchacks.ca/api", + "sampleUrl": "https://api.mchacks.ca/api", + "apidoc": "0.3.0", + "generator": { + "name": "apidoc", + "time": "2019-01-14T00:33:25.620Z", + "url": "http://apidocjs.com", + "version": "0.17.7" + } } \ No newline at end of file diff --git a/middlewares/hacker.middleware.js b/middlewares/hacker.middleware.js index 2e4fbd71..22e982ec 100644 --- a/middlewares/hacker.middleware.js +++ b/middlewares/hacker.middleware.js @@ -98,7 +98,7 @@ function parseCheckIn(req, res, next) { * @param {(err?)=>void} next * @return {void} * @description - * Changes req.body.status to confirmed or accepted depending on whether req.body.confirm is true or false respectively. + * Changes req.body.status to confirmed or cancelled depending on whether req.body.confirm is true or false respectively. * Deletes req.body.confirm afterwards */ function parseConfirmation(req, res, next) { @@ -107,7 +107,7 @@ function parseConfirmation(req, res, next) { if (confirm) { req.body.status = Constants.General.HACKER_STATUS_CONFIRMED; } else { - req.body.status = Constants.General.HACKER_STATUS_ACCEPTED; + req.body.status = Constants.General.HACKER_STATUS_CANCELLED; } delete req.body.confirm; diff --git a/routes/api/hacker.js b/routes/api/hacker.js index 5c04897c..d7f690d8 100644 --- a/routes/api/hacker.js +++ b/routes/api/hacker.js @@ -550,12 +550,12 @@ module.exports = { /** * @api {patch} /hacker/confirmation/:id - * Allows confirmation of hacker attendence if they are accepted. Also allows change from 'confirmed' back to 'accepted' + * Allows confirmation of hacker attendence if they are accepted. Also allows change from 'confirmed' to 'cancelled'. * @apiName patchHackerConfirmed * @apiGroup Hacker * @apiVersion 0.0.9 * - * @apiParam (body) {string} [status] The new status of the hacker. "Accepted" or "Confirmed" + * @apiParam (body) {string} [status] The new status of the hacker. "Accepted", "Confirmed", or "Cancelled" * @apiSuccess {string} message Success message * @apiSuccess {object} data Hacker object * @apiSuccessExample {object} Success-Response: @@ -577,7 +577,7 @@ module.exports = { Middleware.parseBody.middleware, Middleware.Hacker.parsePatch, - Middleware.Hacker.checkStatus([CONSTANTS.HACKER_STATUS_ACCEPTED, CONSTANTS.HACKER_STATUS_CONFIRMED]), + Middleware.Hacker.checkStatus([CONSTANTS.HACKER_STATUS_ACCEPTED, CONSTANTS.HACKER_STATUS_CONFIRMED, CONSTANTS.HACKER_STATUS_CANCELLED]), Middleware.Hacker.parseConfirmation, Middleware.Hacker.updateHacker, diff --git a/tests/hacker.test.js b/tests/hacker.test.js index ec8c347a..d1a44e63 100644 --- a/tests/hacker.test.js +++ b/tests/hacker.test.js @@ -735,7 +735,7 @@ describe("PATCH update one hacker", function () { res.body.message.should.equal(Constants.Success.HACKER_UPDATE); res.body.should.have.property("data"); chai.assert.equal(JSON.stringify(res.body.data), JSON.stringify({ - status: Constants.General.HACKER_STATUS_ACCEPTED + status: Constants.General.HACKER_STATUS_CANCELLED })); done();