Skip to content

Commit 70768ea

Browse files
authored
Merge develop into master (#283)
* WIP role create route * Change role service async calls to be in line with other services * Write stats route * Update docs * Add tests * Add role to vs code debugger * Add role services * Fix false async * create role middleware * role error constants and add to app.js * create role controller * WIP role route and role route tests * Fix crucial bug, add additional search feature * Update documentation * Make test more descriptive * Move variable to constants file * create /api/role/ route * Add success constants * Add tests * Fix validator logic * fix bugs with services with missing await * comenting and documentation * Constants/successes (#213) * Fix mention of docs to reflect new docs address * version 1.1.0 * version 1.1.1 * allow booleanValidator to take comparator value for codeOfConduct * Create tests for false codeOfConduct in hacker * Move success messages to constants file * add missing success message * Add comments, change tests a little * Remove duplicate check * Fix develop (#223) * Fix mention of docs to reflect new docs address * version 1.1.0 * version 1.1.1 * allow booleanValidator to take comparator value for codeOfConduct * Create tests for false codeOfConduct in hacker * Separate account read into controller and middleware * Move findbyid into middleware * Separate sponsor controller in to middleware and controller * Split team into middleware * Split volunteer creation into middleware and controller * Fix tests * Add teamId to hacker * Combine name and pronoun validators with duplicate logic into ascii validator * change all name and pronoun validator to ascii validator * Merge validations * Update parsehacker to include teamId * Create checks for team size for update * WIP join team route * Controller and WIP tests * remove async, make devpost optional * Fix typos and merge constants * wip auth * switch names to success.constant * wip tests * Bump winston from 2.4.2 to 2.4.4 Bumps [winston](https://github.com/winstonjs/winston) from 2.4.2 to 2.4.4. - [Release notes](https://github.com/winstonjs/winston/releases) - [Changelog](https://github.com/winstonjs/winston/blob/2.4.4/CHANGELOG.md) - [Commits](winstonjs/winston@2.4.2...2.4.4) Signed-off-by: dependabot[bot] <support@dependabot.com> * Bump jshint from 2.9.6 to 2.9.7 Bumps [jshint](https://github.com/jshint/jshint) from 2.9.6 to 2.9.7. - [Release notes](https://github.com/jshint/jshint/releases) - [Changelog](https://github.com/jshint/jshint/blob/master/CHANGELOG.md) - [Commits](jshint/jshint@2.9.6...2.9.7) Signed-off-by: dependabot[bot] <support@dependabot.com> * Bump express-validator from 5.2.0 to 5.3.1 Bumps [express-validator](https://github.com/express-validator/express-validator) from 5.2.0 to 5.3.1. - [Release notes](https://github.com/express-validator/express-validator/releases) - [Commits](express-validator/express-validator@v5.2.0...v5.3.1) Signed-off-by: dependabot[bot] <support@dependabot.com> * Bump chai from 4.1.2 to 4.2.0 Bumps [chai](https://github.com/chaijs/chai) from 4.1.2 to 4.2.0. - [Release notes](https://github.com/chaijs/chai/releases) - [Changelog](https://github.com/chaijs/chai/blob/master/History.md) - [Commits](chaijs/chai@4.1.2...4.2.0) Signed-off-by: dependabot[bot] <support@dependabot.com> * Bump express-winston from 2.5.1 to 2.6.0 Bumps [express-winston](https://github.com/bithavoc/express-winston) from 2.5.1 to 2.6.0. - [Release notes](https://github.com/bithavoc/express-winston/releases) - [Changelog](https://github.com/bithavoc/express-winston/blob/master/CHANGELOG.md) - [Commits](https://github.com/bithavoc/express-winston/commits/v2.6.0) Signed-off-by: dependabot[bot] <support@dependabot.com> * Bump @types/mongoose from 5.0.13 to 5.3.5 Bumps [@types/mongoose](https://github.com/DefinitelyTyped/DefinitelyTyped) from 5.0.13 to 5.3.5. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits) Signed-off-by: dependabot[bot] <support@dependabot.com> * Bump @types/google-cloud__storage from 1.7.1 to 1.7.2 Bumps [@types/google-cloud__storage](https://github.com/DefinitelyTyped/DefinitelyTyped) from 1.7.1 to 1.7.2. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits) Signed-off-by: dependabot[bot] <support@dependabot.com> * Bump apidoc from 0.17.6 to 0.17.7 Bumps [apidoc](https://github.com/apidoc/apidoc) from 0.17.6 to 0.17.7. - [Release notes](https://github.com/apidoc/apidoc/releases) - [Changelog](https://github.com/apidoc/apidoc/blob/master/CHANGELOG.md) - [Commits](https://github.com/apidoc/apidoc/commits) Signed-off-by: dependabot[bot] <support@dependabot.com> * Bump cors from 2.8.4 to 2.8.5 Bumps [cors](https://github.com/expressjs/cors) from 2.8.4 to 2.8.5. - [Release notes](https://github.com/expressjs/cors/releases) - [Changelog](https://github.com/expressjs/cors/blob/master/HISTORY.md) - [Commits](expressjs/cors@v2.8.4...v2.8.5) Signed-off-by: dependabot[bot] <support@dependabot.com> * Bump @types/mongodb from 3.0.18 to 3.1.18 Bumps [@types/mongodb](https://github.com/DefinitelyTyped/DefinitelyTyped) from 3.0.18 to 3.1.18. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits) Signed-off-by: dependabot[bot] <support@dependabot.com> * More test cases * Bump mongoose from 5.1.0 to 5.4.1 Bumps [mongoose](https://github.com/Automattic/mongoose) from 5.1.0 to 5.4.1. - [Release notes](https://github.com/Automattic/mongoose/releases) - [Changelog](https://github.com/Automattic/mongoose/blob/master/History.md) - [Commits](Automattic/mongoose@5.1.0...5.4.1) Signed-off-by: dependabot[bot] <support@dependabot.com> * update npm packages * Fix typo * Fix typos and make sure tests work * Add documentation and comments * remove WIP material * Remove debug constants * Change team services to also update hacker * Bump dotenv from 5.0.1 to 6.2.0 (#240) Bumps [dotenv](https://github.com/motdotla/dotenv) from 5.0.1 to 6.2.0. - [Release notes](https://github.com/motdotla/dotenv/releases) - [Changelog](https://github.com/motdotla/dotenv/blob/master/CHANGELOG.md) - [Commits](motdotla/dotenv@v5.0.1...v6.2.0) Signed-off-by: dependabot[bot] <support@dependabot.com> * Update regex pattern * change to enum validation (#259) * Revert "Bump jsonwebtoken from 8.3.0 to 8.4.0" This reverts commit e1cb108. * Revert "Bump bcrypt from 3.0.0 to 3.0.3" This reverts commit e40d783. * Revert "Bump @google-cloud/storage from 2.3.1 to 2.3.4" This reverts commit 1b4c8a2. * Revert "Bump nodemon from 1.17.3 to 1.18.9" This reverts commit 8b09373. * Revert "Bump @types/express from 4.11.1 to 4.16.0" This reverts commit 24f564e. * Revert "Bump multer from 1.3.1 to 1.4.1" This reverts commit c05f136. * Revert "Bump express from 4.16.3 to 4.16.4" This reverts commit d9ce20d. * Revert "Bump chai-http from 4.0.0 to 4.2.0" This reverts commit fc1f73d. * Revert "version 1.1.2" This reverts commit 4c81019. * Revert "Develop (#225)" This reverts commit 24a2748. * Bump chai-http from 4.0.0 to 4.2.1 Bumps [chai-http](https://github.com/chaijs/chai-http) from 4.0.0 to 4.2.1. - [Release notes](https://github.com/chaijs/chai-http/releases) - [Changelog](https://github.com/chaijs/chai-http/blob/master/History.md) - [Commits](chaijs/chai-http@4.0.0...4.2.1) Signed-off-by: dependabot[bot] <support@dependabot.com> * Bump @types/mongoose from 5.3.5 to 5.3.6 Bumps [@types/mongoose](https://github.com/DefinitelyTyped/DefinitelyTyped) from 5.3.5 to 5.3.6. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits) Signed-off-by: dependabot[bot] <support@dependabot.com> * change errors * Bump mongoose from 5.4.1 to 5.4.2 Bumps [mongoose](https://github.com/Automattic/mongoose) from 5.4.1 to 5.4.2. - [Release notes](https://github.com/Automattic/mongoose/releases) - [Changelog](https://github.com/Automattic/mongoose/blob/master/History.md) - [Commits](Automattic/mongoose@5.4.1...5.4.2) Signed-off-by: dependabot[bot] <support@dependabot.com> * Bump @types/mongoose from 5.3.6 to 5.3.7 Bumps [@types/mongoose](https://github.com/DefinitelyTyped/DefinitelyTyped) from 5.3.6 to 5.3.7. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits) Signed-off-by: dependabot[bot] <support@dependabot.com> * Make projectName optional * add next * Fix bug where new Team validator looked for name, not teamName * Update docs * Change all instances of teamName to name * Add check for hacker joining same team * comments * Make more items editable (#269) * Make more items editable * Update docs * Add flags to mongoose connection (#272) * Add invite route (#252) * Add invite route * Documentation * Feature/team get (#270) * Add routes and roles * add showTeam with member names * create tests * Create middleware to display member names and add auth * documentation and function commenting * add some more test details * docs and typo * Change findMemberNames to use Mongoose.populate * Change documentation to so param type is ObjectId * Move id for get to be in req.param * Fix documentation, make test cases more detailed * Feature/team post (#273) * change to enum validation * Add authentication to team create * Create team * Add tests for team * WIP team post duplication issue * Add check for duplicate team name, and test for hacker already being in a team * uncomment tests * fix git merge mistake * Remove testing code, make sure create also updates hacker * docs * Remove test index * re-add index on team name * fix merge issue * Feature/274 stats query (#275) * Add query param to stats * Docs * Fix test * Feature/278 team leave (#279) * Add route * Change success name, add tests * Fix api_data * Add removeTeamIfEmpty * Add leave to hackerRole * Bug fix * General team bugfixes * fn name change * Remove console.log * Change function name * Feature/team patch (#277) * WIP team patch * WIP team patch * docs and tests * fix merge issue * WIP patch * Commenting, fix parsePatch, remove unused function * PR comments * Description and errors * Fix bracket issue * Change link (#282)
1 parent 484bf49 commit 70768ea

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+3688
-974
lines changed

.dockerignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
node_modules
2-
npm-debug.log
3-
certbot
2+
npm-debug.log

.vscode/launch.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,22 @@
179179
"${workspaceFolder}/tests/auth.test.js"
180180
],
181181
"internalConsoleOptions": "openOnSessionStart"
182+
},
183+
{
184+
"type": "node",
185+
"request": "launch",
186+
"name": "Mocha Tests - Role",
187+
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
188+
"args": [
189+
"-u",
190+
"tdd",
191+
"--timeout",
192+
"999999",
193+
"--colors",
194+
"${workspaceFolder}/tests/setup.spec.js",
195+
"${workspaceFolder}/tests/role.test.js"
196+
],
197+
"internalConsoleOptions": "openOnSessionStart"
182198
}
183199
]
184200
}

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.1.2
1+
1.1.1

app.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const teamRouter = require("./routes/api/team");
2828
const sponsorRouter = require("./routes/api/sponsor");
2929
const searchRouter = require("./routes/api/search");
3030
const volunteerRouter = require("./routes/api/volunteer");
31+
const roleRouter = require("./routes/api/role");
3132

3233
const app = express();
3334
Services.db.connect(app);
@@ -83,6 +84,8 @@ volunteerRouter.activate(apiRouter);
8384
Services.log.info("Volunteer router activated");
8485
searchRouter.activate(apiRouter);
8586
Services.log.info("Search router activated");
87+
roleRouter.activate(apiRouter);
88+
Services.log.info("Role router activated");
8689

8790
apiRouter.use("/", indexRouter);
8891
app.use("/", indexRouter);

constants/error.constant.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,24 @@ const SPONSOR_ID_409_MESSAGE = "Conflict with sponsor accountId link";
1111
const VOLUNTEER_ID_409_MESSAGE = "Conflict with volunteer accountId link";
1212
const HACKER_ID_409_MESSAGE = "Conflict with hacker accountId link";
1313
const TEAM_MEMBER_409_MESSAGE = "Conflict with team member being in another team";
14+
const TEAM_NAME_409_MESSAGE = "Conflict with team name already in use";
1415
const HACKER_STATUS_409_MESSAGE = "Conflict with hacker status";
16+
const TEAM_SIZE_409_MESSAGE = "Team full";
17+
const TEAM_JOIN_SAME_409_MESSAGE = "Hacker is already on receiving team";
1518

