feat: implement email notification worker with Mailgun integration

- Add MongoDB connection module for database access
- Implement Mailgun email service for sending notifications
- Add shareChecksum utility for generating secure share links
- Implement three email sender functions:
  - Email verification requests (highest priority)
  - Rent due notifications (CET timezone)
  - Utility bills due notifications
- Create main email worker with budget-based email sending
- Add environment variables for configuration
- Install dependencies: mongodb, mailgun.js, form-data
- Update package.json description to reflect email worker purpose
- Add .env.example with all required configuration

The worker processes emails in priority order and respects a configurable
budget to prevent overwhelming the mail server. All database operations are
atomic and updates are performed immediately after each email send.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Knee Cola
2025-12-30 12:27:32 +01:00
parent 33ab06e22e
commit a901980a6f
11 changed files with 10408 additions and 3 deletions

View File

@@ -1,7 +1,7 @@
{
"name": "email-worker",
"version": "0.1.0",
"description": "Background worker service with HTTP health monitoring and metrics collection",
"description": "Email notification worker service for sending verification requests, rent due notices, and utility bills notifications",
"main": "entry.ts",
"scripts": {
"start": "nodemon ./src/entry.ts",
@@ -14,7 +14,10 @@
"dependencies": {
"debug": "^2.6.9",
"express": "^4.18.2",
"form-data": "^4.0.5",
"http-errors": "^1.7.2",
"mailgun.js": "^12.4.1",
"mongodb": "^7.0.0",
"node-fetch": "^2.6.7",
"prom-client": "^14.0.1",
"stoppable": "^1.1.0"
@@ -25,6 +28,7 @@
"@types/express": "^4.17.13",
"@types/http-errors": "^1.8.1",
"@types/jest": "^29.2.5",
"@types/mongodb": "^4.0.6",
"@types/node": "^16.10.2",
"@types/node-fetch": "^2.6.2",
"@types/stoppable": "^1.1.1",
@@ -46,4 +50,4 @@
"@babel/preset-typescript"
]
}
}
}