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

@@ -49,6 +49,29 @@ export enum EmailStatus {
Unsubscribed = "unsubscribed"
}
export enum BillsNotificationStrategy {
/** Notify tenant when bill is payed */
WhenPayed = "when-payed",
/** Notify tenant when bill gets an attachment */
WhenAttached = "when-attached"
}
export enum BillsNotificationStatus {
/** Bills notification is scheduled to be sent */
Scheduled = "scheduled",
/** Bills notification has been sent */
Sent = "sent",
/** Sending of bills notification failed */
Failed = "failed"
}
export enum RentNotificationStatus {
/** notification has been sent */
Sent = "sent",
/** Sending of notification failed */
Failed = "failed"
}
/** bill object in the form returned by MongoDB */
export interface BillingLocation {
_id: string;
@@ -84,25 +107,25 @@ export interface BillingLocation {
/** (optional) language for tenant notification emails */
tenantEmailLanguage?: "hr" | "en" | null;
/** (optional) whether to automatically notify tenant */
billFwdEnabled?: boolean | null;
billsNotificationEnabled?: boolean | null;
/** (optional) bill forwarding strategy */
billFwdStrategy?: "when-payed" | "when-attached" | null;
billsNotificationStrategy?: BillsNotificationStrategy | null;
/** (optional) bill forwarding status */
billFwdStatus?: "pending" | "sent" | "failed" | null;
billsNotificationStatus?: BillsNotificationStatus | null;
/** (optional) utility bills proof of payment attachment */
billsProofOfPayment?: FileAttachment|null;
/** (optional) whether to automatically send rent notification */
rentDueNotificationEnabled?: boolean | null;
rentNotificationEnabled?: boolean | null;
/** (optional) when was the rent due notification sent */
rentNotificationStatus?: RentNotificationStatus | null;
/** (optional) rent proof of payment attachment */
rentProofOfPayment?: FileAttachment|null;
/** (optional) day of month when rent is due (1-31) */
rentDueDay?: number | null;
/** (optional) when was the rent due notification sent */
rentDueNotificationStatus?: "sent" | "failed" | null;
/** (optional) monthly rent amount in cents */
rentAmount?: number | null;
/** (optional) whether the location has been seen by tenant */
seenByTenantAt?: Date | null;
/** (optional) utility bills proof of payment attachment */
utilBillsProofOfPayment?: FileAttachment|null;
/** (optional) rent proof of payment attachment */
rentProofOfPayment?: FileAttachment|null;
/** (optional) share link expiry timestamp */
shareTTL?: Date;
/** (optional) when tenant first visited the share link */