This commit is contained in:
Mateusz Gruszczyński
2026-04-06 14:37:42 +02:00
parent 237596bd52
commit 80e181ea3f
41 changed files with 14959 additions and 1023 deletions

View File

@@ -39,6 +39,9 @@ export interface Proof {
createdAt: string;
}
export type ExpenseStatus = 'DRAFT' | 'PENDING' | 'APPROVED' | 'REJECTED';
export type DuplicateStatus = 'OPEN' | 'CONFIRMED' | 'DISMISSED';
export interface Expense {
id: string;
title: string;
@@ -48,13 +51,24 @@ export interface Expense {
merchant: string | null;
paymentMethod: 'CARD' | 'CASH' | 'TRANSFER' | 'BLIK' | 'OTHER' | null;
currency: string;
status: ExpenseStatus;
tags: string[];
customFields: Record<string, string>;
possibleDuplicate: boolean;
duplicateStatus: DuplicateStatus | null;
duplicateReviewedAt: string | null;
recurringSourceId: string | null;
category: Category;
proofs: Proof[];
createdAt: string;
updatedAt: string;
}
export interface DuplicateGroup {
source: Expense;
matches: Expense[];
}
export interface StatsResponse {
total: number;
count: number;
@@ -62,6 +76,72 @@ export interface StatsResponse {
topCategory: { categoryId: string; categoryName: string; total: number; count: number } | null;
byCategory: Array<{ categoryId: string; categoryName: string; total: number; count: number }>;
timeline: Array<{ label: string; total: number }>;
byTag?: Array<{ tag: string; total: number }>;
byStatus?: Array<{ status: string; count: number }>;
}
export interface CashflowResponse {
currentMonth: string;
actualCurrent: number;
totalBudget: number;
budgetUsagePercent: number;
duplicateCount: number;
pendingApproval: number;
forecastCurrentMonth: number;
trend: Array<{ label: string; actual: number; budget: number }>;
alerts: Array<{ id: string; name: string; usagePercent: number; spent: number; amount: number }>;
upcomingRecurring: Array<{ id: string; title: string; amount: number; nextRunDate: string; frequency: string }>;
statusSummary: Array<{ status: string; count: number }>;
}
export interface Budget {
id: string;
month: string;
name: string | null;
amount: number;
spent: number;
usagePercent: number;
alertLevel: number | null;
alertThresholds: number[];
isActive: boolean;
category: Category | null;
createdAt: string;
updatedAt: string;
}
export interface BudgetListResponse {
month: string;
items: Budget[];
summary: {
totalBudget: number;
totalSpent: number;
alerts: Array<{ budgetId: string; message: string; usagePercent: number; level: number }>;
};
}
export interface RecurringExpense {
id: string;
title: string;
description: string | null;
amount: number;
merchant: string | null;
paymentMethod: 'CARD' | 'CASH' | 'TRANSFER' | 'BLIK' | 'OTHER' | null;
currency: string;
frequency: 'WEEKLY' | 'MONTHLY' | 'YEARLY';
intervalValue: number;
startDate: string;
nextRunDate: string;
lastRunDate: string | null;
endDate: string | null;
maxOccurrences: number | null;
generatedCount: number;
defaultStatus: 'DRAFT' | 'PENDING';
tags: string[];
customFields: Record<string, string>;
isActive: boolean;
category: Category;
createdAt: string;
updatedAt: string;
}
export interface AppSettings {
@@ -90,3 +170,61 @@ export interface ReportPreferences {
sendToEmail: string | null;
categoryIds: string[];
}
export interface ShoppingListIntegrationSettings {
enabled: boolean;
baseUrl: string;
hasToken: boolean;
authMode: 'bearer' | 'x-api-token' | 'both';
ownerId: string | null;
defaultListId: string | null;
}
export interface ShoppingListSummary {
total?: number;
amount?: number;
count?: number;
records?: number;
meta?: { total_amount?: number; total_count?: number; returned_count?: number; [key: string]: unknown };
lists?: Array<{ id?: string | number; title?: string; name?: string; total_amount?: number; total?: number; expense_count?: number; count?: number }>;
totals?: Array<{ list_id?: string | number; listId?: string | number; name?: string; total?: number; amount?: number; count?: number }>;
aggregates?: Array<{ list_id?: string | number; listId?: string | number; name?: string; total?: number; amount?: number; count?: number }>;
[key: string]: unknown;
}
export interface ShoppingListRef {
id: string | number;
name?: string;
title?: string;
created_at?: string;
categories?: string[];
owner_id?: string | number;
ownerId?: string | number;
owner?: { id?: string | number; username?: string; name?: string; fullName?: string; email?: string };
is_active?: boolean;
is_archived?: boolean;
[key: string]: unknown;
}
export interface ShoppingListExpenseItem {
id?: string | number;
expense_id?: string | number;
title?: string;
name?: string;
amount?: number;
total?: number;
created_at?: string;
added_at?: string;
expense_date?: string;
receipt_filename?: string;
list?: ShoppingListRef;
owner?: { id?: string | number; username?: string; name?: string; fullName?: string; email?: string };
[key: string]: unknown;
}
export interface ShoppingListTemplate {
id: string;
name?: string;
title?: string;
[key: string]: unknown;
}