From 1c7edabcbec3700fc680206e53ef7391e1c0864a Mon Sep 17 00:00:00 2001 From: Knee Cola Date: Sun, 7 Dec 2025 11:30:23 +0100 Subject: [PATCH] Refactor types to support per-bill proof of payment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- app/lib/db-types.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/app/lib/db-types.ts b/app/lib/db-types.ts index e0f926c..341ed62 100644 --- a/app/lib/db-types.ts +++ b/app/lib/db-types.ts @@ -1,12 +1,11 @@ -import { ObjectId } from "mongodb"; -import { inter } from "../ui/fonts"; -export interface BillAttachment { +export interface FileAttachment { fileName: string; fileSize: number; fileType: string; fileLastModified: number; fileContentsBase64: string; + uploadedAt: Date; }; export interface YearMonth { @@ -79,9 +78,9 @@ export interface BillingLocation { /** (optional) whether the location has been seen by tenant */ seenByTenantAt?: Date | null; /** (optional) utility bills proof of payment attachment */ - utilBillsProofOfPaymentAttachment?: BillAttachment|null; - /** (optional) date when utility bills proof of payment was uploaded */ - utilBillsProofOfPaymentUploadedAt?: Date|null; + utilBillsProofOfPayment?: FileAttachment|null; + /** (optional) rent proof of payment attachment */ + rentProofOfPayment?: FileAttachment|null; }; export enum BilledTo { @@ -101,7 +100,7 @@ export interface Bill { /** payed amount amount in cents */ payedAmount?: number | null; /** attached document (optional) */ - attachment?: BillAttachment|null; + attachment?: FileAttachment|null; /** * 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 @@ -116,4 +115,6 @@ export interface Bill { barcodeImage?:string; /** (optional) HUB-3A text for generating PDF417 bar code */ hub3aText?:string; + /** (optional) proof of payment attachment */ + proofOfPayment?: FileAttachment|null; }; \ No newline at end of file