-
Notifications
You must be signed in to change notification settings - Fork 48
Implement Automatically Reminder Service #192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: development
Are you sure you want to change the base?
Implement Automatically Reminder Service #192
Conversation
- Introduced MonthlyReminder entity and ReminderStatus enum - Implemented ReminderCronService for scheduled reminder processing - Updated Mentee entity to include reminders relationship - Enhanced init-db.sh to check for existing data before seeding - Added postgresql-client installation in Dockerfile - Updated docker-compose.yml for SMTP_PASSWORD environment variable - Added getReminderEmailContent utility function for email content generation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use an environmental variable to enable/disable this service
src/services/cron/reminder.cron.ts
Outdated
public start(): void { | ||
// Run at 1 AM every day | ||
this.cronJob = cron.schedule( | ||
'*/2 * * * *', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use an env var to configure this.
Hi @mayura-andrew is there an update on this PR? |
Yes, I have I'll open it today. |
dataSource.getRepository(Mentee), | ||
dataSource.getRepository(CheckIn) | ||
) | ||
this.cronSchedule = process.env.REMINDER_CRON_SCHEDULE ?? '0 1 * * *' // Default to 1 AM every day |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.cronSchedule = process.env.REMINDER_CRON_SCHEDULE ?? '0 1 * * *' // Default to 1 AM every day | |
this.cronSchedule = process.env.REMINDER_CRON_SCHEDULE |
if we don't have the env value let's disable the cron job
# Cron schedule for reminders (default: "0 1 * * *" - 1 AM daily) | ||
REMINDER_CRON_SCHEDULE="0 1 * * *" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Cron schedule for reminders (default: "0 1 * * *" - 1 AM daily) | |
REMINDER_CRON_SCHEDULE="0 1 * * *" | |
# Cron schedule for reminders (example: "0 1 * * *" - 1 AM daily) | |
REMINDER_CRON_SCHEDULE= |
Purpose
The purpose of this PR is to fix #176
Goals
Implemented automatically monthly reminder message using CRON
Approach
Created an separate new service to send automatically reminder with cron.
Screenshots
Checklist
Related PRs
Test environment
Learning