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

View File

@@ -19,8 +19,8 @@ The web page served at this path contains an text explanation and "Verify e-mail
The text includes the following information:
* what the web app is about - very short into
* why the e-mail was sent = because the landloard of the property `BillingLocation.name` configured the rent (`BillingLocation.rentDueNotificationEnabled`) and/or utility bills (`BillingLocation.billFwdStrategy`) to be delivered to that e-mail address
* what will hapen if he/she clicks on the "Verify e-mail" button = they will be receiving rent due (`BillingLocation.rentDueNotificationEnabled`) or utility bills due (`BillingLocation.billFwdStrategy`) notification or both - 2x a month - depending on the config set by the landloard
* why the e-mail was sent = because the landloard of the property `BillingLocation.name` configured the rent (`BillingLocation.rentNotificationEnabled`) and/or utility bills (`BillingLocation.billsNotificationStrategy`) to be delivered to that e-mail address
* what will hapen if he/she clicks on the "Verify e-mail" button = they will be receiving rent due (`BillingLocation.rentNotificationEnabled`) or utility bills due (`BillingLocation.billsNotificationStrategy`) notification or both - 2x a month - depending on the config set by the landloard
* opt-out infomation (they can ignore this e-mail, but can also opt-out at any moment)
If the user clicks the button "Verify e-mail" this triggers update of `BillingLocation.tenantEmailStatus`.