Refactor types to support per-bill proof of payment

- Renamed BillAttachment to FileAttachment for better generalization
- Added uploadedAt field to FileAttachment (consolidates timestamp)
- Renamed utilBillsProofOfPaymentAttachment to utilBillsProofOfPayment
- Removed separate utilBillsProofOfPaymentUploadedAt field (now in FileAttachment)
- Added rentProofOfPayment field to BillingLocation for rent-specific proof
- Added proofOfPayment field to Bill interface for per-bill attachments
- Removed unused imports (ObjectId, inter)

This refactoring enables both "combined" (location-level) and "per-bill"
proof of payment attachment strategies.

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Knee Cola
2025-12-07 11:30:23 +01:00
parent dd4c92be77
commit 1c7edabcbe

View File

@@ -1,12 +1,11 @@
import { ObjectId } from "mongodb";
import { inter } from "../ui/fonts";
export interface BillAttachment { export interface FileAttachment {
fileName: string; fileName: string;
fileSize: number; fileSize: number;
fileType: string; fileType: string;
fileLastModified: number; fileLastModified: number;
fileContentsBase64: string; fileContentsBase64: string;
uploadedAt: Date;
}; };
export interface YearMonth { export interface YearMonth {
@@ -79,9 +78,9 @@ export interface BillingLocation {
/** (optional) whether the location has been seen by tenant */ /** (optional) whether the location has been seen by tenant */
seenByTenantAt?: Date | null; seenByTenantAt?: Date | null;
/** (optional) utility bills proof of payment attachment */ /** (optional) utility bills proof of payment attachment */
utilBillsProofOfPaymentAttachment?: BillAttachment|null; utilBillsProofOfPayment?: FileAttachment|null;
/** (optional) date when utility bills proof of payment was uploaded */ /** (optional) rent proof of payment attachment */
utilBillsProofOfPaymentUploadedAt?: Date|null; rentProofOfPayment?: FileAttachment|null;
}; };
export enum BilledTo { export enum BilledTo {
@@ -101,7 +100,7 @@ export interface Bill {
/** payed amount amount in cents */ /** payed amount amount in cents */
payedAmount?: number | null; payedAmount?: number | null;
/** attached document (optional) */ /** attached document (optional) */
attachment?: BillAttachment|null; attachment?: FileAttachment|null;
/** /**
* true if there an attachment * true if there an attachment
* @description this field enables us to send this info to the client without sending large attachment - it's an optimization * @description this field enables us to send this info to the client without sending large attachment - it's an optimization
@@ -116,4 +115,6 @@ export interface Bill {
barcodeImage?:string; barcodeImage?:string;
/** (optional) HUB-3A text for generating PDF417 bar code */ /** (optional) HUB-3A text for generating PDF417 bar code */
hub3aText?:string; hub3aText?:string;
/** (optional) proof of payment attachment */
proofOfPayment?: FileAttachment|null;
}; };