Skip to content

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

Open
wocaoac-cpu wants to merge 1 commit intorohitdash08:mainfrom
wocaoac-cpu:feat/savings-goals
Open

feat: Goal-based savings tracking & milestones (#133)#773
wocaoac-cpu wants to merge 1 commit intorohitdash08:mainfrom
wocaoac-cpu:feat/savings-goals

Conversation

@wocaoac-cpu
Copy link
Copy Markdown

Summary

Closes #133

  • Models: SavingsGoal and SavingsGoalMilestone with status tracking (ACTIVE/COMPLETED/CANCELLED), progress calculation, and automatic milestone detection
  • Service layer (services/savings_goals.py): Full CRUD, contribute/withdraw operations, auto-milestone checking, auto-completion at 100%
  • REST API (routes/savings.py): 7 endpoints under /savings-goals — list (with status filter), get, create, update, delete (cancel), contribute, withdraw
  • Default milestones at 25%, 50%, 75%, 100% — or supply custom milestones at creation time
  • 15 tests covering all endpoints, validation, milestone progression, edge cases (cancelled goals, insufficient funds, currency defaults)
  • OpenAPI 3.0 docs updated with all new paths and schemas

Endpoints

Method Path Description
GET /savings-goals List goals (optional ?status= filter)
POST /savings-goals Create goal with optional custom milestones
GET /savings-goals/:id Get goal details with milestones & progress
PATCH /savings-goals/:id Update goal (name, target, currency, date)
DELETE /savings-goals/:id Cancel goal (soft delete)
POST /savings-goals/:id/contribute Add savings, auto-check milestones
POST /savings-goals/:id/withdraw Withdraw funds (with balance check)

Test plan

  • Unit tests for all CRUD operations
  • Milestone auto-detection on contributions
  • Auto-completion when reaching 100%
  • Validation: missing fields, negative amounts, zero amounts
  • Cannot contribute/update cancelled goals
  • Withdrawal with insufficient funds rejection
  • Status filtering
  • Currency defaults to user preferred currency
  • Days remaining calculation

Note: Existing test suite requires a running Redis instance for the auth fixture (_store_refresh_session). This is a pre-existing infrastructure requirement, not introduced by this PR.

Add complete savings goals feature with:
- SavingsGoal and SavingsGoalMilestone models with status tracking
- Service layer: CRUD, contributions, withdrawals, auto milestone detection
- REST API: GET/POST /savings-goals, PATCH/DELETE /savings-goals/:id,
  POST contribute/withdraw endpoints
- Default milestones at 25%, 50%, 75%, 100% with custom override support
- Auto-completion when goal reaches 100%
- Filter goals by status (ACTIVE/COMPLETED/CANCELLED)
- 15 comprehensive tests covering all endpoints and edge cases
- OpenAPI 3.0 documentation for all new endpoints and schemas
@wocaoac-cpu wocaoac-cpu requested a review from rohitdash08 as a code owner April 4, 2026 02:51
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