- Add rentDueNotification toggle to enable automatic rent notifications - Add rentDueDay selector (1-28) for specifying when rent is due - Extract tenant email to independent section shown when either autoBillFwd or rentDueNotification is enabled - Update email validation to be mandatory when any automatic notification is active - Update database schema to persist rentDueNotification and rentDueDay fields - Add all database operations to handle new fields with proper defaults - Add localization strings for English and Croatian 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
91 lines
2.5 KiB
TypeScript
91 lines
2.5 KiB
TypeScript
import { ObjectId } from "mongodb";
|
|
import { inter } from "../ui/fonts";
|
|
|
|
export interface BillAttachment {
|
|
fileName: string;
|
|
fileSize: number;
|
|
fileType: string;
|
|
fileLastModified: number;
|
|
fileContentsBase64: string;
|
|
};
|
|
|
|
export interface YearMonth {
|
|
year: number;
|
|
month: number;
|
|
};
|
|
|
|
/** User profile data */
|
|
export interface UserProfile {
|
|
/** user's ID */
|
|
userId: string;
|
|
/** first name */
|
|
firstName?: string | null;
|
|
/** last name */
|
|
lastName?: string | null;
|
|
/** address */
|
|
address?: string | null;
|
|
/** IBAN */
|
|
iban?: string | null;
|
|
};
|
|
|
|
/** bill object in the form returned by MongoDB */
|
|
export interface BillingLocation {
|
|
_id: string;
|
|
/** user's ID */
|
|
userId: string;
|
|
/** user's email */
|
|
userEmail?: string | null;
|
|
/** name of the location */
|
|
name: string;
|
|
/** billing period year and month */
|
|
yearMonth: YearMonth;
|
|
/** array of bills */
|
|
bills: Bill[];
|
|
/** (optional) notes */
|
|
notes: string|null;
|
|
/** (optional) whether to generate 2D code for tenant */
|
|
generateTenantCode?: boolean | null;
|
|
/** (optional) tenant first name */
|
|
tenantFirstName?: string | null;
|
|
/** (optional) tenant last name */
|
|
tenantLastName?: string | null;
|
|
/** (optional) whether to automatically notify tenant */
|
|
autoBillFwd?: boolean | null;
|
|
/** (optional) tenant email */
|
|
tenantEmail?: string | null;
|
|
/** (optional) bill forwarding strategy */
|
|
billFwdStrategy?: "when-payed" | "when-attached" | null;
|
|
/** (optional) whether to automatically send rent notification */
|
|
rentDueNotification?: boolean | null;
|
|
/** (optional) day of month when rent is due (1-31) */
|
|
rentDueDay?: number | null;
|
|
};
|
|
|
|
export enum BilledTo {
|
|
Tenant = "tenant",
|
|
Landlord = "landlord"
|
|
}
|
|
|
|
/** Bill basic data */
|
|
export interface Bill {
|
|
_id: string;
|
|
/** bill name */
|
|
name: string;
|
|
/** is the bill paid */
|
|
paid: boolean;
|
|
/** who is billed for the bill */
|
|
billedTo?: BilledTo;
|
|
/** payed amount amount in cents */
|
|
payedAmount?: number | null;
|
|
/** attached document (optional) */
|
|
attachment?: BillAttachment|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
|
|
*/
|
|
hasAttachment?: boolean;
|
|
/** (optional) notes */
|
|
notes?: string|null;
|
|
/** (optional) image data containing PDF471 bar code */
|
|
barcodeImage?:string;
|
|
}; |