feat: goal-based savings tracking & milestones#941
Open
flaggdavid-source wants to merge 1 commit intorohitdash08:mainfrom
Open
feat: goal-based savings tracking & milestones#941flaggdavid-source wants to merge 1 commit intorohitdash08:mainfrom
flaggdavid-source wants to merge 1 commit intorohitdash08:mainfrom
Conversation
- Add SavingsGoalStatus enum and SavingsGoal, SavingsMilestone, SavingsContribution models - Add schema tables for savings_goals, savings_milestones, savings_contributions - Create savings service with create_goal(), add_contribution(), get_goal_progress(), etc. - Auto-create milestones at 25%/50%/75%/100% thresholds - Add savings routes with full CRUD + contributions + milestones endpoints - Add 21 tests covering goal CRUD, validation, contributions, auto-milestones, completion Closes rohitdash08#133
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.
Implementation Summary
Backend Changes
Models (
app/models.py):SavingsGoalStatusenum: active → completed / abandonedSavingsGoal: name, target_amount, current_amount, currency, deadline, statusSavingsMilestone: goal_id, name, target_amount, reached_atSavingsContribution: goal_id, amount, contributed_at, notesSchema (
app/db/schema.sql):savings_goal_statusenum typesavings_goals,savings_milestones,savings_contributionstables with indexesService (
app/services/savings.py):create_goal()— with auto-milestone creation at 25%/50%/75%/100% thresholdsadd_contribution()— deposit tracking with auto-completion detection_check_milestones()— marks milestones as reached when current_amount crosses thresholdget_goal_progress()— percent complete, remaining amount, days remainingmark_goal_completed()/abandon_goal()— status transitionsparse_amount()— Decimal validation for all money inputsRoutes (
app/routes/savings.py):POST /savings— create goal with validationGET /savings— list goals with optional status filterGET /savings/<id>— get goal with progress statsPATCH /savings/<id>— update goal (name, target, deadline, status)DELETE /savings/<id>— delete goal with cascading milestones/contributionsPOST /savings/<id>/contributions— add contributionGET /savings/<id>/contributions— list contributionsGET /savings/<id>/milestones— list milestonesPOST /savings/<id>/complete— manually complete goalPOST /savings/<id>/abandon— abandon goalTests
21 tests covering:
All 21 savings tests pass. Existing tests remain functional (1 pre-existing failure in auth test unrelated to these changes).