Skip to content

Commit 75fa577

Browse files
authored
Merge pull request #305 from hackmcgill/develop
Updates for Sponsorship, get hacker by Email, update Test Suite
2 parents 5a59a9a + 7726134 commit 75fa577

Some content is hidden

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

42 files changed

+2005
-888
lines changed

VERSION

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

assets/email/statusEmail/Accepted.hbs

Lines changed: 72 additions & 68 deletions
Large diffs are not rendered by default.

constants/error.constant.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const HACKER_UPDATE_500_MESSAGE = "Error while updating hacker";
3434
const ACCOUNT_UPDATE_500_MESSAGE = "Error while updating account";
3535
const HACKER_CREATE_500_MESSAGE = "Error while creating hacker";
3636
const SPONSOR_CREATE_500_MESSAGE = "Error while creating sponsor";
37+
const SPONSOR_UPDATE_500_MESSAGE = "Error while updating sponsor";
3738
const TEAM_CREATE_500_MESSAGE = "Error while creating team";
3839
const VOLUNTEER_CREATE_500_MESSAGE = "Error while creating volunteer";
3940
const EMAIL_500_MESSAGE = "Error while generating email";
@@ -77,4 +78,5 @@ module.exports = {
7778
TEAM_JOIN_SAME_409_MESSAGE: TEAM_JOIN_SAME_409_MESSAGE,
7879
TEAM_READ_500_MESSAGE: TEAM_READ_500_MESSAGE,
7980
VOLUNTEER_404_MESSAGE: VOLUNTEER_404_MESSAGE,
81+
SPONSOR_UPDATE_500_MESSAGE: SPONSOR_UPDATE_500_MESSAGE,
8082
};

constants/general.constant.js

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,23 @@ const HACKER_STATUSES = [
2424
HACKER_STATUS_CHECKED_IN
2525
];
2626

27+
const SAMPLE_DIET_RESTRICTIONS = [
28+
"None",
29+
"Vegan",
30+
"Vegetarian",
31+
"Keto",
32+
"Gluten free",
33+
"Pescetarian",
34+
"Peanut allergy",
35+
"Milk allergy",
36+
"Egg allergy",
37+
"Allergy",
38+
"No beef",
39+
"No porc",
40+
"No fish",
41+
"No shellfish"
42+
];
43+
2744
const HACKER = "Hacker";
2845
const VOLUNTEER = "Volunteer";
2946
const STAFF = "Staff";
@@ -52,7 +69,11 @@ const REQUEST_TYPES = {
5269
//Define names of the roles specifically associated with permission to create an account
5370
const POST_ROLES = {};
5471
POST_ROLES[HACKER] = "postHacker";
55-
POST_ROLES[SPONSOR] = "postSponsor";
72+
POST_ROLES[SPONSOR_T1] = "postSponsor";
73+
POST_ROLES[SPONSOR_T2] = "postSponsor";
74+
POST_ROLES[SPONSOR_T3] = "postSponsor";
75+
POST_ROLES[SPONSOR_T4] = "postSponsor";
76+
POST_ROLES[SPONSOR_T5] = "postSponsor";
5677
POST_ROLES[VOLUNTEER] = "postVolunteer";
5778
POST_ROLES[STAFF] = "postStaff";
5879

@@ -123,5 +144,6 @@ module.exports = {
123144
POST_ROLES: POST_ROLES,
124145
CACHE_TIMEOUT_STATS: CACHE_TIMEOUT_STATS,
125146
CACHE_KEY_STATS: CACHE_KEY_STATS,
126-
MAX_TEAM_SIZE: MAX_TEAM_SIZE
147+
MAX_TEAM_SIZE: MAX_TEAM_SIZE,
148+
SAMPLE_DIET_RESTRICTIONS: SAMPLE_DIET_RESTRICTIONS,
127149
};

constants/role.constant.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ const hackerRole = {
2929
"_id": mongoose.Types.ObjectId.createFromTime(2),
3030
"name": Constants.General.HACKER,
3131
"routes": [
32-
Constants.Routes.accountRoutes.getSelf,
33-
Constants.Routes.accountRoutes.getSelfById,
34-
Constants.Routes.accountRoutes.patchSelfById,
35-
3632
Constants.Routes.hackerRoutes.post,
3733
Constants.Routes.hackerRoutes.getSelfById,
3834
Constants.Routes.hackerRoutes.getSelfByEmail,
@@ -69,6 +65,8 @@ const sponsorT1Role = {
6965
"routes": [
7066
Constants.Routes.sponsorRoutes.post,
7167
Constants.Routes.sponsorRoutes.getSelfById,
68+
Constants.Routes.sponsorRoutes.getSelf,
69+
Constants.Routes.sponsorRoutes.patchSelfById,
7270
]
7371
};
7472

@@ -78,6 +76,8 @@ const sponsorT2Role = {
7876
"routes": [
7977
Constants.Routes.sponsorRoutes.post,
8078
Constants.Routes.sponsorRoutes.getSelfById,
79+
Constants.Routes.sponsorRoutes.getSelf,
80+
Constants.Routes.sponsorRoutes.patchSelfById,
8181
]
8282
};
8383

@@ -87,6 +87,8 @@ const sponsorT3Role = {
8787
"routes": [
8888
Constants.Routes.sponsorRoutes.post,
8989
Constants.Routes.sponsorRoutes.getSelfById,
90+
Constants.Routes.sponsorRoutes.getSelf,
91+
Constants.Routes.sponsorRoutes.patchSelfById,
9092
]
9193
};
9294

@@ -96,6 +98,8 @@ const sponsorT4Role = {
9698
"routes": [
9799
Constants.Routes.sponsorRoutes.post,
98100
Constants.Routes.sponsorRoutes.getSelfById,
101+
Constants.Routes.sponsorRoutes.getSelf,
102+
Constants.Routes.sponsorRoutes.patchSelfById,
99103
]
100104
};
101105

@@ -105,6 +109,8 @@ const sponsorT5Role = {
105109
"routes": [
106110
Constants.Routes.sponsorRoutes.post,
107111
Constants.Routes.sponsorRoutes.getSelfById,
112+
Constants.Routes.sponsorRoutes.getSelf,
113+
Constants.Routes.sponsorRoutes.patchSelfById,
108114
]
109115
};
110116

constants/routes.constant.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ const hackerRoutes = {
127127
};
128128

129129
const sponsorRoutes = {
130+
"getSelf": {
131+
requestType: Constants.REQUEST_TYPES.GET,
132+
uri: "/api/sponsor/self/",
133+
},
130134
"getSelfById": {
131135
requestType: Constants.REQUEST_TYPES.GET,
132136
uri: "/api/sponsor/" + Constants.ROLE_CATEGORIES.SELF,
@@ -139,6 +143,14 @@ const sponsorRoutes = {
139143
requestType: Constants.REQUEST_TYPES.POST,
140144
uri: "/api/sponsor/",
141145
},
146+
"patchSelfById": {
147+
requestType: Constants.REQUEST_TYPES.PATCH,
148+
uri: "/api/sponsor/" + Constants.ROLE_CATEGORIES.SELF,
149+
},
150+
"patchAnyById": {
151+
requestType: Constants.REQUEST_TYPES.PATCH,
152+
uri: "/api/sponsor/" + Constants.ROLE_CATEGORIES.ALL,
153+
}
142154
};
143155

144156
const teamRoutes = {

constants/success.constant.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const SEARCH_NO_RESULTS = "Query search successful. No results found.";
3333
const SPONSOR_GET_BY_ID = "Sponsor found by id.";
3434
const SPONSOR_READ = "Sponsor retrieval successful.";
3535
const SPONSOR_CREATE = "Sponsor creation successful.";
36+
const SPONSOR_UPDATE = "Sponsor update successful.";
3637

3738
const TEAM_GET_BY_ID = "Team found by id.";
3839
const TEAM_CREATE = "Team creation successful.";
@@ -77,6 +78,7 @@ module.exports = {
7778
SPONSOR_GET_BY_ID: SPONSOR_GET_BY_ID,
7879
SPONSOR_CREATE: SPONSOR_CREATE,
7980
SPONSOR_READ: SPONSOR_READ,
81+
SPONSOR_UPDATE: SPONSOR_UPDATE,
8082

8183
TEAM_GET_BY_ID: TEAM_GET_BY_ID,
8284
TEAM_CREATE: TEAM_CREATE,

controllers/sponsor.controller.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,35 @@ function showSponsor(req, res) {
2424
}
2525

2626
/**
27-
* @function createdHacker
27+
* @function createdSponsor
2828
* @param {{body: {sponsor: {_id: ObjectId, accountId: ObjectId, tier: number, company: string, contractURL: string, nominees: ObjectId[]}}}} req
2929
* @param {*} res
3030
* @return {JSON} Success status
3131
* @description returns success message
3232
*/
33-
async function createdSponsor(req, res) {
33+
function createdSponsor(req, res) {
3434
return res.status(200).json({
3535
message: Constants.Success.SPONSOR_CREATE,
3636
data: req.body.sponsor.toJSON()
3737
});
3838
}
3939

40+
/**
41+
* @function updatedSponsor
42+
* @param {{body: {sponsor: {_id: ObjectId, accountId: ObjectId, tier: number, company: string, contractURL: string, nominees: ObjectId[]}}}} req
43+
* @param {*} res
44+
* @return {JSON} Success status
45+
* @description returns success message
46+
*/
47+
function updatedSponsor(req, res) {
48+
return res.status(200).json({
49+
message: Constants.Success.SPONSOR_UPDATE,
50+
data: req.body.sponsor.toJSON()
51+
});
52+
}
53+
4054
module.exports = {
4155
createdSponsor: createdSponsor,
4256
showSponsor: showSponsor,
57+
updatedSponsor: updatedSponsor,
4358
};

0 commit comments

Comments
 (0)