Description
Create a reusable pagination utility service that standardizes paginated responses across all list endpoints. Implement PaginatedResponse interface with data, meta: { page, limit, total, totalPages, hasNext, hasPrev }. Create service method paginate(queryBuilder, page, limit, options) that automatically applies skip, take, and returns properly formatted response. Support cursor-based pagination for large datasets (alternative to offset/limit). Include helper for generating pagination links (first, prev, next, last).
Acceptance Criteria
Standardized pagination response format across all list endpoints
Utility method accepts TypeORM QueryBuilder or repository
Offset/limit pagination implemented with proper counting
Cursor-based pagination optional for high-performance scenarios
Max limit enforced (configurable, default 100)
Unit tests for edge cases: page beyond total, negative page, invalid limit
Swagger documentation includes pagination parameters
Description
Create a reusable pagination utility service that standardizes paginated responses across all list endpoints. Implement PaginatedResponse interface with data, meta: { page, limit, total, totalPages, hasNext, hasPrev }. Create service method paginate(queryBuilder, page, limit, options) that automatically applies skip, take, and returns properly formatted response. Support cursor-based pagination for large datasets (alternative to offset/limit). Include helper for generating pagination links (first, prev, next, last).
Acceptance Criteria
Standardized pagination response format across all list endpoints
Utility method accepts TypeORM QueryBuilder or repository
Offset/limit pagination implemented with proper counting
Cursor-based pagination optional for high-performance scenarios
Max limit enforced (configurable, default 100)
Unit tests for edge cases: page beyond total, negative page, invalid limit
Swagger documentation includes pagination parameters