feat: Enhance audit logging with client IP tracking

- Integrated client IP address retrieval in the audit logging functionality across multiple controllers, including admin, common code, department, flow, screen, and table management.
- Updated the `auditLogService` to include a new method for obtaining the client's IP address, ensuring accurate logging of user actions.
- This enhancement improves traceability and accountability by capturing the source of requests, thereby strengthening the overall logging mechanism within the application.
This commit is contained in:
kjs
2026-03-04 15:02:27 +09:00
parent 459777d5f0
commit 96637a9cb6
12 changed files with 268 additions and 154 deletions

View File

@@ -6,7 +6,7 @@ import {
} from "../services/commonCodeService";
import { AuthenticatedRequest } from "../types/auth";
import { logger } from "../utils/logger";
import { auditLogService } from "../services/auditLogService";
import { auditLogService, getClientIp } from "../services/auditLogService";
export class CommonCodeController {
private commonCodeService: CommonCodeService;
@@ -172,7 +172,7 @@ export class CommonCodeController {
resourceId: category?.categoryCode,
resourceName: category?.categoryName || categoryData.categoryName,
summary: `코드 카테고리 "${category?.categoryName || categoryData.categoryName}" 생성`,
ipAddress: (req as any).ip,
ipAddress: getClientIp(req),
requestPath: req.originalUrl,
});
@@ -229,7 +229,7 @@ export class CommonCodeController {
resourceId: categoryCode,
resourceName: category?.categoryName,
summary: `코드 카테고리 "${categoryCode}" 수정`,
ipAddress: (req as any).ip,
ipAddress: getClientIp(req),
requestPath: req.originalUrl,
});
@@ -277,7 +277,7 @@ export class CommonCodeController {
resourceType: "CODE_CATEGORY",
resourceId: categoryCode,
summary: `코드 카테고리 "${categoryCode}" 삭제`,
ipAddress: (req as any).ip,
ipAddress: getClientIp(req),
requestPath: req.originalUrl,
});
@@ -347,7 +347,7 @@ export class CommonCodeController {
resourceId: codeData.codeValue,
resourceName: codeData.codeName,
summary: `코드 "${codeData.codeName}" (${categoryCode}) 생성`,
ipAddress: (req as any).ip,
ipAddress: getClientIp(req),
requestPath: req.originalUrl,
});