diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index a31bc3a3..f73728b4 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add email blast marketing email - Add 3 days left marketing email +- Add check to ensure application creation deadline has not passed yet ### Fixed diff --git a/constants/general.constant.js b/constants/general.constant.js index ab21eb18..52c7b56c 100644 --- a/constants/general.constant.js +++ b/constants/general.constant.js @@ -25,6 +25,8 @@ const HACKER_STATUSES = [ HACKER_STATUS_CHECKED_IN, HACKER_STATUS_DECLINED ]; +// This date is Jan 3, 2020 11:59:59PM EST +const APPLICATION_CLOSE_TIME = 1578070799000; const SAMPLE_DIET_RESTRICTIONS = [ "None", @@ -111,9 +113,7 @@ const MAX_TEAM_SIZE = 4; const WEEK_OF = "Week Of"; const EMAIL_SUBJECTS = {}; -EMAIL_SUBJECTS[ - HACKER_STATUS_NONE -] = `Get started on your application!`; +EMAIL_SUBJECTS[HACKER_STATUS_NONE] = `Get started on your application!`; EMAIL_SUBJECTS[ HACKER_STATUS_APPLIED ] = `Thanks for applying to ${HACKATHON_NAME}!`; @@ -160,6 +160,7 @@ module.exports = { HACKER_STATUS_WITHDRAWN: HACKER_STATUS_WITHDRAWN, HACKER_STATUS_CHECKED_IN: HACKER_STATUS_CHECKED_IN, HACKER_STATUSES: HACKER_STATUSES, + APPLICATION_CLOSE_TIME: APPLICATION_CLOSE_TIME, REQUEST_TYPES: REQUEST_TYPES, JOB_INTERESTS: JOB_INTERESTS, SHIRT_SIZES: SHIRT_SIZES, diff --git a/services/hacker.service.js b/services/hacker.service.js index 8e0ea501..8cc7f262 100644 --- a/services/hacker.service.js +++ b/services/hacker.service.js @@ -17,9 +17,13 @@ const QRCode = require("qrcode"); function createHacker(hackerDetails) { const TAG = `[Hacker Service # createHacker]:`; - const hacker = new Hacker(hackerDetails); + let hacker; - return hacker.save(); + if (Date.now() < Constants.APPLICATION_CLOSE_TIME) { + hacker = new Hacker(hackerDetails); + return hacker.save(); + } + throw new Error("Sorry, the application deadline has passed!"); } /**