-
Notifications
You must be signed in to change notification settings - Fork 219
feat: Add Pagination Support to GET /api/v1/activity-log Endpoint #1197 #1223
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
base: dev
Are you sure you want to change the base?
Conversation
merge dev to main
Update cd.prod.yaml
|
Resolve the merge conflict |
phurhard
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implement the changes requested
.gitignore
Outdated
| # Ignore environment files | ||
| .env | ||
| .env.* | ||
| .ven | ||
| .venv | ||
| env | ||
| alembic/env.py | ||
|
|
||
| # Ignore environment and virtual environment files | ||
| .env | ||
| .env.* | ||
| .ven | ||
| .venv | ||
| env | ||
| alembic/env.py | ||
|
|
||
| # Ignore environment and virtual environment files | ||
| .env | ||
| .env.* | ||
| .ven | ||
| .venv | ||
| env | ||
| alembic/env.py | ||
|
|
||
| # Ignore environment and virtual environment files | ||
| .env | ||
| .env.* | ||
| .ven | ||
| .venv | ||
| env | ||
| alembic/env.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the repitions??
README.md
Outdated
| **Starting the database** | ||
| after cloning the database, dont run | ||
| `alembic revision --autogenerate -m 'initial migration'` | ||
| `embic revision --autogenerate -m al'initial migration'` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert this
| """Get paginated activity logs""" | ||
| activity_logs = activity_log_service.fetch_all(db=db, page=page, limit=limit) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just passing the page and page limits doesn't mean it's reflected in the implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this deleted, revert it
Description
The current
GET /api/v1/activity-logsendpoint returns all activity logs in a single response, which can lead to performance issues and overly large payloads as the number of logs grows. This enhancement introduces pagination support, allowing clients to fetch logs in manageable chunks.Related Issue (Link to issue ticket)
[Issue #1115](#1115)
Motivation and Context
How Has This Been Tested?
Manual API Testing
Default Pagination:
Sent a GET request to /api/v1/activity-logs without any parameters.
Verified that the response included 20 logs (if available) and the correct pagination metadata.
Custom Pagination:
Sent a GET request to /api/v1/activity-logs?page=2&limit=10.
Confirmed that the response included the correct subset of logs corresponding to page 2 and limit 10, along with accurate pagination metadata.
Edge Case Testing:
Tested scenarios such as negative page values, excessively high limits, and requests for pages beyond the available data.
Verified that appropriate validation errors or empty results were returned.
Testing Steps
Default Pagination:
GETrequest to/api/v1/activity-logswithout any parameters.Custom Pagination:
Send a
GETrequest to/api/v1/activity-logs?page=2&limit=10.Confirm that the response includes the correct subset of logs corresponding to page 2 and limit 10, along with accurate pagination metadata.
Screenshots (if appropriate - Postman, etc):
Types of Changes
Checklist
Proposed Solution
The endpoint should support pagination with the following changes:
Query Parameters:
page(optional, default: 1) - Specifies the page number.limit(optional, default: 20) - Specifies the number of logs per page.Response Structure:
The response should include a pagination object containing:
page: The current page number.limit: The number of logs per page.total_items: The total number of activity logs.total_pages: The total number of pages based on the limit.Default Behavior:
Expected JSON Response Format:
{ "status": "success", "status_code": 200, "message": "Activity logs retrieved successfully", "data": { "logs": [ /* array of activity logs */ ], "pagination": { "page": 1, "limit": 20, "total_items": 100, "total_pages": 5 } } }Acceptance Criteria
pageandlimitquery parameters.page,limit,total_items, andtotal_pagesin the response.