Skip to content

Budget, stage 1: periods, groups and template (API) - #109

Merged
Frognar merged 2 commits into
mainfrom
claude/project-thread-bi7dnf
Oct 3, 2026
Merged

Frognar merged 2 commits into
mainfrom
claude/project-thread-bi7dnf

Conversation

@Frognar

@Frognar Frognar commented Oct 3, 2026

Copy link
Copy Markdown
Owner

Requested by Frognar · project thread

Before: the monthly budget lived in a spreadsheet, apart from the receipts.

After: the API keeps budget periods (pay day to the day before the next). Each period has funds (incomes and changes, negative for savings) and planned expenses in budget groups. Receipt categories are assigned to groups, so spending comes straight from receipts. GET /api/v1/budget/periods/{id} (and /current) returns each group's plan and spending, spending outside any group, the free pool (roughly what is left at the end) and an amount per remaining day. New periods copy a template, which is replaced as a whole with PUT /api/v1/budget/template. Editors only. No screens yet; that is stage 2.

How: the pure BudgetSummary in the domain does the math. A group takes its plan or its spending, whichever is larger, so overspending and groups without a plan come out of the free pool. New tables in schema expense (budget_groups, budget_categories, budget_periods, budget_funds, budget_items); rows without a period are the template. Renaming a category in the dictionaries keeps it in its budget group. Periods never overlap, and a period without a start follows the last one.

Tested: 174 tests (domain math plus API tests, each on its own database). Also checked by hand against a local Postgres: the owner's template reproduces the spreadsheet's balance once the one-off items are left out.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NPSUHkaJ2a5Qr3MBZAz2oN


Generated by Claude Code

A budget period runs from pay day to the day before the next and holds
its funds (incomes and changes, negative for savings) and planned
expenses grouped into budget groups. Receipt categories are assigned to
groups, so spending comes straight from receipts. The summary shows each
group's plan and spending, spending outside any group, the free pool and
what is left per day. New periods copy the template. Editors only.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NPSUHkaJ2a5Qr3MBZAz2oN
@Frognar Frognar self-assigned this Oct 3, 2026
Shows the free pool, what is left per day, funds, planned and spent
totals, and every budget group with a bar of spending against its plan.
A group opens to its planned expenses and a link to the receipt items
behind it. Incomes, changes and planned expenses are edited in dialogs;
a new period starts from the template. Editors see it as a fourth item
in the navigation.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NPSUHkaJ2a5Qr3MBZAz2oN
@Frognar
Frognar merged commit a3c15e3 into main Oct 3, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants