Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This new feature allows the scheduler to plan and send newsletters as needed, according to a defined periodicity.
For now, the script executed when sending emails is a simple "hello world" in the console to avoid consuming emails in Postmark. However, you can replace it with the actual newsletter-sending script that we have already developed.
The script checks every 10 seconds if there are newsletters to send. If so, it executes the specified script (currently "hello.ts" for testing purposes).
After sending an email, it schedules the next one based on the user's chosen periodicity.
In this example, we plan to send two newsletters at 19:10.
One person wants another newsletter in 5 minutes, and the other in 6 minutes (this demonstrates different periodicity management).
Example in the terminal :
Looking at the database after execution :