Skip to content

Commit 0bf702b

Browse files
authored
Feature/ticket email (#313)
* WIP * Finish route * Add docs * Add tests * Switch to member who has confirmed * Fix test * Remove line * Change URL of QR code
1 parent 0bd5865 commit 0bf702b

File tree

17 files changed

+554
-23
lines changed

17 files changed

+554
-23
lines changed

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
"this":false,
66
"bad_property":false
77
},
8-
"search.usePCRE2": true
8+
"search.usePCRE2": true,
9+
"editor.formatOnSave": true
910
}

assets/email/Ticket.hbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<div>{{firstName}}<img src="{{ticket}}"></img></div>

constants/general.constant.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ const ANY_REGEX = /^.+$/;
8989

9090
const MAX_TEAM_SIZE = 4;
9191

92+
const WEEK_OF = 'Week Of';
93+
9294
const EMAIL_SUBJECTS = {};
9395
EMAIL_SUBJECTS[HACKER_STATUS_NONE] = `Application for ${HACKATHON_NAME} incomplete`;
9496
EMAIL_SUBJECTS[HACKER_STATUS_APPLIED] = `Thanks for applying to ${HACKATHON_NAME}`;
@@ -98,6 +100,8 @@ EMAIL_SUBJECTS[HACKER_STATUS_CONFIRMED] = `Thanks for confirming your attendance
98100
EMAIL_SUBJECTS[HACKER_STATUS_CANCELLED] = "Sorry to see you go";
99101
EMAIL_SUBJECTS[HACKER_STATUS_CHECKED_IN] = `Welcome to ${HACKATHON_NAME}`;
100102

103+
EMAIL_SUBJECTS[WEEK_OF] = `Welcome to ${HACKATHON_NAME}`;
104+
101105
const CONFIRM_ACC_EMAIL_SUBJECT = `Please complete your hacker application for ${HACKATHON_NAME}`;
102106
const CREATE_ACC_EMAIL_SUBJECTS = {};
103107
CREATE_ACC_EMAIL_SUBJECTS[HACKER] = `You've been invited to create a hacker account for ${HACKATHON_NAME}`;
@@ -145,5 +149,6 @@ module.exports = {
145149
CACHE_TIMEOUT_STATS: CACHE_TIMEOUT_STATS,
146150
CACHE_KEY_STATS: CACHE_KEY_STATS,
147151
MAX_TEAM_SIZE: MAX_TEAM_SIZE,
152+
WEEK_OF: WEEK_OF,
148153
SAMPLE_DIET_RESTRICTIONS: SAMPLE_DIET_RESTRICTIONS,
149154
};

constants/routes.constant.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,14 @@ const hackerRoutes = {
124124
requestType: Constants.REQUEST_TYPES.PATCH,
125125
uri: "/api/hacker/confirmation/" + Constants.ROLE_CATEGORIES.SELF,
126126
},
127+
"postAnySendWeekOfEmail": {
128+
requestType: Constants.REQUEST_TYPES.POST,
129+
uri: "/api/hacker/email/weekOf/" + Constants.ROLE_CATEGORIES.ALL,
130+
},
131+
"postSelfSendWeekOfEmail": {
132+
requestType: Constants.REQUEST_TYPES.POST,
133+
uri: "/api/hacker/email/weekOf/" + Constants.ROLE_CATEGORIES.SELF,
134+
},
127135
};
128136

