Skip to content

Reward Controller & Routes - #38

Merged
3m1n3nc3 merged 8 commits into
learnault:mainfrom
RUKAYAT-CODER:feat-reward-controller
Mar 8, 2026
Merged

Reward Controller & Routes#38
3m1n3nc3 merged 8 commits into
learnault:mainfrom
RUKAYAT-CODER:feat-reward-controller

Conversation

@RUKAYAT-CODER

Copy link
Copy Markdown
Contributor

Implementation of Reward Controller & Routes

Files Created:
src/controllers/reward.controller.ts
src/routes/v1/rewards.routes.ts Route definitions
tests/unit/reward.service.test.ts
tests/unit/reward.controller.test.ts
Files Enhanced:
src/services/reward.service.ts - Added balance, history, withdrawal methods
src/routes/index.ts - Registered reward routes
🎯 Three Main Endpoints
1️⃣ GET /api/v1/rewards/balance
json
{
"available": 15.5,
"pending": 0,
"lifetime": 25.0
}
2️⃣ GET /api/v1/rewards/history
Filter by type, status, date range
Pagination support (limit/offset)
Sorted newest first
3️⃣ POST /api/v1/rewards/withdraw
Validates Stellar wallet address
Checks sufficient balance
Processes via Stellar blockchain
Tracks transaction status
🧪 Test Results
Reward calculation
Balance tracking
Transaction history
Withdrawal processing
Validation

✨ Key Features
✅ Real-time balance calculation
✅ Transaction status tracking (pending/completed/failed)
✅ Comprehensive input validation
✅ Stellar payment integration
✅ Error handling & logging
✅ Authentication required
✅ Pagination & filtering

Acceptance Criteria

✅ Balance reflects completed module rewards
✅ History shows all transactions with details
✅ Withdrawals recorded with proper status
✅ Sufficient balance validation
✅ Pagination works
✅ Date/type filtering works

close #7

@3m1n3nc3

3m1n3nc3 commented Mar 7, 2026

Copy link
Copy Markdown
Contributor

Please resolve the conflicts.

@RUKAYAT-CODER

Copy link
Copy Markdown
Contributor Author

conflict resolved

@3m1n3nc3

3m1n3nc3 commented Mar 8, 2026

Copy link
Copy Markdown
Contributor

Your code fails linting test, please run pnpm lint --fix to resolve these, you can manually resolve the ones that don't go away automatically.

@RUKAYAT-CODER

Copy link
Copy Markdown
Contributor Author

Lint errors fixed

@3m1n3nc3

3m1n3nc3 commented Mar 8, 2026

Copy link
Copy Markdown
Contributor
image

There're still a couple of them.
Sorry fo the stress, but we want to ensure that all commits meet our project's standards.

@RUKAYAT-CODER

Copy link
Copy Markdown
Contributor Author

ok lint error fixed

@3m1n3nc3
3m1n3nc3 merged commit c23fdbf into learnault:main Mar 8, 2026
1 check 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.

Reward Controller & Routes

2 participants