feat: Add comprehensive audit logging system

- Add audit logging for contacts (link company, create company from contact)
- Add audit logging for notes (create, update, delete)
- Add audit logging for companies (update, user assign/remove, reminder CRUD)
- Add audit logging for projects (update, user assign/remove)
- Add audit logging for todos (update, uncomplete)
- Add audit logging for time entries (update, delete)
- Add audit logging for timesheets (upload, delete)
- Add audit logging for user deletion
- Add pagination and filters to audit logs API (userId, action, resource, dateFrom, dateTo)
- Add endpoints for distinct actions and resources

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
richardtekula
2025-12-17 07:19:40 +01:00
parent 548a8effdb
commit 0585e51b25
13 changed files with 615 additions and 22 deletions

View File

@@ -1,5 +1,5 @@
import { Router } from 'express';
import { getRecentAuditLogs } from '../controllers/audit.controller.js';
import { getRecentAuditLogs, getAuditActions, getAuditResources } from '../controllers/audit.controller.js';
import { authenticate } from '../middlewares/auth/authMiddleware.js';
import { requireAdmin } from '../middlewares/auth/roleMiddleware.js';
@@ -7,5 +7,7 @@ const router = Router();
// Audit logs are admin only
router.get('/', authenticate, requireAdmin, getRecentAuditLogs);
router.get('/actions', authenticate, requireAdmin, getAuditActions);
router.get('/resources', authenticate, requireAdmin, getAuditResources);
export default router;