As we migrated the whole system to a new backend on AWS with Nest JS, we also moved the sending email cron job to the new architecture. After investigation, we decided to integrate nodemail, react-email and @nestjs/schedule as our first version to complete this feature.
This pull request includes:
An API endpoint for testing purposes: POST /email/test: I retain this endpoint because this is the first time we deploy the email cron job, and it might be helpful to debug if we face any issues after deployment.
Cron job for sending weekly digest to all users
Create a WeeklyDigestCronLog Db table to record the corn running results.
Currently, the cron schedule was set to 59 59 19 * * 6, which means it will run at 19:59:59 every Saturday. The reason why I set this value is that I want to test the timezone behavior on the AWS environment this coming Saturday.
In our system, we used GMT+0 timezone to cutoff at 23:59:59 every Tuesday. However, when I was testing on my local machine, the cron schedule followed the EST time instead of GMT+0 time. I would like to confirm if the AWS machine behaves the same way. If so, the expected schedule should be set to `59 59 19 * * 2.
TODO
[ ] Paste the testing link
[ ] Clear console.log or console.error for debug usage
[ ] Update the documentation recnet-docs if needed
Description
As we migrated the whole system to a new backend on AWS with Nest JS, we also moved the sending email cron job to the new architecture. After investigation, we decided to integrate nodemail, react-email and @nestjs/schedule as our first version to complete this feature.
This pull request includes:
POST /email/test
: I retain this endpoint because this is the first time we deploy the email cron job, and it might be helpful to debug if we face any issues after deployment.Related Issue
https://github.com/lil-lab/recnet/issues/171
Notes
Currently, the cron schedule was set to
59 59 19 * * 6
, which means it will run at 19:59:59 every Saturday. The reason why I set this value is that I want to test the timezone behavior on the AWS environment this coming Saturday. In our system, we used GMT+0 timezone to cutoff at 23:59:59 every Tuesday. However, when I was testing on my local machine, the cron schedule followed the EST time instead of GMT+0 time. I would like to confirm if the AWS machine behaves the same way. If so, the expected schedule should be set to`59 59 19 * * 2
.TODO
console.log
orconsole.error
for debug usagerecnet-docs
if needed