feat: add initial balance support to accounts, enhancing account management and balance calculations across components
This commit is contained in:
9
lib/account-utils.ts
Normal file
9
lib/account-utils.ts
Normal 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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user