Repository navigation
Budget, stage 1: periods, groups and template (API) - #109
Merged
Merged
Conversation
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
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
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.
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 withPUT /api/v1/budget/template. Editors only. No screens yet; that is stage 2.How: the pure
BudgetSummaryin 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 schemaexpense(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