diff --git a/.eslintignore b/.eslintignore index 0a382569..9c8800ca 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,3 +1,4 @@ assets/ docs/ node_modules/ +VERSION diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index f58a2e7a..a200cca9 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -5,6 +5,20 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.0.1](https://github.com/hackmcgill/hackerapi/tree/2.0.1) - 2019-12-24 + +### Added + +- Add tests for `travel` field in hacker's application + +### Changed + +- Removed all instances of `needsBus` + +### Fixed + +- Change the attribute used to check already exisiting emails when updating one's account + ## [2.0.0](https://github.com/hackmcgill/hackerapi/tree/2.0.0) - 2019-12-17 ### Added diff --git a/.prettierignore b/.prettierignore index 0a382569..9c8800ca 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,3 +1,4 @@ assets/ docs/ node_modules/ +VERSION diff --git a/VERSION b/VERSION index 227cea21..38f77a65 100755 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.0.0 +2.0.1 diff --git a/docs/api/api_data.js b/docs/api/api_data.js index b88c32e5..7b6e9e3b 100644 --- a/docs/api/api_data.js +++ b/docs/api/api_data.js @@ -1357,7 +1357,7 @@ define({ group: "body", type: "Boolean", optional: false, - field: "needsBus", + field: "travel", description: "
Whether the hacker requires a bus for transportation
" }, @@ -1433,7 +1433,7 @@ define({ { title: "Success-Response: ", content: - '{\n "message": "Hacker creation successful", \n "data": {\n "id":"5bff4d736f86be0a41badb91",\n "application":{\n "portfolioURL":{\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 "needsBus":false,\n "major":"Accounting",\n "graduationYear":2019,\n "codeOfConduct":true,\n }\n}', + '{\n "message": "Hacker creation successful", \n "data": {\n "id":"5bff4d736f86be0a41badb91",\n "application":{\n "portfolioURL":{\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" } ] @@ -1517,7 +1517,7 @@ define({ { title: "Success-Response: ", content: - '{\n "message": "Successfully retrieved hacker information", \n "data": {\n "id":"5bff4d736f86be0a41badb91",\n "application":{\n "portfolioURL":{\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 "needsBus":false,\n "major":"Accounting",\n "graduationYear":2019,\n "codeOfConduct":true,\n }\n }', + '{\n "message": "Successfully retrieved hacker information", \n "data": {\n "id":"5bff4d736f86be0a41badb91",\n "application":{\n "portfolioURL":{\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" } ] @@ -1600,7 +1600,7 @@ define({ { title: "Success-Response: ", content: - '{\n "message": "Successfully retrieved hacker information", \n "data": {\n "id":"5bff4d736f86be0a41badb91",\n "application":{\n "portfolioURL":{\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 "needsBus":false,\n "major":"Accounting",\n "graduationYear":2019,\n "codeOfConduct":true,\n }\n }', + '{\n "message": "Successfully retrieved hacker information", \n "data": {\n "id":"5bff4d736f86be0a41badb91",\n "application":{\n "portfolioURL":{\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" } ] @@ -1764,7 +1764,7 @@ define({ { 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 needsBus: { "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}', + '{\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: { 7:7, 0: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" } ] @@ -1808,7 +1808,7 @@ define({ group: "body", type: "Boolean", optional: true, - field: "needsBus", + field: "travel", description: "Whether the hacker requires a bus for transportation
" }, @@ -1875,7 +1875,7 @@ define({ { title: "Success-Response: ", content: - '{\n "message": "Changed hacker information", \n "data": {\n "id":"5bff4d736f86be0a41badb91",\n "application":{\n "portfolioURL":{\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 "needsBus":false,\n "major":"Accounting",\n "graduationYear":2019,\n "codeOfConduct":true,\n}', + '{\n "message": "Changed hacker information", \n "data": {\n "id":"5bff4d736f86be0a41badb91",\n "application":{\n "portfolioURL":{\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}', type: "object" } ] @@ -2396,7 +2396,7 @@ define({ { title: "Success-Response: ", content: - '{\n "message": "Hacker found by logged in account id", \n "data": {\n "id":"5bff4d736f86be0a41badb91",\n "application":{\n "portfolioURL":{\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 "needsBus":false,\n "major":["Accounting"],\n "graduationYear":2019,\n "codeOfConduct":true,\n } \n }', + '{\n "message": "Hacker found by logged in account id", \n "data": {\n "id":"5bff4d736f86be0a41badb91",\n "application":{\n "portfolioURL":{\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" } ] diff --git a/docs/api/api_data.json b/docs/api/api_data.json index a759f28e..7f69476a 100644 --- a/docs/api/api_data.json +++ b/docs/api/api_data.json @@ -1352,7 +1352,7 @@ "group": "body", "type": "Boolean", "optional": false, - "field": "needsBus", + "field": "travel", "description": "Whether the hacker requires a bus for transportation
" }, { @@ -1422,7 +1422,7 @@ "examples": [ { "title": "Success-Response: ", - "content": "{\n \"message\": \"Hacker creation successful\", \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 \"needsBus\":false,\n \"major\":\"Accounting\",\n \"graduationYear\":2019,\n \"codeOfConduct\":true,\n }\n}", + "content": "{\n \"message\": \"Hacker creation successful\", \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" } ] @@ -1504,7 +1504,7 @@ "examples": [ { "title": "Success-Response: ", - "content": "{\n \"message\": \"Successfully retrieved hacker information\", \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 \"needsBus\":false,\n \"major\":\"Accounting\",\n \"graduationYear\":2019,\n \"codeOfConduct\":true,\n }\n }", + "content": "{\n \"message\": \"Successfully retrieved hacker information\", \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" } ] @@ -1586,7 +1586,7 @@ "examples": [ { "title": "Success-Response: ", - "content": "{\n \"message\": \"Successfully retrieved hacker information\", \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 \"needsBus\":false,\n \"major\":\"Accounting\",\n \"graduationYear\":2019,\n \"codeOfConduct\":true,\n }\n }", + "content": "{\n \"message\": \"Successfully retrieved hacker information\", \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" } ] @@ -1743,7 +1743,7 @@ "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 needsBus: { \"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}", + "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: { \"7\": 7, \"0\": 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" } ] @@ -1785,7 +1785,7 @@ "group": "body", "type": "Boolean", "optional": true, - "field": "needsBus", + "field": "travel", "description": "Whether the hacker requires a bus for transportation
" }, { @@ -1848,7 +1848,7 @@ "examples": [ { "title": "Success-Response: ", - "content": "{\n \"message\": \"Changed hacker information\", \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 \"needsBus\":false,\n \"major\":\"Accounting\",\n \"graduationYear\":2019,\n \"codeOfConduct\":true,\n}", + "content": "{\n \"message\": \"Changed hacker information\", \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}", "type": "object" } ] @@ -2367,7 +2367,7 @@ "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 \"needsBus\":false,\n \"major\":[\"Accounting\"],\n \"graduationYear\":2019,\n \"codeOfConduct\":true,\n } \n }", + "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" } ] diff --git a/middlewares/account.middleware.js b/middlewares/account.middleware.js index 38b14170..3c4ef751 100644 --- a/middlewares/account.middleware.js +++ b/middlewares/account.middleware.js @@ -169,7 +169,7 @@ async function updateAccount(req, res, next) { // TODO: When pull request for parse patch refactor #546 hits, req.body.email will not be present. if (req.body.email && account.email != req.body.email) { const existingAccount = await Services.Account.findByEmail( - account.email + req.body.email ); if (existingAccount) { return next({ diff --git a/middlewares/validators/validator.helper.js b/middlewares/validators/validator.helper.js index 961e2c53..e64096f4 100644 --- a/middlewares/validators/validator.helper.js +++ b/middlewares/validators/validator.helper.js @@ -41,7 +41,7 @@ function integerValidator( return value >= lowerBound && value <= upperBound; }) .withMessage( - `${fieldname} must be between ${lowerBound} and ${upperBound}` + `${fieldname} must be between ${lowerBound} and ${upperBound}` ); } else { return value @@ -53,7 +53,7 @@ function integerValidator( return value >= lowerBound && value <= upperBound; }) .withMessage( - `${fieldname} must be between ${lowerBound} and ${upperBound}` + `${fieldname} must be between ${lowerBound} and ${upperBound}` ); } } diff --git a/package.json b/package.json index 459ece67..4110eb41 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hackerAPI", - "version": "2.0.0", + "version": "2.0.1", "private": true, "scripts": { "start": "DEBUG=hackboard:* NODE_ENV=development nodemon --ignore gcp_creds.json ./bin/www.js", diff --git a/tests/account.test.js b/tests/account.test.js index 467f4101..ca456296 100644 --- a/tests/account.test.js +++ b/tests/account.test.js @@ -287,13 +287,15 @@ describe("PATCH update account", function() { const updatedInfo = { _id: teamHackerAccount0._id, firstName: "new", - lastName: "name" + lastName: "name", + email: "newUpdatedEmail@mail.com" }; const failUpdatedInfo = { _id: Admin0._id, firstName: "fail", - lastName: "fail" + lastName: "fail", + email: storedAccount1.email }; // fail on authentication @@ -358,6 +360,7 @@ describe("PATCH update account", function() { // Is this correct matching of data? res.body.data.firstName.should.equal(updatedInfo.firstName); res.body.data.lastName.should.equal(updatedInfo.lastName); + res.body.data.email.should.equal(updatedInfo.email); done(); }); }); @@ -387,6 +390,29 @@ describe("PATCH update account", function() { }); }); }); + + // fail due to attempt to update account email to one that already exists in DB + it("should FAIL to update email to one that already exists", function(done) { + util.auth.login(agent, Admin0, (error) => { + if (error) { + agent.close(); + return done(error); + } + agent + .patch(`/api/account/${failUpdatedInfo._id}`) + .type("application/json") + .send(failUpdatedInfo) + .end(function(err, res) { + res.should.have.status(409); + res.should.be.json; + res.body.should.have.property("message"); + res.body.message.should.equal( + Constants.Error.ACCOUNT_EMAIL_409_MESSAGE + ); + done(); + }); + }); + }); }); describe("POST reset password", function() { diff --git a/tests/hacker.test.js b/tests/hacker.test.js index 4ad47f27..15e8b9fb 100644 --- a/tests/hacker.test.js +++ b/tests/hacker.test.js @@ -29,6 +29,7 @@ const volunteerAccount0 = util.account.volunteerAccounts.stored[0]; const newHackerAccount0 = util.account.hackerAccounts.new[0]; const newHacker0 = util.hacker.newHacker0; const invalidHacker0 = util.hacker.invalidHacker0; +const invalidHacker2 = util.hacker.invalidHacker2; const newHacker1 = util.hacker.newHacker1; const noTeamHackerAccount0 = util.account.hackerAccounts.stored.noTeam[0]; @@ -446,6 +447,39 @@ describe("POST create hacker", function() { }); }); + // should fail due to travel request larger than 100 + it("should FAIL if the new hacker inputs a value larger than 100 for travel reimbursement", function(done) { + util.auth.login(agent, newHackerAccount0, (error) => { + if (error) { + agent.close(); + return done(error); + } + return agent + .post(`/api/hacker/`) + .type("application/json") + .send(invalidHacker2) + .end(function(err, res) { + res.should.have.status(422); + res.should.be.json; + res.body.should.have.property("message"); + res.body.message.should.equal("Validation failed"); + res.body.should.have.property("data"); + res.body.data.should.have.property( + "application.accommodation.travel" + ); + res.body.data[ + "application.accommodation.travel" + ].should.have.property("msg"); + res.body.data[ + "application.accommodation.travel" + ].msg.should.equal( + "application.accommodation.travel must be between 0 and 100" + ); + done(); + }); + }); + }); + // should fail due to 'false' on code of conduct it("should FAIL if the new hacker does not accept code of conduct", function(done) { util.auth.login(agent, newHackerAccount0, (error) => { @@ -568,6 +602,17 @@ describe("POST create hacker", function() { res.body.data[ "application.general.jobInterest" ].msg.should.equal("The value must be part of the enum"); + res.body.data.should.have.property( + "application.accommodation.travel" + ); + res.body.data[ + "application.accommodation.travel" + ].should.have.property("msg"); + res.body.data[ + "application.accommodation.travel" + ].msg.should.equal( + "application.accommodation.travel must be an integer." + ); done(); }); diff --git a/tests/util/hacker.test.util.js b/tests/util/hacker.test.util.js index d56343fd..dd392560 100644 --- a/tests/util/hacker.test.util.js +++ b/tests/util/hacker.test.util.js @@ -391,7 +391,46 @@ const invalidHacker1 = { accommodation: { dietaryRestrictions: ["Gluten-Free"], shirtSize: "L", - travel: 0 + travel: "sfg" + } + } +}; + +// duplicate of newHack0, but with 101 for travel +const invalidHacker2 = { + accountId: Util.Account.hackerAccounts.new[0]._id, + application: { + general: { + school: "University of ASDF", + degree: "Masters", + fieldOfStudy: ["EE"], + graduationYear: 2019, + jobInterest: "Full Time", + URL: { + //gcloud bucket link + resume: "www.gcloud.com/myResume100", + github: "www.github.com/Person1", + dribbble: null, + personal: "www.person1.com", + linkedIn: "www.linkedin.com/in/Person1", + other: null + } + }, + shortAnswer: { + skills: ["CSS", "HTML", "JS"], + question1: "a", + question2: "a" + }, + other: { + ethnicity: ["Caucasian"], + codeOfConduct: true, + privacyPolicy: true + }, + accommodation: { + dietaryRestrictions: ["Gluten-Free"], + shirtSize: "L", + // must be between [0,100] to be valid + travel: 101 } } }; @@ -581,6 +620,7 @@ module.exports = { invalidHacker0: invalidHacker0, invalidHacker1: invalidHacker1, + invalidHacker2: invalidHacker2, duplicateAccountLinkHacker0: duplicateAccountLinkHacker0, waitlistedHacker0: waitlistedHacker0,