-
Notifications
You must be signed in to change notification settings - Fork 84
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
Feature: Allow Super Admin to Get Log Of Activities #155
Comments
Please, present your issue description in markdown format. It's just in plain text here. |
You didn't include offset in the query params. Update the response body to use Format the markdown, you are likely missing a ``` to terminate the body |
Corrections implemented. Please Review |
You added validation error Response to your success response. |
Corrected @PreciousIfeaka |
Description
Implement an API endpoint that allows authenticated super admins to retrieve logs of activities. This endpoint ensures that only users with super admin privileges can access activity logs, maintaining system security.
Endpoint Feature
Acceptance Criteria
GET /api/v1/admin/logs
.200 OK
status code with the list of logs.Request Example:
Query Parameters
page
(optional, integer): The page number for pagination.limit
(optional, integer): The number of logs per page.sort
(optional, string): The sort order, e.g., "asc" or "desc".offset
(optional, integer): The offset for pagination.Response Example:
On successful retrieval of logs, the API should return a
200 OK
status code. The response body should contain a paginated list of logs:Data Validation
Input Validation:
Validate that the query parameters (page, limit, sort) are valid. Example: If any query parameter is invalid, return a 422 status code with an error message:
Output Validation:
Authentication and Authorization
Authentication:
Verify that the user is authenticated before allowing access to the endpoint. Example: Use middleware to check for a valid authentication token.
Authorization:
Ensure that only super admin users can access this endpoint. Example: Check user roles or permissions to confirm super admin authorization.
Error Handling
Error Responses:
Define error responses for common failure scenarios. Example: If the user is not authorized, return a 403 Forbidden status code with an error message:
Handle scenarios where the logs are not found, returning a 404 Not Found status code:
Edge Cases
Consider edge cases such as database connection issues or corrupted log data. Example: Handle scenarios where the provided query parameters are invalid or incomplete.
Documentation
API Documentation:
Document the endpoint in the API documentation with request and response examples using the standard OpenAPI 3.1.0 standard. Include details on the authentication mechanism.
Testing Requirements
Unit Tests:
Write unit tests to validate the retrieval logic and authorization checks.
Write tests for all error cases.
Integration Tests:
Ensure end-to-end functionality is tested with integration tests, including various pagination, authentication, and authorization flows.
Dependencies and Impact
Dependencies:
Ensure the user authentication middleware and super-admin middleware are operational.
Impact Analysis:
Assess the potential impact on other features or components, ensuring that existing functionality is not disrupted.
Consider the impact on API consumers who may need to update their integration to handle the paginated responses.
The text was updated successfully, but these errors were encountered: