feat: add initial balance support to accounts, enhancing account management and balance calculations across components

This commit is contained in:
Julien Froidefond
2025-11-30 12:13:02 +01:00
parent c26ba9ddc6
commit 184a073bb1
13 changed files with 117 additions and 30 deletions

9
lib/account-utils.ts Normal file
View File

@@ -0,0 +1,9 @@
import type { Account } from "./types";
/**
* Calcule le solde réel d'un compte en incluant le solde initial
*/
export function getAccountBalance(account: Account): number {
return (account.initialBalance || 0) + account.balance;
}

View File

@@ -22,6 +22,7 @@ export interface Account {
type: "CHECKING" | "SAVINGS" | "CREDIT_CARD" | "OTHER";
folderId: string | null;
balance: number;
initialBalance: number;
currency: string;
lastImport: string | null;
externalUrl: string | null;