Skip to content

feat: add admin activity log viewer - #16

Merged
udaycodespace merged 1 commit into
udaycodespace:mainfrom
Jidnyasa-P:feat/issue-8-admin-activity-logs
Jul 18, 2026
Merged

feat: add admin activity log viewer#16
udaycodespace merged 1 commit into
udaycodespace:mainfrom
Jidnyasa-P:feat/issue-8-admin-activity-logs

Conversation

@Jidnyasa-P

Copy link
Copy Markdown
Contributor

Description

Adds a secure admin activity-log viewer with search, filters, sorting, pagination, responsive layouts, and safe loading and error states.

Fixes #8

Backend changes

  • Added a protected admin activity-log endpoint

  • Added query support for:

    • Search
    • User role
    • Activity type
    • Start and end dates
    • Newest and oldest sorting
    • Page number and page size
  • Added pagination metadata

  • Added validation for filter and pagination values

  • Escaped search input before constructing regular expressions

  • Added optional IP address and user-agent fields

  • Sanitized the returned activity-log data

  • Prevented passwords, tokens, payment information, and other sensitive fields from being returned

Frontend changes

  • Added an Activity Logs section to the admin dashboard
  • Added a responsive desktop table
  • Added mobile card-style records
  • Added search and filtering controls
  • Added date-range filtering
  • Added newest/oldest sorting
  • Added configurable page size
  • Added previous and next pagination controls
  • Added loading skeletons
  • Added empty and retryable error states
  • Added readable date and device formatting

Documentation

  • Added docs/admin-activity-logs.md
  • Documented API parameters, authorization, security behaviour, older-record compatibility, and manual testing

Testing

  • Verified admin users can load activity logs
  • Verified non-admin users are rejected
  • Verified requests without a token are rejected
  • Tested email search
  • Tested role filtering
  • Tested login/logout filtering
  • Tested date filtering and invalid date ranges
  • Tested newest/oldest sorting
  • Tested pagination and page-size changes
  • Tested loading, empty, and error states
  • Tested mobile and desktop layouts
  • Confirmed sensitive fields are absent from API responses
  • Ran backend syntax checks
  • Ran the frontend production build

Screenshots

Screenshot 2026-07-18 182539

@Jidnyasa-P

Copy link
Copy Markdown
Contributor Author

@udaycodespace Please do add bonus labels like good-backend , good-pr and good-ui
Thank you !

@udaycodespace udaycodespace added ECSoC26 Required label for a PR to be eligible for Sentinel scoring ECSoC26-L1 Easy difficulty, auto-assigned by Sentinel — 5 points in review PR is up and waiting on maintainer review and removed frontend documentation backend labels Jul 18, 2026
@udaycodespace
udaycodespace self-requested a review July 18, 2026 13:22
@udaycodespace

Copy link
Copy Markdown
Owner

@udaycodespace Please do add bonus labels like good-backend , good-pr and good-ui Thank you !

Temporary labels have been assigned based on the PR details. Final labels will be assigned after the review.

  1. Additionally, please provide supporting evidence for the testing section (screenshots or CLI output where applicable, such as the frontend production build, backend validation, and relevant test results)
  2. So the claimed verifications can be confirmed during review.

@udaycodespace udaycodespace added redo Reviewed — needs changes before it can be merged and removed in review PR is up and waiting on maintainer review labels Jul 18, 2026
@udaycodespace
udaycodespace merged commit fe20023 into udaycodespace:main Jul 18, 2026
4 checks passed
@ecsoc-sentinel ecsoc-sentinel Bot added ECSoC26-L2 Medium difficulty, auto-assigned by Sentinel — 10 points and removed ECSoC26-L1 Easy difficulty, auto-assigned by Sentinel — 5 points labels Jul 18, 2026
@Jidnyasa-P

Jidnyasa-P commented Jul 18, 2026

Copy link
Copy Markdown
Contributor Author

@udaycodespace Thanks for the review. Now kindly assign the bonus labels. I have completed the requested validation and added supporting evidence below.

Backend validation

The following syntax checks completed successfully:

node --check controllers/activityLogController.js
node --check routers/adminRoutes.js
node --check schemas/activityLogModel.js

The backend also started successfully and connected to MongoDB.
Screenshot 2026-07-18 195308

Frontend production build

The frontend production build completed successfully using:

npm run build
Screenshot 2026-07-18 195405

Authorization verification

Verified the following API behaviour:
Screenshot 2026-07-18 200005
Screenshot 2026-07-18 200016

Search and filtering

Screenshot 2026-07-18 200129 Screenshot 2026-07-18 200143

Sorting

Verified both:

  • Newest-first sorting
  • Oldest-first sorting

The returned timestamps and frontend rows reorder correctly.

Screenshot 2026-07-18 200156 Screenshot 2026-07-18 200202

Pagination

Verified:

  • Page-size selection
  • Previous and Next navigation
  • Current-page indicator
  • Total item and total page metadata
Screenshot 2026-07-18 200351 Screenshot 2026-07-18 200403

UI states and responsiveness

image

udaycodespace pushed a commit that referenced this pull request Jul 18, 2026
Merge PR #17 from Jidnyasa-P

Add a secure admin payment dashboard with secure payment
record management for administrators.

Highlights:
- Add admin payment records dashboard
- Sanitize payment data returned by the API
- Support search, filtering, sorting, and pagination
- Display payment summary metrics
- Add responsive desktop and mobile layouts
- Add accessible transaction details dialog
- Protect endpoints with existing admin authentication and authorization
- Add API documentation and testing guidance
- Verify implementation with backend validation, production build,
  authorization checks, and feature testing

Closes #17.

P.S. While merging PR #16, I accidentally used this PR's merge title and description. So now PR #16 has PR #17's merge message, and PR #17 gets PR #16's. They basically swapped identities.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ECSoC26-L2 Medium difficulty, auto-assigned by Sentinel — 10 points ECSoC26 Required label for a PR to be eligible for Sentinel scoring redo Reviewed — needs changes before it can be merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add admin activity log viewer with filters and pagination

2 participants