Skip to content

feat(loans): add GET /api/v1/loans/stats endpoint#47

Merged
EmeditWeb merged 1 commit into
StepFi-app:mainfrom
Mmesolove:feat/loan-stats-endpoint
Jun 17, 2026
Merged

feat(loans): add GET /api/v1/loans/stats endpoint#47
EmeditWeb merged 1 commit into
StepFi-app:mainfrom
Mmesolove:feat/loan-stats-endpoint

Conversation

@Mmesolove

@Mmesolove Mmesolove commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Closes #20

Summary

Adds a protocol-wide loan statistics endpoint for the web app explorer page.

Changes

  • GET /api/v1/loans/stats — no auth required
  • LoanStatsResponseDto with full Swagger @ApiProperty decorators
  • LoansService.getStats() aggregates counts and volume from the loans table in a single query

Response shape

{
  "totalLoans": 120,
  "activeLoans": 45,
  "repaidLoans": 70,
  "defaultedLoans": 5,
  "totalVolume": 98500.00,
  "onTimeRepaymentRate": 93.5
}

Checks

  • npm run build passes
  • All 185 tests pass
  • Swagger decorator added
  • No auth guard on the endpoint

- Add LoanStatsResponseDto with full Swagger decorators
- Add LoansService.getStats() querying loans table for aggregated counts
- Add unauthenticated GET /api/v1/loans/stats controller endpoint
- Returns totalLoans, activeLoans, repaidLoans, defaultedLoans,
  totalVolume, and onTimeRepaymentRate
@Mmesolove

Copy link
Copy Markdown
Contributor Author

please review.

@EmeditWeb EmeditWeb merged commit eb587d8 into StepFi-app:main Jun 17, 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.

feat: add GET /loans/stats endpoint for protocol metrics

2 participants