## Why ### Problem Users with accounts in multiple currencies see raw balances on the net worth chart without any conversion. A user with a USD-denominated profile who also holds EUR and GBP accounts sees misleading totals — the chart simply sums cents across currencies as if they were the same unit. ## What ### Changes - **`ExchangeRateService`** — New service that wraps `CurrencyConversionService` with DB-level caching. Checks the `exchange_rates` table first, falls back to the external CDN API on cache miss, and stores the full rate blob for future lookups. - **`exchange_rates` migration + model** — New table with `(base_currency, date)` unique constraint storing JSON rate blobs. Includes factory. - **`CurrencyConversionService`** — Made `getRatesForCurrency()` public so `ExchangeRateService` can delegate to it. - **`DashboardAnalyticsController`** — `netWorthEvolution` and `netWorthDailyEvolution` endpoints now convert every account balance from `account.currency_code` to `user.currency_code`. Response includes `currency_code` field and `_original` data for foreign-currency accounts. - **Future date capping** — `ExchangeRateService::getRates()` caps any future date to today, since the currency API only serves historical rates. Prevents 500 errors when the chart requests end-of-month rates for the current (incomplete) month. - **Frontend charts** — Simplified to single-currency display. Removed multi-currency `TotalDisplay` component; the chart header and tooltip now show amounts in the user's currency. Foreign-currency accounts show their original amount inline in the tooltip (e.g., "€2,000.00 → $2,222.22"). - **`valueFormatter` type fix** — Changed return type from `string` to `React.ReactNode` in chart component interfaces to match actual usage with `AmountDisplay`. ## Screenshot <img width="1266" height="649" alt="image" src="https://github.com/user-attachments/assets/6f661840-3f65-49fe-9948-d4cfd6c6ef0e" /> |
||
|---|---|---|
| .. | ||
| factories | ||
| migrations | ||
| seeders | ||
| .gitignore | ||