feat: implement user activity logging system with admin log endpoints
Title (semantic)
feat(activity-logs): implement user activity logging system
Description
This merge request introduces a reusable User Activity Logging System for the Indic Corpus Server backend.
The feature enables tracking of contributor, moderator, and admin actions across the platform for auditing, moderation visibility, analytics, and future abuse detection.
Implemented functionality includes:
- Added
ActivityLogSQLAlchemy model - Added matching Pydantic schemas
- Added centralized activity action enum/constants
- Added reusable async-safe logging service
- Added admin-only activity log endpoints
- Registered activity log router
- Added database migration for
activity_logs - Added tests for activity logging components
- Integrated logging-ready architecture for endpoint usage
- Added support for metadata, IP address, role, and timestamps
This implementation establishes the base infrastructure for logging platform actions across authentication, contribution workflows, moderation actions, and admin operations.
Checklist
- The feature has been fully implemented.
-
Tests for the new feature are included and passing. -
User documentation/guides have been updated (if applicable). -
Impact on existing functionality has been considered.
-
Impact on Existing Functionality
- No breaking API changes introduced.
- Activity logging is additive and does not affect existing endpoint behavior.
- Logging service is designed to fail safely without interrupting request flow.
- Admin-only access added for activity log retrieval endpoints.
Related Issue(s)
Closes #53