update
This commit is contained in:
@@ -39,7 +39,6 @@ export class AuditController {
|
||||
res.status(400).json({ message: '无效的 endDate 参数' });
|
||||
return;
|
||||
}
|
||||
// TODO: 可以添加对 actionType 是否有效的验证
|
||||
|
||||
// 将 searchTerm 传递给 service
|
||||
const result = await auditLogService.getLogs(limit, offset, actionType, startDate, endDate, searchTerm);
|
||||
@@ -52,7 +51,7 @@ export class AuditController {
|
||||
parsedDetails = JSON.parse(log.details);
|
||||
} catch (e) {
|
||||
console.warn(`[Audit Log] Failed to parse details for log ID ${log.id}:`, e);
|
||||
parsedDetails = { raw: log.details, parseError: true }; // 保留原始字符串并标记错误
|
||||
parsedDetails = { raw: log.details, parseError: true };
|
||||
}
|
||||
}
|
||||
return { ...log, details: parsedDetails };
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
import { Router } from 'express';
|
||||
import { AuditController } from './audit.controller';
|
||||
import { isAuthenticated } from '../auth/auth.middleware'; // Use the correct auth middleware
|
||||
import { isAuthenticated } from '../auth/auth.middleware';
|
||||
|
||||
const router = Router();
|
||||
const auditController = new AuditController();
|
||||
|
||||
// Apply auth middleware to protect the audit log endpoint
|
||||
router.use(isAuthenticated);
|
||||
|
||||
// Define route for getting audit logs
|
||||
|
||||
router.get('/', auditController.getAuditLogs);
|
||||
|
||||
export default router;
|
||||
|
||||
Reference in New Issue
Block a user