Skip to content

[ENHANCEMENT] Add pagination support to all list API endpoints #587

Description

@Prathvikmehra

Description

Several list endpoints return all records without pagination: GET /api/equipment, GET /api/maintenance, GET /api/orders, GET /api/supplier/orders, GET /api/shipments/order/{orderId}. As the database grows, these will return increasingly large JSON payloads, consume excessive memory, and eventually cause OutOfMemoryError crashes. Only GET /api/equipment/page exists, and there's no consistency in pagination interfaces across endpoints.

Proposed Solution

Backend Changes

  1. Add Pageable parameter support to each endpoint:

    • GET /api/equipment: Add Pageable param, return Page
    • GET /api/maintenance: Add Pageable param, return Page
    • GET /api/orders: Add Pageable param + filters
    • GET /api/shipments/*: Add Pageable param
  2. Create a standard PagedResponse DTO with content, page, size, totalElements, totalPages, first, last

  3. Add @PageableDefault with sensible sort ordering on all endpoints

  4. Add pagination to maintenance filter queries (currently accepts technicianId, status, priority but no pagination)

Frontend Changes

  1. Update EquipmentList with page navigation, page size selector, and X of Y display
  2. Add page/size/sort params to getAllEquipment() service call
  3. Create reusable Pagination component: src/components/common/Pagination.jsx
  4. Apply to MaintenanceSchedule, OrdersList, and TaskList

Files to Modify (20+ files)

  • Backend: EquipmentController, MaintenanceController, OrderController, ShipmentTrackingController
  • Backend: EquipmentService, MaintenanceService, OrderService
  • Backend: EquipmentRepository, MaintenanceTaskRepository, EquipmentOrderRepository
  • Backend: New PagedResponse DTO
  • Frontend: EquipmentList.jsx, MaintenanceSchedule.jsx, OrdersList.jsx, TaskList.jsx
  • Frontend: EquipmentService.js, MaintenanceService.js, OrderService.js
  • Frontend: New Pagination.jsx component

Expected Impact

  • Prevents OOM crashes at scale
  • Reduces API response times by 10-100x for large datasets
  • Consistent UX across all list views
  • Mobile-friendly with smaller payloads

Difficulty

Medium-Hard

Metadata

Metadata

Assignees

Labels

ECSoC26ECSoC 2026 InitiativeFrontendFrontend related changesbackendBackend related changesbugSomething isn't workingenhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions