Skip to content

feat: goal-based savings tracking & milestones (bounty #133)#937

Open
alexanderxfgl-bit wants to merge 1 commit intorohitdash08:mainfrom
alexanderxfgl-bit:bounty/133-final
Open

feat: goal-based savings tracking & milestones (bounty #133)#937
alexanderxfgl-bit wants to merge 1 commit intorohitdash08:mainfrom
alexanderxfgl-bit:bounty/133-final

Conversation

@alexanderxfgl-bit
Copy link
Copy Markdown

Bounty Claim: $250 — Issue #133

Implementation

Full savings goal tracking system with auto-milestones, contributions, and progress monitoring.

Backend Changes

Models (app/models.py):

  • SavingsGoalStatus enum: active → completed / abandoned
  • SavingsGoal: name, target_amount, current_amount, currency, deadline, status
  • SavingsMilestone: goal_id, name, target_amount, reached_at
  • SavingsContribution: goal_id, amount, contributed_at, notes

Service (app/services/savings.py):

  • create_goal() — with auto-milestone creation at 25%/50%/75%/100% thresholds
  • add_contribution() — deposit tracking with auto-completion detection
  • _check_milestones() — marks milestones as reached when current_amount crosses threshold
  • get_goal_progress() — percent complete, remaining amount, days remaining
  • mark_goal_completed() / abandon_goal() — status transitions
  • parse_amount() — Decimal validation for all money inputs

Routes (app/routes/savings.py):

  • POST /savings — create goal with validation
  • GET /savings — list goals with optional status filter
  • GET /savings/<id> — get goal with progress stats
  • PATCH /savings/<id> — update goal (name, target, deadline, status)
  • DELETE /savings/<id> — delete goal with cascading milestones/contributions
  • POST /savings/<id>/contributions — add contribution
  • GET /savings/<id>/contributions — list contributions
  • GET /savings/<id>/milestones — list milestones
  • POST /savings/<id>/complete — manually complete goal
  • POST /savings/<id>/abandon — abandon goal

Schema (app/db/schema.sql):

  • savings_goals, savings_milestones, savings_contributions tables
  • savings_goal_status enum type
  • Indexes for efficient user/status and goal/contributed_at queries

Tests

12 tests covering:

  • Goal CRUD (create, list, get, delete)
  • Input validation (missing name, negative amounts)
  • Deadline handling
  • Contribution workflow (add, validate, list)
  • Auto-milestone creation (4 milestones per goal)
  • Goal completion and abandonment

Closes #133

Implements a full savings goal tracking system with auto-milestones:

- SavingsGoal model: name, target_amount, current_amount, currency, deadline, status
- SavingsMilestone model: auto-created at 25%/50%/75%/100% thresholds
- SavingsContribution model: track deposits with notes and timestamps
- Service layer: create_goal, add_contribution, milestone auto-detection, progress calc
- REST API: CRUD for goals, contributions, milestones + complete/abandon actions
- PostgreSQL schema with indexes for efficient queries
- 12 tests covering CRUD, validation, contributions, milestones, abandon

Closes rohitdash08#133
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