1619
const TEAM_MEMBER_422_MESSAGE = "Duplicate team member in input";
1720
const VALIDATION_422_MESSAGE = "Validation failed";
1821
const ACCOUNT_DUPLICATE_422_MESSAGE = "Account already exists";
22+
const ROLE_DUPLICATE_422_MESSAGE = "Role already exists";
1923

2024
const ACCOUNT_TOKEN_401_MESSAGE = "Invalid token for account";
2125
const AUTH_401_MESSAGE = "Invalid Authentication";
2226

2327
const AUTH_403_MESSAGE = "Invalid Authorization";
2428
const ACCOUNT_403_MESSAGE = "Account not verified";
2529

30+
const TEAM_READ_500_MESSAGE = "Error while retrieving team";
31+
const TEAM_UPDATE_500_MESSAGE = "Error while updating team";
2632
const HACKER_UPDATE_500_MESSAGE = "Error while updating hacker";
2733
const ACCOUNT_UPDATE_500_MESSAGE = "Error while updating account";
2834
const HACKER_CREATE_500_MESSAGE = "Error while creating hacker";
@@ -32,6 +38,7 @@ const VOLUNTEER_CREATE_500_MESSAGE = "Error while creating volunteer";
3238
const EMAIL_500_MESSAGE = "Error while generating email";
3339
const GENERIC_500_MESSAGE = "Internal error";
3440
const LOGIN_500_MESSAGE = "Error while logging in";
41+
const ROLE_CREATE_500_MESSAGE = "Error while creating role";
3542

