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

Implement Pagination for Asset Retrieval #66

Merged
merged 10 commits into from
Nov 27, 2023
Merged

Conversation

wjuniorbh92
Copy link
Contributor

Summary:
This PR introduces pagination to the asset retrieval functionality in our system. It modifies the AssetRepo to include a GetPaginated method, allowing the API to fetch assets in a paginated format. This enhancement aims to improve performance and usability, especially when dealing with a large number of assets.

Key Changes:

  1. Pagination in Asset Retrieval:

    • Added GetPaginated method to AssetRepo which fetches assets based on the provided page number and limit per page.
    • Implemented SQL LIMIT and OFFSET clauses in the query to facilitate pagination.
    • Calculated the offset based on the current page number and the number of records per page.
  2. API Endpoint Adjustment:

    • Modified the /assets endpoint to support pagination parameters: page and limit.
    • Ensured backward compatibility - when pagination parameters are not provided, the endpoint returns all assets.
  3. Error Handling and Edge Cases:

    • Added checks for edge cases, such as negative page numbers or limits.
    • Included comprehensive error handling to capture and respond to any issues during the database query execution.

@wjuniorbh92 wjuniorbh92 added the enhancement New feature or request label Nov 13, 2023
@wjuniorbh92 wjuniorbh92 self-assigned this Nov 13, 2023
@lucasmagnus lucasmagnus merged commit 036d35e into dev Nov 27, 2023
3 checks passed
@lucasmagnus lucasmagnus deleted the FEAT-add_pagination_assets branch November 27, 2023 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants