Skip to content

Merchant Analytics, Portfolio and Leaderboard endpoints #132

Description

@Josue19-08

🔖 Title

Merchant Analytics, Portfolio and Leaderboard endpoints


📄 Description

merchants.controller.ts only exposes GET /merchants and GET /merchants/:id. There is no way to inspect a merchant's loan portfolio, repayment performance, or ranking against other merchants — needed for both the merchant dashboard and internal risk review.


✅ Tasks to complete

  • GET /merchants/:id/portfolio — active loans, repayment rate, volume
  • GET /merchants/:id/analytics — time-series volume, default rate, avg loan size
  • GET /merchants/leaderboard — ranked merchants by configurable metric
  • Financial score calculation service for merchants
  • Repository queries/aggregations backing the above
  • DTOs for each response shape
  • Unit tests for score calculation and aggregation logic
  • Integration tests for all new endpoints
  • Swagger documentation

📚 Documentation/context for AI

(This link never should removed)
https://github.com/TrustUp-app/TrustUp-API/tree/main/docs


🗒️ Additional notes

Greenfield — no portfolio/analytics/leaderboard logic exists today in merchants.service.ts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardThird CampaignCampaign: Third Campaign

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions