feat: Multi-account financial overview dashboard#862
Open
inventelpk-cell wants to merge 1 commit intorohitdash08:mainfrom
Open
feat: Multi-account financial overview dashboard#862inventelpk-cell wants to merge 1 commit intorohitdash08:mainfrom
inventelpk-cell wants to merge 1 commit intorohitdash08:mainfrom
Conversation
- Add Account model (checking/savings/credit/investment types) - Add account_id FK to Expense model (nullable for backward compat) - Add accounts CRUD endpoints with soft delete and default promotion - Add per-account expense summary endpoint - Add dashboard overview endpoint aggregating all accounts - Add account_id filter to existing dashboard summary and expenses list - Add Redis cache keys and invalidation for account-related data - Add idempotent SQL migration for accounts table - Add schema compatibility patch for existing deployments - Add 8 pytest tests covering accounts CRUD, validation, summaries - Update README with accounts API documentation Closes rohitdash08#132
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds multi-account support to FinMind, allowing users to manage multiple financial accounts (checking, savings, credit, investment) and view aggregated financial data across all accounts in a unified dashboard.
Closes #132
Changes
New Account Model
Accountmodel with fields: id, user_id, name, account_type (CHECKING/SAVINGS/CREDIT/INVESTMENT), balance, currency, is_default, is_active (soft delete), created_at, updated_atAccountTypeenum for type safetyaccount_idFK added toExpensemodel for backward compatibilityAPI Endpoints
POST /accounts— Create account (first account auto-defaults)GET /accounts— List user's active accounts (cached, 5min TTL)GET /accounts/<id>— Account detailPATCH /accounts/<id>— Update account fieldsDELETE /accounts/<id>— Soft delete with automatic default promotionGET /accounts/<id>/summary?month=YYYY-MM— Per-account expense summary with category breakdownGET /dashboard/overview?month=YYYY-MM— Aggregated view across all accounts (total balance, per-account income/expenses/net flow)GET /dashboard/summary?account_id=N— Existing dashboard now supports optional account filteringGET /expenses?account_id=N— Existing expense list now supports account filteringDatabase
packages/backend/app/db/migrations/001_add_accounts.sql__init__.pyfor existing deploymentsschema.sqlwith accounts table and expense FKCaching & Invalidation
user:{id}:accounts,user:{id}:account_summary:{acct}:{ym},user:{id}:dashboard_overview:{ym}Tests
Backward Compatibility
account_idon expenses is nullable — existing expenses without accounts continue to work/dashboard/summaryendpoint behavior is unchanged whenaccount_idparam is omittedIF NOT EXISTS/IF NOT EXISTS)Test Plan
pytest tests/test_accounts.py— 8 new testspytest tests/— all 30 tests pass (existing tests unaffected)/dashboard/overviewaggregates correctly across accounts/dashboard/summary?account_id=Nfilters correctly