Skip to content

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

Description

@EmeditWeb

Problem

There is no endpoint returning protocol-wide loan
statistics. The web app explorer page needs this
to show total loans, active loans, repaid loans,
and total volume.

What To Build

Add GET /api/v1/loans/stats endpoint.
No auth required.

Response:
{
totalLoans: number,
activeLoans: number,
repaidLoans: number,
defaultedLoans: number,
totalVolume: number,
onTimeRepaymentRate: number
}

Query Supabase loans table for aggregated counts.

Files To Touch

  • src/modules/loans/loans.controller.ts
  • src/modules/loans/loans.service.ts

Acceptance Criteria

  • Endpoint returns correct aggregated stats
  • No auth required
  • Full Swagger documentation
  • Response matches TypeScript interface
  • npm run build passes

Mandatory Checks Before PR

  • npm run build passes
  • Swagger decorator added
  • PR references this issue

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions