Skip to content

Implement Pagination and Filtering Utility Module #41

@Mkalbani

Description

@Mkalbani

Description

Create a shared common utility module that provides reusable pagination, filtering, and sorting helpers. Rather than each module implementing its own pagination logic inconsistently, a centralised utility ensures uniform API behaviour, consistent response shapes, and less duplicated code. This will be imported by puzzles, leaderboard, users, and sessions modules.

Acceptance Criteria

  • A common module is scaffolded at src/common/
  • A PaginationDto class provides page, limit, and optional sortBy/order fields
  • A paginate() utility wraps TypeORM queries and returns { data, total, page, limit, totalPages }
  • A FilterDto base class supports search and date range fields (from, to)
  • All paginated endpoints in other modules use these shared utilities
  • page defaults to 1 and limit defaults to 20 with a max of 100
  • Unit tests cover pagination math, empty results, and limit clamping

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions