Skip to content

implementation for savings goals persistence#439

Merged
Olowodarey merged 3 commits intoDevsol-01:mainfrom
Bhenzdizma:back
Mar 27, 2026
Merged

implementation for savings goals persistence#439
Olowodarey merged 3 commits intoDevsol-01:mainfrom
Bhenzdizma:back

Conversation

@Bhenzdizma
Copy link
Copy Markdown
Contributor

This PR completes the requested implementation for savings goals persistence and verifies that the required Soroban contract read functionality is already in place.

In addition to the new database migration, this PR includes a small code quality fix in the indexer service and confirms that the relevant backend and blockchain-read components already satisfy the requested requirements.


✅ What Was Already Implemented

SavingsGoal entity

The SavingsGoal entity already exists in savings-goal.entity.ts with the required structure, including:

  • id
  • userId
  • goalName
  • targetAmount
  • targetDate
  • status

It also includes:

  • a JSONB metadata column for frontend customization
    • imageUrl
    • iconRef
    • color
  • proper TypeORM decorators
  • correct entity relationships
  • registration in SavingsModule

Soroban contract reads

Soroban read support was already implemented in stellar.service.ts through invokeContractRead().

The existing implementation already provides:

  • functional contract read execution
  • RpcClientWrapper failover and retry support
  • dynamic fallback RPC URL handling
  • proper SorobanRpc.Server instantiation
  • XDR scVal response parsing to JavaScript primitives via scValToNative()
  • comprehensive error handling

✨ What Was Implemented in This PR

Database migration

Added 1775100000000-CreateSavingsGoalsTable.ts to create the savings_goals table with the required schema.

This migration includes:

  • creation of the savings_goals table
  • foreign key relationship to users
  • CASCADE delete behavior
  • performance indexes on:
    • userId
    • status
    • targetDate
  • JSONB metadata column for flexible frontend customization

Code quality fix

Updated indexer.service.ts to fix an ESLint issue:

  • resolved no-unused-expressions
  • replaced a ternary expression with an explicit if / else block

🧪 Validation Results

All checks passed successfully:

  • Linting: ✅ No errors
  • Build: ✅ Successful compilation
  • Tests: ✅ 29 test suites passed
  • Tests: ✅ 166 tests passed

📦 Outcome

This PR ensures that savings goals are now fully backed by a database migration, while also confirming that the required entity model and Soroban contract read infrastructure were already correctly implemented.

The result is:

  • persistence support for savings goals
  • verified Soroban read-path readiness
  • cleaner code quality in the indexer service
  • a passing lint/build/test pipeline

🔄 Breaking Changes

None.

This PR is additive and corrective only. Existing functionality remains intact.

closes #399
closes #400

Replace ternary expression statement with explicit if-else block
to comply with @typescript-eslint/no-unused-expressions rule.
Create migration to support SavingsGoal entity with:
- UUID primary key with auto-generation
- Foreign key to users table with CASCADE delete
- Goal parameters (name, target amount, target date)
- Status enum (IN_PROGRESS, COMPLETED)
- JSONB metadata column for frontend-controlled display data
- Audit timestamps (createdAt, updatedAt)
- Performance indexes on userId, status, and targetDate

This enables users to set localized savings goals ("Buy a Car",
"Summer Vacation") connected to their yield pools.
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
nestera Ready Ready Preview, Comment Mar 27, 2026 9:57am

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 27, 2026

@Bhenzdizma Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Olowodarey Olowodarey merged commit f88898c into Devsol-01:main Mar 27, 2026
4 checks passed
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.

[Backend] Extend stellar.service.ts for Soroban Contract Reads [Backend] Design & Implement SavingsGoal TypeORM Entity

2 participants