InPactAI icon indicating copy to clipboard operation
InPactAI copied to clipboard

FEATURE REQUEST: Add API Pagination to Backend List Endpoints

Open sharma-sugurthi opened this issue 9 months ago • 2 comments

Is your feature request related to a problem?

  • [x] Yes, it is related to a problem

Describe the feature you'd like

🌟 Feature Description

Add pagination support to all backend list endpoints (/users/, /sponsorships/, /posts/, /sponsorship-applications/, /collaborations/) to prevent performance degradation as the database grows.

🔍 Problem Statement

Currently, all list endpoints fetch ALL records from the database without any pagination limits. For example:

@router.get("/users/")
async def get_users():
    result = supabase.table("users").select("*").execute()  # Returns every user!
    return result

As the platform scales to hundreds/thousands of users, sponsorships, and posts, this will cause:

  • Severe database performance issues
  • Network timeouts on the frontend
  • High memory consumption on both client and server
  • Poor user experience with infinite scroll loading

🎯 Expected Outcome

All list endpoints should support pagination with:

  • Query parameters: skip (offset) and limit (items per page)
  • Default values: skip=0, limit=50
  • Maximum limit: 100 items per request
  • Response should include: - data: Array of items - total: Total count of items - has_more: Boolean indicating if more items exist - skip: Current offset - limit: Items per page

Record

  • [x] I agree to follow this project's Code of Conduct
  • [x] I want to work on implementing this feature

sharma-sugurthi avatar Mar 01 '26 08:03 sharma-sugurthi

Hi! I would like to work on implementing pagination for these endpoints. Could you please assign this issue to me if it's still available?

Divine-P-77777 avatar Mar 05 '26 08:03 Divine-P-77777

Hi! I'd love to work on this issue for GSoC 2026. Could you assign it to me?

alphacoder-hash avatar Mar 30 '26 05:03 alphacoder-hash