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 findAllTeamMembers Endpoint #1229

Open
6 tasks
akinwalexander opened this issue Feb 27, 2025 · 0 comments · May be fixed by #1312
Open
6 tasks

[FEAT]: Implement Pagination on findAllTeamMembers Endpoint #1229

akinwalexander opened this issue Feb 27, 2025 · 0 comments · May be fixed by #1312

Comments

@akinwalexander
Copy link

Description

The findAllTeamMembers endpoint currently retrieves all team members from the database without any pagination. This could lead to performance issues and increased database load if there are a large number of team members. Implementing pagination will enhance efficiency and scalability.

Acceptance Criteria

  • The findAllTeamMembers endpoint should accept optional page and limit query parameters.
  • The TeamMemberService.findAllTeamMembers method should use page and limit parameters to implement pagination using skip and take (or equivalent ORM methods).
  • The API should return a paginated response with a subset of team members based on the page and limit parameters.
  • API documentation (Swagger) should be updated to reflect the new page and limit parameters for the findAllTeamMembers endpoint.
  • Default values for page and limit should be defined (e.g., page=1, limit=10) if the parameters are not provided in the request.
  • Implement a method to get the total number of team members available.

Purpose

Implementing pagination for the findAllTeamMembers endpoint will improve the performance and scalability of the application by reducing the amount of data retrieved from the database and transmitted over the network. This is especially important when dealing with a large number of team members.

Requirements

  • Modify the findAllTeamMembers method in TeamMemberController to accept optional page and limit query parameters.
  • Modify the findAllTeamMembers method in TeamMemberService to use the page and limit parameters to implement pagination using skip and take.
  • Update the API documentation (Swagger) to reflect the new page and limit parameters.
  • Ensure that the existing functionality of findAllTeamMembers remains intact when page and limit parameters are not provided.
  • Update DTOs to include the total number of team members found.

Expected Outcome

The findAllTeamMembers endpoint will return a paginated response with a subset of team members based on the page and limit parameters. The API documentation will be updated to reflect the new parameters, improving performance and scalability.

The JSON response should follow a uniform API format:

{
    "status": "success",
    "status_code": 200,
    "message": "Team members retrieved successfully",
    "data": {
        "team_members": [
            {
                "id": "123e4567-e89b-12d3-a456-426614174000",
                "name": "John Doe",
                "role": "Developer"
            },
            {
                "id": "89abcdef-9012-3456-7890-1234567890ab",
                "name": "Jane Smith",
                "role": "Designer"
            }
        ],
        "total": 150
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Mentors Approved
2 participants