feat: Add express-async-errors for improved error handling

- Integrated express-async-errors to automatically handle errors in async route handlers, enhancing the overall error management in the application.
- Updated app.ts to include the express-async-errors import for global error handling.
- Removed redundant logging statements in admin and user menu retrieval functions to streamline the code and improve readability.
- Adjusted logging levels from info to debug for less critical logs, ensuring that important information is logged appropriately without cluttering the logs.
This commit is contained in:
DDD1542
2026-02-12 11:42:52 +09:00
parent 0512a3214c
commit 4294e6206b
20 changed files with 555 additions and 481 deletions

View File

@@ -1004,13 +1004,25 @@ export class ButtonActionExecutor {
}
const primaryKeys = primaryKeyResult.data || [];
const primaryKeyValue = this.extractPrimaryKeyValueFromDB(formData, primaryKeys);
let primaryKeyValue = this.extractPrimaryKeyValueFromDB(formData, primaryKeys);
// 🔧 수정: originalData가 있고 실제 데이터가 있으면 UPDATE 모드로 처리
// originalData는 수정 버튼 클릭 시 editData로 전달되어 context.originalData로 설정됨
// 빈 객체 {}도 truthy이므로 Object.keys로 실제 데이터 유무 확인
const hasRealOriginalData = originalData && Object.keys(originalData).length > 0;
// 🆕 폴백: formData에 PK가 없으면 originalData에서 PK 추출
// 수정 모달에서 id 입력 필드가 없는 경우 formData에 id가 포함되지 않음
if (!primaryKeyValue && hasRealOriginalData) {
primaryKeyValue = this.extractPrimaryKeyValueFromDB(originalData, primaryKeys);
if (primaryKeyValue) {
// formData에도 PK 값을 주입하여 UPDATE 쿼리에서 사용 가능하게 함
const pkColumn = primaryKeys[0];
formData[pkColumn] = primaryKeyValue;
console.log(`🔑 [handleSave] originalData에서 PK 복원: ${pkColumn} = ${primaryKeyValue}`);
}
}
// 🆕 폴백 로직: originalData가 없어도 formData에 id가 있으면 UPDATE로 판단
// 조건부 컨테이너 등에서 originalData 전달이 누락되는 경우를 처리
const hasIdInFormData = formData.id !== undefined && formData.id !== null && formData.id !== "";
@@ -4170,6 +4182,8 @@ export class ButtonActionExecutor {
dataSourceType: controlDataSource,
sourceData,
context: extendedContext,
// 저장 전 원본 데이터 전달 (after 타이밍에서 DB 기존값 비교용)
originalData: context.originalData || null,
});
results.push({