Skip to content

implement user activity audit logging and enhance Swagger documentati…#496

Closed
feyishola wants to merge 2 commits intoPulsefy:mainfrom
feyishola:feat/api-improvement
Closed

implement user activity audit logging and enhance Swagger documentati…#496
feyishola wants to merge 2 commits intoPulsefy:mainfrom
feyishola:feat/api-improvement

Conversation

@feyishola
Copy link
Copy Markdown
Contributor

…on Add AuditLog entity

Summary

Describe what changed and why.

Linked Issue

Closes #

Type of Change

  • feat
  • fix
  • docs
  • refactor
  • test
  • chore

Validation

  • Lint passed for affected area(s)
  • Tests passed for affected area(s)
  • Manual verification completed (if applicable)

Documentation

  • Documentation updated (or N/A with explanation)
  • Screenshots/videos attached for UI changes

Checklist

  • Branch name uses feat/, fix/, or docs/
  • Commit messages follow Conventional Commits
  • PR scope matches linked issue acceptance criteria

Description
This PR implements a comprehensive audit logging system to track sensitive user actions for security and support purposes, and completes the Swagger API documentation.
Features Added

  1. Audit Logging System
    New AuditLog entity storing: user ID, action type, timestamp, IP address, user agent, metadata, and status
    AuditService providing methods to log actions and query audit logs with filtering/pagination
    AuditController with endpoints:
    GET /audit/logs - Query all audit logs (admin/support)
    GET /audit/my-activity - Get current user's activity
    GET /audit/my-activity/recent - Get recent activity for current user
  2. Tracked User Actions
    LOGIN / LOGIN_FAILED - Email/password and Stellar wallet authentication
    LOGOUT - Single device and all devices logout
    PROFILE_UPDATE - User profile changes
    ACCOUNT_LINK / ACCOUNT_UNLINK - Stellar account management
  3. Swagger Documentation
    Added comprehensive Swagger decorators to ProfileResponseDto
    Verified all existing controllers and DTOs have proper Swagger documentation
    Files Changed
    New: src/audit/ module (entity, DTOs, service, controller, module)
    Modified: src/app.module.ts, src/auth/auth.module.ts, src/auth/auth.controller.ts
    Modified: src/users/users.module.ts, src/users/users.controller.ts, src/users/dto/profile-response.dto.ts
    Modified: src/users/users.controller.spec.ts (updated tests)
    Testing
    All 130 tests pass
    Build completes successfully
    Manual verification of audit log creation on login/logout/profile update

closes #490

closes #492

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Mar 28, 2026

@feyishola Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Cedarich
Copy link
Copy Markdown
Contributor

Please fix workflow

@Cedarich Cedarich closed this Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Automated API Documentation Refinement (Swagger Decorators) User Activity Audit Logging

2 participants