3643
module.exports = {
3744
ACCOUNT_404_MESSAGE: ACCOUNT_404_MESSAGE,
@@ -48,6 +55,7 @@ module.exports = {
4855
AUTH_401_MESSAGE: AUTH_401_MESSAGE,
4956
AUTH_403_MESSAGE: AUTH_403_MESSAGE,
5057
ACCOUNT_403_MESSAGE: ACCOUNT_403_MESSAGE,
58+
TEAM_UPDATE_500_MESSAGE: TEAM_UPDATE_500_MESSAGE,
5159
HACKER_UPDATE_500_MESSAGE: HACKER_UPDATE_500_MESSAGE,
5260
HACKER_ID_409_MESSAGE: HACKER_ID_409_MESSAGE,
5361
ACCOUNT_UPDATE_500_MESSAGE: ACCOUNT_UPDATE_500_MESSAGE,
@@ -61,4 +69,10 @@ module.exports = {
6169
ACCOUNT_DUPLICATE_422_MESSAGE: ACCOUNT_DUPLICATE_422_MESSAGE,
6270
LOGIN_500_MESSAGE: LOGIN_500_MESSAGE,
6371
HACKER_STATUS_409_MESSAGE: HACKER_STATUS_409_MESSAGE,
72+
TEAM_SIZE_409_MESSAGE: TEAM_SIZE_409_MESSAGE,
73+
ROLE_DUPLICATE_422_MESSAGE: ROLE_DUPLICATE_422_MESSAGE,
74+
ROLE_CREATE_500_MESSAGE: ROLE_CREATE_500_MESSAGE,
75+
TEAM_NAME_409_MESSAGE: TEAM_NAME_409_MESSAGE,
76+
TEAM_JOIN_SAME_409_MESSAGE: TEAM_JOIN_SAME_409_MESSAGE,
77+
TEAM_READ_500_MESSAGE: TEAM_READ_500_MESSAGE,
6478
};

constants/general.constant.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ const HACKATHON_NAME = "McHacks";
55
// constants kept in alphabetical order
66
// matches optional http://, https://, http:, https:, and optional www., and then matches for devpost.com and further parameters
77
const DEVPOST_REGEX = /^(http(s)?:(\/\/)?)?(www\.)?(([-a-zA-Z0-9@:%._\+~#=]{2,256}\.)?devpost\.com)\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)$/;
8-
const EMAIL_REGEX = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
8+
// from https://emailregex.com
9+
const EMAIL_REGEX = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
910
const HACKER_STATUS_NONE = "None";
1011
const HACKER_STATUS_APPLIED = "Applied";
1112
const HACKER_STATUS_ACCEPTED = "Accepted";
@@ -63,6 +64,9 @@ const EXTENDED_USER_TYPES = [HACKER, VOLUNTEER, STAFF, SPONSOR_T1, SPONSOR_T2, S
6364
// matches optional http://, https://, http:, https:, and optional www.
6465
// matches the domain, and then optional route, path, query parameters
6566
const URL_REGEX = /^(http(s)?:(\/\/)?)?(www\.)?([-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6})\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)$/;
67+
const ANY_REGEX = /^.+$/;
68+
69+
const MAX_TEAM_SIZE = 4;
6670

6771
const EMAIL_SUBJECTS = {};
6872
EMAIL_SUBJECTS[HACKER_STATUS_NONE] = `Application for ${HACKATHON_NAME} incomplete`;
@@ -87,6 +91,7 @@ module.exports = {
8791
HACKATHON_NAME: HACKATHON_NAME,
8892
DEVPOST_REGEX: DEVPOST_REGEX,
8993
EMAIL_REGEX: EMAIL_REGEX,
94+
ANY_REGEX: ANY_REGEX,
9095
HACKER_STATUS_NONE: HACKER_STATUS_NONE,
9196
HACKER_STATUS_APPLIED: HACKER_STATUS_APPLIED,
9297
HACKER_STATUS_ACCEPTED: HACKER_STATUS_ACCEPTED,
@@ -117,5 +122,6 @@ module.exports = {
117122
ROLE_CATEGORIES: ROLE_CATEGORIES,
118123
POST_ROLES: POST_ROLES,
119124
CACHE_TIMEOUT_STATS: CACHE_TIMEOUT_STATS,
120-
CACHE_KEY_STATS: CACHE_KEY_STATS
125+
CACHE_KEY_STATS: CACHE_KEY_STATS,
126+
MAX_TEAM_SIZE: MAX_TEAM_SIZE
121127
};

constants/role.constant.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ const hackerRole = {
3939
Constants.Routes.hackerRoutes.patchSelfById,
4040
Constants.Routes.hackerRoutes.patchSelfConfirmationById,
4141
Constants.Routes.hackerRoutes.getSelf,
42+
43+
Constants.Routes.teamRoutes.join,
44+
Constants.Routes.teamRoutes.patchSelfById,
45+
Constants.Routes.teamRoutes.post,
46+
Constants.Routes.teamRoutes.get,
47+
Constants.Routes.teamRoutes.leave
4248
]
4349
};
4450

@@ -50,6 +56,8 @@ const volunteerRole = {
5056

5157
Constants.Routes.hackerRoutes.patchAnyCheckInById,
5258
Constants.Routes.hackerRoutes.patchSelfCheckInById,
59+
60+
Constants.Routes.teamRoutes.get
5361
]
5462
};
5563

constants/routes.constant.js

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ const authRoutes = {
1010
requestType: Constants.REQUEST_TYPES.POST,
1111
uri: "/api/auth/logout"
1212
},
13-
"invite": {
14-
requestType: Constants.REQUEST_TYPES.POST,
15-
uri: "/api/auth/invite"
16-
},
1713
"getSelfRoleBindindings": {
1814
requestType: Constants.REQUEST_TYPES.GET,
1915
uri: "/api/auth/rolebindings/" + Constants.ROLE_CATEGORIES.SELF
@@ -62,7 +58,7 @@ const accountRoutes = {
6258
const hackerRoutes = {
6359
"getSelf": {
6460
requestType: Constants.REQUEST_TYPES.GET,
65-
uri: "/api/hacker/self/"
61+
uri: "/api/hacker/self/",
6662
},
6763
"getSelfById": {
6864
requestType: Constants.REQUEST_TYPES.GET,
@@ -138,18 +134,30 @@ const sponsorRoutes = {
138134
};
139135

140136
const teamRoutes = {
141-
"getSelfById": {
142-
requestType: Constants.REQUEST_TYPES.GET,
143-
uri: "/api/team/" + Constants.ROLE_CATEGORIES.SELF,
144-
},
145-
"getAnyById": {
137+
"get": {
146138
requestType: Constants.REQUEST_TYPES.GET,
147139
uri: "/api/team/" + Constants.ROLE_CATEGORIES.ALL,
148140
},
149141
"post": {
150142
requestType: Constants.REQUEST_TYPES.POST,
151143
uri: "/api/team/",
152144
},
145+
"join": {
146+
requestType: Constants.REQUEST_TYPES.PATCH,
147+
uri: "/api/team/join/",
148+
},
149+
"patchSelfById": {
150+
requestType: Constants.REQUEST_TYPES.PATCH,
151+
uri: "/api/team/" + Constants.ROLE_CATEGORIES.SELF
152+
},
153+
"patchAnyById": {
154+
requestType: Constants.REQUEST_TYPES.PATCH,
155+
uri: "/api/team/" + Constants.ROLE_CATEGORIES.ALL
156+
},
157+
"leave": {
158+
requestType: Constants.REQUEST_TYPES.PATCH,
159+
uri: "/api/team/leave/",
160+
},
153161
};
154162

155163
const volunteerRoutes = {
@@ -159,6 +167,13 @@ const volunteerRoutes = {
159167
},
160168
};
161169

170+
const roleRoutes = {
171+
"post": {
172+
requestType: Constants.REQUEST_TYPES.POST,
173+
uri: "/api/role/",
174+
}
175+
};
176+
162177
const searchRoutes = {
163178
"get": {
164179
requestType: Constants.REQUEST_TYPES.GET,
@@ -170,7 +185,16 @@ const staffRoutes = {
170185
"hackerStats": {
171186
requestType: Constants.REQUEST_TYPES.GET,
172187
uri: "/api/hacker/stats",
173-
}
188+
},
189+
"postInvite": {
190+
requestType: Constants.REQUEST_TYPES.POST,
191+
uri: "/api/account/invite"
192+
},
193+
"getInvite": {
194+
requestType: Constants.REQUEST_TYPES.GET,
195+
uri: "/api/account/invite"
196+
},
197+
174198
}
175199

176200
const allRoutes = {
@@ -180,6 +204,7 @@ const allRoutes = {
180204
"Sponsor": sponsorRoutes,
181205
"Team": teamRoutes,
182206
"Volunteer": volunteerRoutes,
207+
"Role": roleRoutes,
183208
"Search": searchRoutes,
184209
"Staff": staffRoutes,
185210
};
@@ -217,6 +242,7 @@ module.exports = {
217242
sponsorRoutes: sponsorRoutes,
218243
teamRoutes: teamRoutes,
219244
volunteerRoutes: volunteerRoutes,
245+
roleRoutes: roleRoutes,
220246
searchRoutes: searchRoutes,
221247
staffRoutes: staffRoutes,
222248
allRoutes: allRoutes,

constants/success.constant.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22

33
const ACCOUNT_GET_BY_EMAIL = "Account found by user email.";
44
const ACCOUNT_GET_BY_ID = "Account found by user id.";
5+
const ACCOUNT_READ = "Account retrieval successful.";
56
const ACCOUNT_CREATE = "Account creation successful.";
67
const ACCOUNT_UPDATE = "Account update successful.";
78
const ACCOUNT_INVITE = "Account invitation successful.";
9+
const ACCOUNT_GET_INVITES = "Invite retrieval successful.";
810

911
const AUTH_LOGIN = "Login successful.";
1012
const AUTH_LOGOUT = "Logout successful.";
@@ -23,15 +25,21 @@ const HACKER_UPDATE = "Hacker update successful.";
2325
const RESUME_UPLOAD = "Resume upload successful.";
2426
const RESUME_DOWNLOAD = "Resume download successful.";
2527

28+
const ROLE_CREATE = "Role creation successful.";
29+
2630
const SEARCH_QUERY = "Query search successful. Returning results.";
2731
const SEARCH_NO_RESULTS = "Query search successful. No results found.";
2832

29-
3033
const SPONSOR_GET_BY_ID = "Sponsor found by id.";
34+
const SPONSOR_READ = "Sponsor retrieval successful.";
3135
const SPONSOR_CREATE = "Sponsor creation successful.";
3236

3337
const TEAM_GET_BY_ID = "Team found by id.";
3438
const TEAM_CREATE = "Team creation successful.";
39+
const TEAM_JOIN = "Team join successful.";
40+
const TEAM_UPDATE = "Team update successful.";
41+
const TEAM_READ = "Team retrieval successful.";
42+
const TEAM_HACKER_LEAVE = "Removal from team successful.";
3543

3644
const VOLUNTEER_CREATE = "Volunteer creation successful.";
3745

@@ -41,7 +49,8 @@ module.exports = {
4149
ACCOUNT_CREATE: ACCOUNT_CREATE,
4250
ACCOUNT_UPDATE: ACCOUNT_UPDATE,
4351
ACCOUNT_INVITE: ACCOUNT_INVITE,
44-
52+
ACCOUNT_GET_INVITES: ACCOUNT_GET_INVITES,
53+
ACCOUNT_READ: ACCOUNT_READ,
4554
AUTH_LOGIN: AUTH_LOGIN,
4655
AUTH_LOGOUT: AUTH_LOGOUT,
4756
AUTH_SEND_RESET_EMAIL: AUTH_SEND_RESET_EMAIL,
@@ -59,14 +68,21 @@ module.exports = {
5968
RESUME_UPLOAD: RESUME_UPLOAD,
6069
RESUME_DOWNLOAD: RESUME_DOWNLOAD,
6170

71+
ROLE_CREATE: ROLE_CREATE,
72+
6273
SEARCH_QUERY: SEARCH_QUERY,
6374
SEARCH_NO_RESULTS: SEARCH_NO_RESULTS,
6475

6576
SPONSOR_GET_BY_ID: SPONSOR_GET_BY_ID,
6677
SPONSOR_CREATE: SPONSOR_CREATE,
78+
SPONSOR_READ: SPONSOR_READ,
6779

6880
TEAM_GET_BY_ID: TEAM_GET_BY_ID,
6981
TEAM_CREATE: TEAM_CREATE,
82+
TEAM_JOIN: TEAM_JOIN,
83+
TEAM_UPDATE: TEAM_UPDATE,
84+
TEAM_READ: TEAM_READ,
85+
TEAM_HACKER_LEAVE: TEAM_HACKER_LEAVE,
7086

7187
VOLUNTEER_CREATE: VOLUNTEER_CREATE,
7288
};

constants/testMongoId.constant.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
"use strict";
2+
3+
const mongoose = require("mongoose");
4+
5+
const team1Id = mongoose.Types.ObjectId();
6+
const team2Id = mongoose.Types.ObjectId();
7+
const team3Id = mongoose.Types.ObjectId();
8+
9+
const hackerAId = mongoose.Types.ObjectId();
10+
const hackerBId = mongoose.Types.ObjectId();
11+
const hackerCId = mongoose.Types.ObjectId();
12+
const hackerDId = mongoose.Types.ObjectId();
13+
const hackerEId = mongoose.Types.ObjectId();
14+
const hackerFId = mongoose.Types.ObjectId();
15+
const hackerGId = mongoose.Types.ObjectId();
16+
17+
18+
module.exports = {
19+
team1Id: team1Id,
20+
team2Id: team2Id,
21+
team3Id: team3Id,
22+
hackerAId: hackerAId,
23+
hackerBId: hackerBId,
24+
hackerCId: hackerCId,
25+
hackerDId: hackerDId,
26+
hackerEId: hackerEId,
27+
hackerFId: hackerFId,
28+
hackerGId: hackerGId,
29+
};

0 commit comments

Comments
 (0)