129137
const sponsorRoutes = {

constants/success.constant.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const HACKER_GET_BY_ID = "Hacker found by id.";
2121
const HACKER_READ = "Hacker retrieval successful.";
2222
const HACKER_CREATE = "Hacker creation successful.";
2323
const HACKER_UPDATE = "Hacker update successful.";
24+
const HACKER_SENT_WEEK_OF = "Hacker week-of email sent."
2425

2526
const RESUME_UPLOAD = "Resume upload successful.";
2627
const RESUME_DOWNLOAD = "Resume download successful.";
@@ -67,6 +68,8 @@ module.exports = {
6768
HACKER_CREATE: HACKER_CREATE,
6869
HACKER_UPDATE: HACKER_UPDATE,
6970

71+
HACKER_SENT_WEEK_OF: HACKER_SENT_WEEK_OF,
72+
7073
RESUME_UPLOAD: RESUME_UPLOAD,
7174
RESUME_DOWNLOAD: RESUME_DOWNLOAD,
7275

controllers/hacker.controller.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,19 @@ function gotStats(req, res) {
7979

8080
}
8181

82+
function sentWeekOfEmail(req, res) {
83+
return res.status(200).json({
84+
message: Constants.Success.HACKER_SENT_WEEK_OF,
85+
data: {}
86+
});
87+
}
88+
8289
module.exports = {
8390
updatedHacker: updatedHacker,
8491
createdHacker: createdHacker,
8592
uploadedResume: uploadedResume,
8693
downloadedResume: downloadedResume,
8794
showHacker: showHacker,
8895
gotStats: gotStats,
96+
sentWeekOfEmail: sentWeekOfEmail,
8997
};

docs/api/api_data.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1869,6 +1869,58 @@ define({
18691869
"url": "https://api.mchacks.ca/api/hacker/resume/:id"
18701870
}]
18711871
},
1872+
{
1873+
"type": "post",
1874+
"url": "/hacker/email/weekOf/:id",
1875+
"title": "",
1876+
"description": "<p>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.</p>",
1877+
"name": "postHackerSendWeekOfEmail",
1878+
"group": "Hacker",
1879+
"version": "0.0.9",
1880+
"parameter": {
1881+
"fields": {
1882+
"param": [{
1883+
"group": "param",
1884+
"type": "string",
1885+
"optional": true,
1886+
"field": "status",
1887+
"description": "<p>The hacker ID</p>"
1888+
}]
1889+
}
1890+
},
1891+
"success": {
1892+
"fields": {
1893+
"Success 200": [{
1894+
"group": "Success 200",
1895+
"type": "string",
1896+
"optional": false,
1897+
"field": "message",
1898+
"description": "<p>Success message</p>"
1899+
},
1900+
{
1901+
"group": "Success 200",
1902+
"type": "object",
1903+
"optional": false,
1904+
"field": "data",
1905+
"description": "<p>empty</p>"
1906+
}
1907+
]
1908+
},
1909+
"examples": [{
1910+
"title": "Success-Response: ",
1911+
"content": "{\n \"message\": \"Hacker week-of email sent.\", \n \"data\": {}\n}",
1912+
"type": "object"
1913+
}]
1914+
},
1915+
"permission": [{
1916+
"name": "Administrator"
1917+
}],
1918+
"filename": "routes/api/hacker.js",
1919+
"groupTitle": "Hacker",
1920+
"sampleRequest": [{
1921+
"url": "https://api.mchacks.ca/api/hacker/email/weekOf/:id"
1922+
}]
1923+
},
18721924
{
18731925
"type": "get",
18741926
"url": "/sponsor/self",

docs/api/api_data.json

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1868,6 +1868,58 @@
18681868
"url": "https://api.mchacks.ca/api/hacker/resume/:id"
18691869
}]
18701870
},
1871+
{
1872+
"type": "post",
1873+
"url": "/hacker/email/weekOf/:id",
1874+
"title": "",
1875+
"description": "<p>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.</p>",
1876+
"name": "postHackerSendWeekOfEmail",
1877+
"group": "Hacker",
1878+
"version": "0.0.9",
1879+
"parameter": {
1880+
"fields": {
1881+
"param": [{
1882+
"group": "param",
1883+
"type": "string",
1884+
"optional": true,
1885+
"field": "status",
1886+
"description": "<p>The hacker ID</p>"
1887+
}]
1888+
}
1889+
},
1890+
"success": {
1891+
"fields": {
1892+
"Success 200": [{
1893+
"group": "Success 200",
1894+
"type": "string",
1895+
"optional": false,
1896+
"field": "message",
1897+
"description": "<p>Success message</p>"
1898+
},
1899+
{
1900+
"group": "Success 200",
1901+
"type": "object",
1902+
"optional": false,
1903+
"field": "data",
1904+
"description": "<p>empty</p>"
1905+
}
1906+
]
1907+
},
1908+
"examples": [{
1909+
"title": "Success-Response: ",
1910+
"content": "{\n \"message\": \"Hacker week-of email sent.\", \n \"data\": {}\n}",
1911+
"type": "object"
1912+
}]
1913+
},
1914+
"permission": [{
1915+
"name": "Administrator"
1916+
}],
1917+
"filename": "routes/api/hacker.js",
1918+
"groupTitle": "Hacker",
1919+
"sampleRequest": [{
1920+
"url": "https://api.mchacks.ca/api/hacker/email/weekOf/:id"
1921+
}]
1922+
},
18711923
{
18721924
"type": "get",
18731925
"url": "/sponsor/self",

docs/api/api_project.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ define({
99
"apidoc": "0.3.0",
1010
"generator": {
1111
"name": "apidoc",
12-
"time": "2019-01-21T04:13:36.482Z",
12+
"time": "2019-01-23T23:37:14.991Z",
1313
"url": "http://apidocjs.com",
1414
"version": "0.17.7"
1515
}

docs/api/api_project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"apidoc": "0.3.0",
1010
"generator": {
1111
"name": "apidoc",
12-
"time": "2019-01-21T04:13:36.482Z",
12+
"time": "2019-01-23T23:37:14.991Z",
1313
"url": "http://apidocjs.com",
1414
"version": "0.17.7"
1515
}

0 commit comments

Comments
 (0)