Skip to content

feat(api): implement pagination for NCERT chapter browsing endpoints (#526) - #533

Open
Rajen5145 wants to merge 1 commit into
MRIARC-08:mainfrom
Rajen5145:feat/ncert-chapter-pagination
Open

feat(api): implement pagination for NCERT chapter browsing endpoints (#526)#533
Rajen5145 wants to merge 1 commit into
MRIARC-08:mainfrom
Rajen5145:feat/ncert-chapter-pagination

Conversation

@Rajen5145

Copy link
Copy Markdown

Closes #526

Overview

Implements database-level pagination for NCERT chapter browsing endpoints to ensure scalable performance, prevent slow load times, and reduce frontend rendering overhead as the academic structure seed data grows.

Summary of Changes

  • Database Query & Pagination:
    • Utilized Prisma's skip (offset) and take (limit) methods in NcertRepository.getChapters to fetch chapter results in paginated chunks.
    • Added structured pagination metadata including currentPage, totalItems, totalPages, limit, and total.
  • API Standardization:
    • Handled page and limit query parameters with fallback defaults (page=1, limit=20) to prevent unconstrained full-table scans.
  • Frontend Data Fetching:
    • Updated NCERT browsing endpoints in src/app/ncert/[class]/[subject]/page.tsx and src/app/ncert/[class]/[subject]/[chapter]/page.tsx to pass default pagination query parameters (?page=1&limit=20).

Testing & Verification

  • Verified that API responses return proper metadata matching the total database count.
  • Verified backwards compatibility with existing UI components consuming chapter data.

@vercel

vercel Bot commented Aug 23, 2026

Copy link
Copy Markdown

@Rajen5145 is attempting to deploy a commit to the Adarsh's projects Team on Vercel.

A member of the Team first needs to authorize it.

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(api): implement pagination for NCERT chapter browsing endpoints

1 participant