-
Notifications
You must be signed in to change notification settings - Fork 43
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
Implement Automatic remainder sending email service #177
Implement Automatic remainder sending email service #177
Conversation
Instead of directly passing individual fields to the updateProfile function, refactor the logic to use a single updateData object. This object contains the updated fields for the profile, such as primary_email, first_name, last_name, and image_url. This change improves code readability and maintainability. Related to sef-global#165
- Moved monthly checking service functions to a dedicated service file (monthlyChecking.service.ts). - Moved monthly checking controller functions to a dedicated controller file (monthlyChecking.controller.ts). - Updated import paths and references to reflect the new file structure. - Improved code organization and maintainability by separating concerns.
Monthly checking feature
@@ -10,7 +10,6 @@ import { | |||
capitalizeFirstLetter | |||
} from '../utils' | |||
import { sendEmail } from './admin/email.service' | |||
|
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.
Add the space here
} | ||
|
||
private async getPendingAttempts(): Promise<ReminderAttempt[]> { | ||
console.log('Fetching pending attempts') |
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.
console.log('Fetching pending attempts') |
…mpts, introduce new mentee reminders logic
this.configRepository = dataSource.getRepository(MenteeReminderConfig) | ||
this.menteeRepository = dataSource.getRepository(Mentee) | ||
this.attemptRepository = dataSource.getRepository(ReminderAttempt) | ||
console.log('EmailReminderService initialized') |
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.
console.log('EmailReminderService initialized') |
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.
I'll remove these console.logs
res: Response | ||
): Promise<void> => { | ||
try { | ||
res.status(200).json({ message: 'Reminder enabled' }) |
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.
What is the purpose of this?
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 is a API endpoint but not implemented yet. I'll implement this soon as possible :)
… for processing and scheduling reminders, and enhance reminder service logic
package.json
Outdated
"dotenv": "^16.3.1", | ||
"ejs": "^3.1.10", | ||
"express": "^4.18.2", | ||
"jsonwebtoken": "^9.0.2", | ||
"multer": "^1.4.5-lts.1", | ||
"node-cron": "^3.0.3", |
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.
Remove this if not required
"node-cron": "^3.0.3", |
@@ -56,6 +58,7 @@ | |||
"@types/jsonwebtoken": "^9.0.2", | |||
"@types/multer": "^1.4.11", | |||
"@types/node": "^20.1.4", | |||
"@types/node-cron": "^3.0.11", |
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.
"@types/node-cron": "^3.0.11", |
… status enums, and implement dynamic next reminder date calculation
Purpose
The purpose of this PR is to fix #176
This issue involves enhancing the
EmailReminderService
to ensure that email reminders are scheduled and processed correctly, with proper handling of retries and failures.Goals
Approach
EmailReminders
entity to initialize properties correctly.processReminders
method to handle pending reminders, including retries and exponential backoff.scheduleReminders
method.Screenshots
Checklist
Related PRs
Test environment
Learning