refactor: improve notification naming and introduce type-safe enums

- Rename billFwd* to billsNotification* for clarity
- Rename rentDueNotification* to rentNotification* for consistency
- Rename utilBillsProofOfPayment to billsProofOfPayment
- Introduce enums for type safety:
  - BillsNotificationStrategy (WhenPayed, WhenAttached)
  - BillsNotificationStatus (Scheduled, Sent, Failed)
  - RentNotificationStatus (Sent, Failed)
- Replace "pending" status with "scheduled" for better semantics
- Fix function names to proper camelCase
- Fix incorrect import path in web-app/app/lib/format.ts

🤖 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
2026-01-06 13:05:22 +01:00
parent 0556ad2533
commit fb35e0278e
13 changed files with 160 additions and 137 deletions

View File

@@ -90,16 +90,16 @@ The process of sending rent-due e-mail notifications is as follows:
- fetch all `BillingLocations` from `lokacije` collection (see `locationActions.ts` in `web-app` workspace) - filter only records which satisfy the following:
- `yearMonth.year` and `yearMonth.month` equal to current year and month
- `tenantEmailStatus` is equal to `EmailStatus.Verified`
- `rentDueNotificationEnabled === true`
- `rentNotificationEnabled === true`
- `rentDueDay` = current day (1-31) in CET timezone
- `rentDueNotificationStatus` === undefined OR `rentDueNotificationStatus` === null
- `rentNotificationStatus` === undefined OR `rentNotificationStatus` === null
- for each record found
- check the e-mail budget counter
-> if the value is 0 then exit
- compile an e-mail containing the content listed below
- send the e-mail
- if send OK set `rentDueNotificationStatus` to `sent`
- if send failed set `rentDueNotificationStatus` to `failed`
- if send OK set `rentNotificationStatus` to `sent`
- if send failed set `rentNotificationStatus` to `failed`
- decrement the e-mail budget counter
### Rent due notifications E-mail content
@@ -132,15 +132,15 @@ The process of bills due notifications e-mail is as follows:
- fetch all `BillingLocations` from `lokacije` collection (see `locationActions.ts` in `web-app` workspace) - filter only records which satisfy the following:
- `yearMonth.year` and `yearMonth.month` equal to current year and month
- `tenantEmailStatus` is equal to `EmailStatus.Verified`
- `billFwdEnabled === true`
- `billFwdStatus === 'pending'`
- `billsNotificationEnabled === true`
- `billsNotificationStatus === 'scheduled'`
- for each record found
- check the e-mail budget counter
-> if the value is 0 then exit
- compile an e-mail containing the content listed below
- send the e-mail
- if send OK set `billFwdStatus` to `sent`
- if send failed set `billFwdStatus` to `failed`
- if send OK set `billsNotificationStatus` to `sent`
- if send failed set `billsNotificationStatus` to `failed`
- decrement the e-mail budget counter
### Utility bills due notifications E-mail content