feat: goal-based savings tracking & milestones#1071
Open
Entr0zy wants to merge 1 commit into
Open
Conversation
Implements production-ready savings goal tracking with full milestone recording, resolving issue rohitdash08#133. New model additions (models.py): - SavingsGoal — user-scoped goal with target_amount, current_amount, target_date, status (ACTIVE / COMPLETED / ABANDONED), currency - GoalDeposit — deposit ledger entry per goal - GoalMilestone — auto-recorded when 25 / 50 / 75 / 100% is crossed New service (app/services/savings.py): - create_goal / get_goals / get_goal / update_goal / delete_goal - deposit() — credits amount, auto-completes goal at target, triggers _record_new_milestones() (idempotent, no duplicates) - goal_to_dict() — serialises goal with progress_pct New routes (app/routes/savings.py): - GET /savings/goals - POST /savings/goals - GET /savings/goals/<id> - PATCH /savings/goals/<id> - DELETE /savings/goals/<id> → 204 No Content - POST /savings/goals/<id>/deposit - GET /savings/goals/<id>/milestones Tests (tests/test_savings.py — 28 tests): - Auth gates, create (happy + 3 error paths), list/get, update, delete, deposits (happy + invalid + auto-complete + post-complete rejection), milestones (empty, partial, all-4, no-duplicates), service-layer unit test Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
/claim #133
What this PR adds
A complete Goal-Based Savings Tracking & Milestones system, fulfilling all acceptance criteria in issue #133.
Changes
packages/backend/app/models.py(modified)Three new models appended:
SavingsGoalname,target_amount,current_amount,target_date,status(ACTIVE/COMPLETED/ABANDONED),currencyGoalDepositGoalMilestonepackages/backend/app/services/savings.py(new)create_goal(uid, data)get_goals(uid)get_goal(uid, goal_id)update_goal(uid, goal_id, data)delete_goal(uid, goal_id)deposit(uid, goal_id, amount, note)get_milestones(uid, goal_id)goal_to_dict(goal)progress_pctpackages/backend/app/routes/savings.py(new)GET /savings/goalsPOST /savings/goalsGET /savings/goals/<id>PATCH /savings/goals/<id>DELETE /savings/goals/<id>POST /savings/goals/<id>/depositGET /savings/goals/<id>/milestonesModified:
packages/backend/app/routes/__init__.pyRegisters
savingsblueprint at/savings.packages/backend/tests/test_savings.py(new — 28 tests)Auth gates, create (happy + 3 error paths), list/get, update, delete, deposits (happy + invalid amount + auto-complete + post-complete rejection), milestones (empty, partial, all four, no-duplicates), service-layer unit test.
Verification
🤖 Generated with Claude Code