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

@@ -10,7 +10,7 @@ import { FlowConnectionService } from "../services/flowConnectionService";
import { FlowExecutionService } from "../services/flowExecutionService";
import { FlowDataMoveService } from "../services/flowDataMoveService";
import { FlowProcedureService } from "../services/flowProcedureService";
import { auditLogService } from "../services/auditLogService";
import { auditLogService, getClientIp } from "../services/auditLogService";
export class FlowController {
private flowDefinitionService: FlowDefinitionService;
@@ -102,7 +102,7 @@ export class FlowController {
resourceName: flowDef?.name || name,
summary: `플로우 "${flowDef?.name || name}" 생성`,
changes: { after: { name, tableName } },
ipAddress: (req as any).ip,
ipAddress: getClientIp(req as any),
requestPath: req.originalUrl,
});
@@ -229,7 +229,7 @@ export class FlowController {
before: { name: beforeFlow?.name, description: beforeFlow?.description, isActive: beforeFlow?.isActive },
after: { name, description, isActive },
},
ipAddress: (req as any).ip,
ipAddress: getClientIp(req as any),
requestPath: req.originalUrl,
});
@@ -272,7 +272,7 @@ export class FlowController {
resourceType: "FLOW",
resourceId: String(flowId),
summary: `플로우(ID:${flowId}) 삭제`,
ipAddress: (req as any).ip,
ipAddress: getClientIp(req as any),
requestPath: req.originalUrl,
});
@@ -372,7 +372,7 @@ export class FlowController {
resourceName: stepName,
summary: `플로우 스텝 "${stepName}" 생성 (플로우 ID:${flowDefinitionId})`,
changes: { after: { stepName, tableName, stepOrder } },
ipAddress: (req as any).ip,
ipAddress: getClientIp(req as any),
requestPath: req.originalUrl,
});
@@ -467,7 +467,7 @@ export class FlowController {
before: { stepName: beforeStep?.stepName, tableName: beforeStep?.tableName, stepOrder: beforeStep?.stepOrder },
after: { stepName, tableName, stepOrder },
},
ipAddress: (req as any).ip,
ipAddress: getClientIp(req as any),
requestPath: req.originalUrl,
});
@@ -524,7 +524,7 @@ export class FlowController {
resourceId: String(id),
resourceName: existingStep?.stepName,
summary: `플로우 스텝 "${existingStep?.stepName || id}" 삭제`,
ipAddress: (req as any).ip,
ipAddress: getClientIp(req as any),
requestPath: req.originalUrl,
});
@@ -623,7 +623,7 @@ export class FlowController {
resourceName: flowDef?.name || "",
summary: `플로우 "${flowDef?.name}" 연결 생성 (${fromStep?.stepName}${toStep?.stepName})`,
changes: { after: { fromStepId, toStepId, label } },
ipAddress: (req as any).ip,
ipAddress: getClientIp(req as any),
requestPath: req.originalUrl,
});
@@ -680,7 +680,7 @@ export class FlowController {
resourceId: String(existingConn?.flowDefinitionId || id),
summary: `플로우 연결 삭제 (ID: ${id})`,
changes: { before: { connectionId: id } },
ipAddress: (req as any).ip,
ipAddress: getClientIp(req as any),
requestPath: req.originalUrl,
});