Update types.ts

This commit is contained in:
2025-12-18 21:03:08 +01:00
committed by GitHub
parent 688661c4cf
commit 51868c2594

163
types.ts
View File

@@ -3,37 +3,37 @@ export interface Condo {
id: string; id: string;
name: string; name: string;
address?: string; address?: string;
streetNumber?: string; // Civico streetNumber?: string;
city?: string; // Città city?: string;
province?: string; // Provincia province?: string;
zipCode?: string; // CAP zipCode?: string;
notes?: string; // Note notes?: string;
iban?: string; iban?: string;
paypalClientId?: string; // PayPal Client ID for receiving payments paypalClientId?: string;
defaultMonthlyQuota: number; defaultMonthlyQuota: number;
dueDay?: number; // Day of month (1-31) when payment is due. Default 10. dueDay?: number;
image?: string; // Optional placeholder for logo image?: string;
} }
export interface Family { export interface Family {
id: string; id: string;
condoId: string; // Link to specific condo condoId: string;
name: string; name: string;
unitNumber: string; // Internal apartment number (Interno) unitNumber: string;
stair?: string; // Scala stair?: string;
floor?: string; // Piano floor?: string;
notes?: string; // Note notes?: string;
contactEmail?: string; contactEmail?: string;
balance: number; // Calculated balance (positive = credit, negative = debt) balance: number;
customMonthlyQuota?: number; // Optional override for default quota customMonthlyQuota?: number;
} }
export interface Payment { export interface Payment {
id: string; id: string;
familyId: string; familyId: string;
amount: number; amount: number;
datePaid: string; // ISO Date string datePaid: string;
forMonth: number; // 1-12 forMonth: number;
forYear: number; forYear: number;
notes?: string; notes?: string;
} }
@@ -55,6 +55,13 @@ export interface StorageConfig {
region?: string; region?: string;
} }
export interface AppBranding {
appName: string;
appIcon?: string;
loginBg?: string;
primaryColor: string;
}
export interface AppFeatures { export interface AppFeatures {
multiCondo: boolean; multiCondo: boolean;
tickets: boolean; tickets: boolean;
@@ -62,58 +69,27 @@ export interface AppFeatures {
notices: boolean; notices: boolean;
reports: boolean; reports: boolean;
extraordinaryExpenses: boolean; extraordinaryExpenses: boolean;
condoFinancialsView: boolean; // Toggle for User read-only access to Condo Expenses condoFinancialsView: boolean;
documents: boolean; // NEW: Document Management documents: boolean;
}
export interface AlertDefinition {
id: string;
subject: string;
body: string;
daysOffset: number; // Number of days
offsetType: 'before_next_month' | 'after_current_month';
sendHour: number; // 0-23
active: boolean;
lastSent?: string; // ISO Date of last execution
}
export type NoticeIconType = 'info' | 'warning' | 'maintenance' | 'event';
export interface Notice {
id: string;
condoId: string;
title: string;
content: string;
type: NoticeIconType;
link?: string;
date: string; // ISO Date
active: boolean;
targetFamilyIds?: string[]; // Array of family IDs. If empty/null, it means "ALL"
}
export interface NoticeRead {
userId: string;
noticeId: string;
readAt: string;
} }
export interface AppSettings { export interface AppSettings {
// Global settings only currentYear: number;
currentYear: number; // The active fiscal year (could be per-condo, but global for simplicity now)
smtpConfig?: SmtpConfig; smtpConfig?: SmtpConfig;
storageConfig?: StorageConfig; // NEW: Cloud storage settings storageConfig?: StorageConfig;
features: AppFeatures; features: AppFeatures;
branding: AppBranding; // NEW
} }
export enum PaymentStatus { export enum PaymentStatus {
PAID = 'PAID', PAID = 'PAID',
UNPAID = 'UNPAID', // Past due (Overdue) UNPAID = 'UNPAID',
UPCOMING = 'UPCOMING', // Future UPCOMING = 'UPCOMING',
PENDING = 'PENDING' // Due soon (within 10 days window) PENDING = 'PENDING'
} }
export interface MonthStatus { export interface MonthStatus {
monthIndex: number; // 0-11 monthIndex: number;
status: PaymentStatus; status: PaymentStatus;
payment?: Payment; payment?: Payment;
} }
@@ -133,7 +109,6 @@ export interface AuthResponse {
user: User; user: User;
} }
// --- DOCUMENTS ---
export interface Document { export interface Document {
id: string; id: string;
condoId: string; condoId: string;
@@ -142,20 +117,18 @@ export interface Document {
fileName: string; fileName: string;
fileType: string; fileType: string;
fileSize: number; fileSize: number;
tags: string[]; // Array of tag strings tags: string[];
uploadDate: string; uploadDate: string;
storageProvider: string; // 'local_db', 's3', etc. storageProvider: string;
url?: string; // Signed URL or base64 data depending on provider url?: string;
} }
// --- TICKETS ---
export enum TicketStatus { export enum TicketStatus {
OPEN = 'OPEN', OPEN = 'OPEN',
IN_PROGRESS = 'IN_PROGRESS', IN_PROGRESS = 'IN_PROGRESS',
SUSPENDED = 'SUSPENDED', // New State SUSPENDED = 'SUSPENDED',
RESOLVED = 'RESOLVED', RESOLVED = 'RESOLVED',
CLOSED = 'CLOSED' // Closed without resolution (Archived/WontFix) CLOSED = 'CLOSED'
} }
export enum TicketPriority { export enum TicketPriority {
@@ -166,19 +139,19 @@ export enum TicketPriority {
} }
export enum TicketCategory { export enum TicketCategory {
MAINTENANCE = 'MAINTENANCE', // Manutenzione MAINTENANCE = 'MAINTENANCE',
ADMINISTRATIVE = 'ADMINISTRATIVE', // Amministrativa ADMINISTRATIVE = 'ADMINISTRATIVE',
NOISE = 'NOISE', // Disturbo/Rumori NOISE = 'NOISE',
CLEANING = 'CLEANING', // Pulizie CLEANING = 'CLEANING',
OTHER = 'OTHER' // Altro OTHER = 'OTHER'
} }
export interface TicketAttachment { export interface TicketAttachment {
id: string; id: string;
ticketId: string; ticketId: string;
fileName: string; fileName: string;
fileType: string; // MIME type fileType: string;
data: string; // Base64 Data URI data: string;
} }
export interface TicketComment { export interface TicketComment {
@@ -204,12 +177,10 @@ export interface Ticket {
updatedAt: string; updatedAt: string;
attachments?: TicketAttachment[]; attachments?: TicketAttachment[];
comments?: TicketComment[]; comments?: TicketComment[];
userName?: string; // Joined field userName?: string;
userEmail?: string; // Joined field userEmail?: string;
} }
// --- EXTRAORDINARY EXPENSES ---
export interface ExpenseItem { export interface ExpenseItem {
id?: string; id?: string;
description: string; description: string;
@@ -223,7 +194,7 @@ export interface ExpenseShare {
amountDue: number; amountDue: number;
amountPaid: number; amountPaid: number;
status: 'PAID' | 'PARTIAL' | 'UNPAID'; status: 'PAID' | 'PARTIAL' | 'UNPAID';
familyName?: string; // Joined familyName?: string;
} }
export interface ExtraordinaryExpense { export interface ExtraordinaryExpense {
@@ -236,20 +207,18 @@ export interface ExtraordinaryExpense {
contractorName: string; contractorName: string;
totalAmount: number; totalAmount: number;
items: ExpenseItem[]; items: ExpenseItem[];
shares?: ExpenseShare[]; // For detail view shares?: ExpenseShare[];
attachments?: { id: string, fileName: string, fileType: string, data: string }[]; attachments?: { id: string, fileName: string, fileType: string, data: string }[];
createdAt: string; createdAt: string;
} }
// --- CONDO ORDINARY EXPENSES (USCITE) ---
export interface CondoExpense { export interface CondoExpense {
id: string; id: string;
condoId: string; condoId: string;
description: string; description: string;
supplierName: string; supplierName: string;
amount: number; amount: number;
paymentDate: string | null; // Null if not paid yet paymentDate: string | null;
status: 'PAID' | 'UNPAID' | 'SUSPENDED'; status: 'PAID' | 'UNPAID' | 'SUSPENDED';
paymentMethod?: string; paymentMethod?: string;
invoiceNumber?: string; invoiceNumber?: string;
@@ -257,3 +226,35 @@ export interface CondoExpense {
createdAt: string; createdAt: string;
attachments?: { id: string, fileName: string, fileType: string, data: string }[]; attachments?: { id: string, fileName: string, fileType: string, data: string }[];
} }
export interface Notice {
id: string;
condoId: string;
title: string;
content: string;
type: 'info' | 'warning' | 'maintenance' | 'event';
link?: string;
date: string;
active: boolean;
targetFamilyIds?: string[];
}
export interface NoticeRead {
userId: string;
noticeId: string;
readAt: string;
}
// Fixed missing exports required by settings and services
export type NoticeIconType = 'info' | 'warning' | 'maintenance' | 'event';
export interface AlertDefinition {
id: string;
condoId: string;
subject: string;
body: string;
daysOffset: number;
offsetType: string;
sendHour: number;
active: boolean;
}