hoangsonww / hoangsonww/Library-Management-Backend
Add due-date reminder notifications (email)
- Dominant language
- Go
- Stars
- 1
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
## What problem does this solve?
Borrowers have no way to find out a loan is coming due except by checking `GET /api/v1/borrowers/{id}/loans` themselves. There's no proactive reminder, which is a big part of why real-world overdue rates are high in the first place.
## Proposed solution
- Add an `email` reminder job (a small scheduled task, run via `cmd/api --reminder-worker` or a separate lightweight `cmd/reminder-worker` binary keeping the "one Go binary per concern" pattern this repo already uses for `cmd/api`) that queries loans with `dueDate` within a configurable window (`REMINDER_DAYS_BEFORE_DUE`, default `2`) and status `active`, then sends a reminder email via a pluggable `notifier` interface (start with SMTP; keep the interface open for future providers).
- Track `reminderSentAt` on the loan so the job is idempotent (don't re-send every run).
- Ship SMTP config as standard env vars (`SMTP_HOST`, `SMTP_PORT`, `SMTP_FROM`, etc.), disabled by default (`REMINDERS_ENABLED=false`) so this is fully opt-in.
## Alternatives considered
Push notifications or SMS — more infrastructure (a mobile app, a paid SMS provider) than this project needs; email is the lowest-friction starting point and the `notifier` interface leaves room to add more channels later.
## Area
Borrowers, Loans (borrow / return)
## Priority
Would significantly improve real-world usefulness — a due-date reminder is one of the highest-value, most-expected features for any lending system.
Contributor guide
Assessment
This issue has not been assessed yet.