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 for GET /progreses API #2325

Conversation

AnujChhikara
Copy link
Contributor

@AnujChhikara AnujChhikara commented Dec 29, 2024

Date: 29 Dec 2024

Developer Name: @AnujChhikara


Issue Ticket Number

Description

This PR introduces pagination support for the GET /progreses API, aimed at improving the performance and scalability when dealing with large datasets. The feature is currently gated behind a development flag for testing. By default, the size is set to 100 items per page.
Additionally, the API response includes links for easy navigation between pages (prev and next links).

Pagination Parameters:

Introduced support for page and size query parameters in the GET /progreses API.
page: The page number to retrieve (defaults to 0 if not specified).
size: The number of items per page. The size can be a value between 1 and 100. If not specified, it defaults to 100.

Pagination Links:

Included prev and next links in the response to allow easy navigation between pages:
prev: URL to the previous page (if applicable).
next: URL to the next page (if applicable).

Changes

Documentation Updated?

  • Yes
  • No

Under Feature Flag

  • Yes
  • No

Database Changes

  • Yes
  • No

Breaking Changes

  • Yes
  • No

Development Tested?

  • Yes
  • No

Screenshots

Screenshot 1
pagination.mp4

Test Coverage

Screenshot 1

image
image

Additional Notes

{
    "message": "Progress document retrieved successfully.",
    "count": 1,
    "data": [
        {
            "id": "m7Z9MhIKD3uHZRzNgTpq",
            "type": "task",
            "taskId": "ytxKmLKh0To7bPfGJ4Fk",
            "completed": "Working on a backend Go project",
            "planned": "Implement error handling for API endpoints",
            "blockers": "Waiting for database access credentials",
            "userId": "bbbDuABnkSL4b5FFVite",
            "createdAt": 1735468639619,
            "date": 1735430400000
        }
    ],
    "links": {
        "prev": "/progresses?type=task&page=0&size=1&dev=true",
        "next": "/progresses?type=task&page=2&size=1&dev=true"
    }
}
  • I opted to create separate functions for pagination instead of modifying the existing one. This approach makes it easier to remove the 'dev' flag later on.

controllers/progresses.js Outdated Show resolved Hide resolved
models/progresses.js Outdated Show resolved Hide resolved
@Achintya-Chatterjee Achintya-Chatterjee changed the title Implement Pagination for GET /progreses API feat: Implement Pagination for GET /progreses API Jan 1, 2025
models/progresses.js Outdated Show resolved Hide resolved
utils/progresses.js Outdated Show resolved Hide resolved
controllers/progresses.js Outdated Show resolved Hide resolved
models/progresses.js Outdated Show resolved Hide resolved
utils/progresses.js Outdated Show resolved Hide resolved
@vinit717
Copy link
Member

video is not working and can you please add more progreses

@AnujChhikara
Copy link
Contributor Author

video is not working and can you please add more progreses

Hello @vinit717 video is working for me but i have also added a second video when free please check

@vinit717
Copy link
Member

can you add test coverage screenshot not test passing

@AnujChhikara
Copy link
Contributor Author

can you add test coverage screenshot not test passing

Hello @vinit717 this is the test PR for this code changes Test PR

@iamitprakash iamitprakash merged commit cbd992a into Real-Dev-Squad:develop Jan 22, 2025
3 checks passed
@AnujChhikara AnujChhikara deleted the feature/pagination-get-progresses-api branch January 22, 2025 12:18
@pankajjs pankajjs mentioned this pull request Jan 23, 2025
10 tasks
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.

Implement Pagination with Limit for getProgressDocument
6 participants