-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from sinhadotabhinav/issue-#1
closing Issue #1 per this pul request
- Loading branch information
Showing
14 changed files
with
274 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,7 +63,7 @@ const SERVICE_PROVIDER = 'Gmail'; | |
const RECIPIENT = '[email protected],[email protected],[email protected]'; | ||
``` | ||
|
||
Finally, you can also alter the date range with which the application will fetch vaccination slots by customising **DATE_RANGE** value in [`src/configs/schedulerConfig.js`](https://github.com/sinhadotabhinav/covid-19-vaccine-alerts-cowin/blob/master/src/configs/schedulerConfig.js) file. By default it is set to **10** but, you can change it to 7 or 15 for example, based on your need. The config file also allows changes in the periodic schedule with which the application runs. By default, **SCHEDULE** value depicts a cron schedule **every 3 hours at minute 0**. To alter this schedule, you need to be familiar with the [cron scheduler](https://linuxhint.com/cron_jobs_complete_beginners_tutorial/#:~:text=The%20scheduled%20commands%20and%20scripts,Task%20Scheduler%20in%20Windows%20OS). I use [Crontab Guru](https://crontab.guru) website to test my cron schedules. | ||
Finally, you can also alter the date range with which the application will fetch vaccination slots by customising **DATE_RANGE** value in [`src/configs/schedulerConfig.js`](https://github.com/sinhadotabhinav/covid-19-vaccine-alerts-cowin/blob/master/src/configs/schedulerConfig.js) file. By default it is set to **7** but, you can change it to 10 or 15 for example, based on your need. The config file also allows changes in the periodic schedule with which the application runs. By default, **SCHEDULE** value depicts a cron schedule **every 2 hours at minute 0**. To alter this schedule, you need to be familiar with the [cron scheduler](https://linuxhint.com/cron_jobs_complete_beginners_tutorial/#:~:text=The%20scheduled%20commands%20and%20scripts,Task%20Scheduler%20in%20Windows%20OS). I use [Crontab Guru](https://crontab.guru) website to test my cron schedules. | ||
|
||
``` | ||
const SCHEDULE = '0 */3 * * *'; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,12 @@ const SERVICE_PROVIDER = 'Gmail'; | |
const RECIPIENT = '[email protected]'; | ||
const SENDER = 'covid-19-vaccine-alerts-cowin'; | ||
const SUBJECT = 'New vaccination slots are available on COWIN. Book appointment now'; | ||
const BODY = 'There are now new COVID-19 vaccination slots available in your requested location(s) in the next 10 days'; | ||
const DAILY_DIGEST_SUBJECT = 'Daily digest: covid-19-vaccine-alerts-cowin'; | ||
const FIRST_EMAIL_SUBJECT = 'Welcome to covid-19-vaccine-alerts-cowin application'; | ||
const COWIN_URL = 'https://www.cowin.gov.in/home'; | ||
const MOFHW_URL = 'https://www.mohfw.gov.in/covid_vaccination/vaccination/faqs.html'; | ||
const COWIN_LOGO_URL = 'https://github.com/sinhadotabhinav/covid-19-vaccine-alerts-cowin/blob/master/src/assets/cowin-logo.png?raw=true'; | ||
const WHO_VACCINE_LOGO_URL = 'https://github.com/sinhadotabhinav/covid-19-vaccine-alerts-cowin/blob/master/src/assets/vaccine.png?raw=true'; | ||
|
||
module.exports = { SERVICE_PROVIDER, RECIPIENT, SENDER, SUBJECT, BODY }; | ||
module.exports = { SERVICE_PROVIDER, RECIPIENT, SENDER, SUBJECT, DAILY_DIGEST_SUBJECT, FIRST_EMAIL_SUBJECT, COWIN_URL, MOFHW_URL, | ||
COWIN_LOGO_URL, WHO_VACCINE_LOGO_URL }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
const SCHEDULE = '0 */3 * * *'; | ||
const DATE_RANGE = 10; | ||
const SCHEDULE = '0 */2 * * *'; | ||
const DATE_RANGE = 7; | ||
const DATE_FORMAT = 'DD-MM-YYYY'; | ||
|
||
module.exports = { SCHEDULE, DATE_RANGE, DATE_FORMAT }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const appConfig = require('../configs/appConfig'); | ||
const mailConfig = require('../configs/mailConfig'); | ||
const alerts = require('../utilities/alerts'); | ||
const htmlBuilder = require('../utilities/htmlBuilder'); | ||
const logger = require('../utilities/logger'); | ||
|
||
let runs = 0; | ||
let slots = []; | ||
|
||
async function prepareReport () { | ||
let regionType = Boolean(appConfig.FINDBYPINCODE) ? 'pincode' : 'district'; | ||
let region = regionType == 'pincode' ? appConfig.PINCODE : appConfig.DISTRICT; | ||
alerts.sendEmailAlert(mailConfig.DAILY_DIGEST_SUBJECT, | ||
await htmlBuilder.prepareDailyDigestEmail(runs, slots.length, regionType, region), (error, result) => { | ||
if(error) { | ||
console.log(logger.getLog(error)); | ||
} else { | ||
console.log(logger.getLog('Daily digest email alert has been sent to the recipient(s).')); | ||
} | ||
}); | ||
} | ||
|
||
async function updateRunCounter (runCounter, vaccinationSlots) { | ||
runs = runCounter; | ||
slots = vaccinationSlots; | ||
} | ||
|
||
module.exports = { prepareReport, updateRunCounter }; |
Oops, something went wrong.