Skip to content

[Backend] loanCheckCron re-sends the same repayment due notification every hour #10

Description

@grantfox-oss

Telegram (ask questions / claim the issue here first): https://t.me/+DOylgFv1jyJlNzM0

Why this matters

src/cron/loanCheckCron.ts runs hourly and for every unrepaid loan older than 30 days creates a fresh repayment_due notification (lines 28-36) with no dedup, no already-notified check and no idempotency, so an affected borrower is spammed 24 times a day indefinitely.

Acceptance criteria

  • Only notify when a borrower has not already been notified for that loan within a window (track last-notified or use a unique guard)
  • Replace the hardcoded 30-day heuristic with the actual loan due date / term where available
  • Add a distributed lock so multiple instances do not duplicate (coordinate with the scheduler-lock issue)
  • Add a test asserting a single notification per due loan per cycle window

Files to touch

  • src/cron/loanCheckCron.ts
  • src/services/notificationService.ts

Out of scope

  • Building a full repayment-schedule table
  • Email/SMS template redesign

Metadata

Metadata

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official CampaignbugSomething isn't workinghardAdvanced / high-difficulty issue

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions