Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Implement pagination on find all invitations endpoint #1262

Conversation

G4EVA-dev
Copy link
Contributor

@G4EVA-dev G4EVA-dev commented Feb 28, 2025

Pull Request for implementing pagination on find all invitations endpoint

Description

This PR implements pagination for the findAllInvitations endpoint in the InviteController. The endpoint now accepts optional page and limit query parameters to retrieve a paginated list of invitations. This improves performance and scalability, especially when dealing with a large number of invitations.

Related Issue

Fixes #1243

Type of Change

  • feat: New feature
  • fix: Bug fix
  • docs: Documentation updates
  • style: Code style/formatting changes
  • refactor: Code refactoring
  • perf: Performance improvements
  • test: Test additions/updates
  • chore: Build process or tooling changes
  • ci: CI configuration changes
  • other:

How Has This Been Tested?

  • Unit tests
  • Integration tests
  • Manual tests

Unit Tests
Added unit tests for the findAllInvitations endpoint to verify:
Default pagination behavior (page=1, limit=10).
Custom pagination parameters (page and limit).
Response format and data correctness.

Manual Tests
Tested the endpoint using SwaggerUI and POSTMAN to ensure it returns the correct paginated response.

Test Evidence

Screenshots (if applicable)

Screenshot from 2025-02-28 12-05-35

image

Documentation Screenshots (if applicable)

SWAGGERUI BEFORE FIX:
Screenshot from 2025-02-28 10-46-03

SWAGGERUI AFTER FIX:
Screenshot from 2025-02-28 11-12-50

Checklist

  • My code follows the project's coding style
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published
  • I have included a screenshot showing all tests passing
  • I have included documentation screenshots (if applicable)

Additional Notes

The pagination implementation uses skip and take methods provided by TypeORM to fetch the correct subset of invitations.
Default values for page and limit are set to 1 and 10, respectively, if not provided in the request.
The response format has been standardized to include the total number of invitations for better client-side handling.

@G4EVA-dev G4EVA-dev changed the title Feat implement pagination on find all invitations endpoint Feat: Implement pagination on find all invitations endpoint Feb 28, 2025
@TheCodeGhinux TheCodeGhinux merged commit a0322c4 into hngprojects:dev Mar 2, 2025
1 check passed
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] Implementing Pagination on findAllInvitations Endpoint
4 participants