feat(notifications): add scheduler service for time-based due-date al… - #388
Open
Teeeyanaa wants to merge 2 commits into
Open
feat(notifications): add scheduler service for time-based due-date al…#388Teeeyanaa wants to merge 2 commits into
Teeeyanaa wants to merge 2 commits into
Conversation
…erts Closes Invoice-Liquidity-Network#379 Adds SchedulerService that runs every 30 minutes (node-cron) and sends invoice.expiring_soon email reminders at the 72-hour and 24-hour thresholds before an invoice due date. Key implementation details: - Queries the invoice DB for status='Funded' rows whose due_date falls within the respective threshold window - Delivers reminders to all active email subscribers matching the invoice's freelancer, payer, and funder addresses - Idempotency enforced via a delivered_reminders table (PK: invoice_id + threshold_h) in the notifications DB, preventing duplicate sends across restarts and repeated cron firings - Exposes initDeliveredRemindersSchema() for schema migration - Accepts an injectable clock (now option) for deterministic tests - Configurable cron expression (default: */30 * * * *) Also fixes a pre-existing broken tsconfig.json extends path (../../tsconfig.base.json → ../tsconfig.base.json). Tests (22 cases): - Schema creation and idempotency - 72 h and 24 h reminder delivery - Correct filtering of non-Funded, out-of-window, inactive, unsubscribed, and wrong-eventType subscribers - Wildcard (*) eventType matching - Notifications sent to all three roles (freelancer, payer, funder) - Idempotency: second run is a no-op, persists across separate SchedulerService instances, records separate rows per threshold, writes idempotency record even when email delivery fails - Lifecycle: start/stop, custom cron expression - Logging assertions
|
@Teeeyanaa Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
|
Please fix merge conflicts @Teeeyanaa |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
…erts
Closes #379
Adds SchedulerService that runs every 30 minutes (node-cron) and sends invoice.expiring_soon email reminders at the 72-hour and 24-hour thresholds before an invoice due date.
Key implementation details:
Also fixes a pre-existing broken tsconfig.json extends path (../../tsconfig.base.json → ../tsconfig.base.json).
Tests (22 cases):
Summary
Package Affected
Related Issue
Closes #
Complexity
Changes Made
Changeset Included
Test Evidence
Test output
Breaking Change
Migration Notes
Security Considerations
Checklist
Closes #379