Commit Graph

1 Commits

Author SHA1 Message Date
Knee Cola
767dda6355 feat: refactor email-worker to use HTML email templates
Replace inline HTML in email notifications with professional HTML templates
for better email client compatibility and consistent branding.

Changes:
- Created emailTemplates.ts utility for loading and rendering templates
  - Template caching for performance
  - Variable substitution with ${variable} syntax
  - Warning logging for unreplaced variables

- Updated sendVerificationRequests to use email-validation template
  - Variables: location.tenantName, ownerName, location.name, shareId

- Updated sendRentDueNotifications to use rent-due template
  - Fetches user settings for owner name and currency
  - Calculates rent due date from yearMonth and rentDueDay
  - Formats rent amount (converts cents to display format)
  - Variables: location.tenantName, location.name, rentDueDate,
    rentAmount, currency, ownerName, shareId

- Updated sendUtilityBillsNotifications to use util-bills-due template
  - Calculates total amount from all bills
  - Fetches user settings for owner name and currency
  - Variables: location.tenantName, location.name, totalAmount,
    currency, ownerName, shareId

- Fixed ObjectId type mismatches in MongoDB operations

All emails now feature:
- Responsive 3-column layout
- rezije.app branding with logo
- Professional typography and spacing
- Unsubscribe links
- Email client compatible table-based layouts

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-30 18:37:34 +01:00