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

@@ -13,7 +13,7 @@ import {
ColumnSettingsResponse,
} from "../types/tableManagement";
import { query } from "../database/db";
import { auditLogService } from "../services/auditLogService";
import { auditLogService, getClientIp } from "../services/auditLogService";
/**
* 테이블 목록 조회
@@ -974,7 +974,7 @@ export async function addTableData(
tableName,
summary: `${tableName} 데이터 추가`,
changes: { after: data },
ipAddress: (req as any).ip,
ipAddress: getClientIp(req),
requestPath: req.originalUrl,
});
@@ -1127,7 +1127,7 @@ export async function editTableData(
tableName,
summary: `${tableName} 데이터 수정`,
changes: { before: changedBefore, after: changedAfter },
ipAddress: (req as any).ip,
ipAddress: getClientIp(req),
requestPath: req.originalUrl,
});
}
@@ -1461,7 +1461,7 @@ export async function deleteTableData(
tableName,
summary: `${tableName} 데이터 삭제 (${deletedCount}건)`,
changes: { before: { deletedCount, items: deleteItems.length } },
ipAddress: (req as any).ip,
ipAddress: getClientIp(req),
requestPath: req.originalUrl,
});
@@ -2355,7 +2355,7 @@ export async function multiTableSave(
tableName: mainTableName,
summary: `${mainTableName} 데이터 ${isUpdate ? "수정" : "생성"}${subTableResults.length > 0 ? ` (서브 테이블 ${subTableResults.length}건)` : ""}`,
changes: { after: mainData },
ipAddress: (req as any).ip,
ipAddress: getClientIp(req),
requestPath: req.originalUrl,
});