Skip to content

feat: Goal-based savings tracking & milestones (#133)#619

Open
DeekRoumy wants to merge 1 commit intorohitdash08:mainfrom
DeekRoumy:feat/goal-savings-tracking
Open

feat: Goal-based savings tracking & milestones (#133)#619
DeekRoumy wants to merge 1 commit intorohitdash08:mainfrom
DeekRoumy:feat/goal-savings-tracking

Conversation

@DeekRoumy
Copy link

Summary

Closes #133

Implements full goal-based savings tracking with milestone detection.

What's included

Backend (Flask + SQLAlchemy)

New models ():

  • SavingsGoal — name, target_amount, current_amount, currency, deadline, status
  • SavingsMilestone — label, target_pct (0–100), reached, reached_at
  • SavingsDeposit — amount, note, deposited_at

New endpoints (/goals):

Method Path Description
GET /goals List goals (supports ?status= filter)
POST /goals Create goal (with optional auto 25/50/75/100% milestones)
GET /goals/{id} Get single goal with milestones
PATCH /goals/{id} Update name/target/deadline/status
DELETE /goals/{id} Delete goal
POST /goals/{id}/deposit Deposit funds, auto-syncs milestones, auto-completes goal
GET /goals/{id}/deposits List deposit history
POST /goals/{id}/milestones Add custom milestone
DELETE /goals/{id}/milestones/{ms_id} Remove milestone

DB migration (app/db/schema.sql):

  • savings_goals, savings_milestones, savings_deposits tables

Tests (21 passing, all existing 22 still pass)

  • Full CRUD coverage
  • Deposit accumulation & auto-completion when target reached
  • Milestone reached detection & response payload
  • Blocked deposit on cancelled goals
  • User isolation (User B cannot access User A's goals)
  • Uses fakeredis for CI-friendly testing (no real Redis required)

Acceptance Criteria

  • Production ready implementation
  • Includes tests (21 new tests, 100% passing)
  • Documentation inline via docstrings and OpenAPI-compatible route structure

Implements full goal savings tracking feature:

Backend (Flask/SQLAlchemy):
- SavingsGoal, SavingsMilestone, SavingsDeposit models
- Full CRUD endpoints at /goals (list, create, get, update, delete)
- Deposit endpoint POST /goals/{id}/deposit with auto milestone detection
- GET /goals/{id}/deposits — deposit history
- POST /goals/{id}/milestones — add custom milestone
- DELETE /goals/{id}/milestones/{id} — remove milestone
- Auto-generated 25/50/75/100% milestones on goal creation
- Goal auto-completes (status=COMPLETED) when target reached
- Status filter: GET /goals?status=active
- Full user isolation (users cannot see each other's goals)

DB:
- savings_goals, savings_milestones, savings_deposits tables added to schema.sql

Tests (21 passing):
- Full CRUD coverage
- Deposit accumulation & auto-completion
- Milestone reached detection on deposit
- Deposit blocked for cancelled goals
- User isolation between accounts
- fakeredis patch for CI-friendly testing (no real Redis needed)

Resolves rohitdash08#133
@DeekRoumy DeekRoumy requested a review from rohitdash08 as a code owner March 23, 2026 01:05
@DeekRoumy
Copy link
Author

Hi! Just checking in on this PR — it's been over 12 hours since submission. Happy to address any feedback or make adjustments if needed. Looking forward to your review! 🙏

@DeekRoumy
Copy link
Author

Hi again! Just checking in — it's now been about 36 hours since the last follow-up. This PR implements goal-based savings tracking as requested in issue #133 and is merge-ready. Happy to make any adjustments if needed. Thanks for your consideration! 🙏

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.

Goal-based savings tracking & milestones

1 participant