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

@@ -1739,7 +1739,7 @@ export class ScreenManagementService {
// V2 레이아웃이 있으면 V2 형식으로 반환
if (v2Layout && v2Layout.layout_data) {
console.log(`V2 레이아웃 발견, V2 형식으로 반환`);
const layoutData = v2Layout.layout_data;
// URL에서 컴포넌트 타입 추출하는 헬퍼 함수
@@ -1799,7 +1799,7 @@ export class ScreenManagementService {
};
}
console.log(`V2 레이아웃 없음, V1 테이블 조회`);
const layouts = await query<any>(
`SELECT * FROM screen_layouts
@@ -4254,7 +4254,7 @@ export class ScreenManagementService {
[newScreen.screen_id, targetCompanyCode, JSON.stringify(updatedLayoutData)],
);
console.log(` ✅ V2 레이아웃 복사 완료: ${components.length}개 컴포넌트`);
} catch (error) {
console.error("V2 레이아웃 복사 중 오류:", error);
// 레이아웃 복사 실패해도 화면 생성은 유지
@@ -5045,8 +5045,7 @@ export class ScreenManagementService {
companyCode: string,
userType?: string,
): Promise<any | null> {
console.log(`=== V2 레이아웃 로드 시작 ===`);
console.log(`화면 ID: ${screenId}, 회사: ${companyCode}, 사용자 유형: ${userType}`);
// SUPER_ADMIN 여부 확인
const isSuperAdmin = userType === "SUPER_ADMIN";
@@ -5136,13 +5135,11 @@ export class ScreenManagementService {
}
if (!layout) {
console.log(`V2 레이아웃 없음: screen_id=${screenId}`);
return null;
}
console.log(
`V2 레이아웃 로드 완료: ${layout.layout_data?.components?.length || 0}개 컴포넌트`,
);
return layout.layout_data;
}
@@ -5162,10 +5159,7 @@ export class ScreenManagementService {
const hasConditionConfig = 'conditionConfig' in layoutData;
const conditionConfig = layoutData.conditionConfig || null;
console.log(`=== V2 레이아웃 저장 시작 ===`);
console.log(`화면 ID: ${screenId}, 회사: ${companyCode}, 레이어: ${layerId} (${layerName})`);
console.log(`컴포넌트 수: ${layoutData.components?.length || 0}`);
console.log(`조건 설정 포함 여부: ${hasConditionConfig}`);
// 권한 확인
const screens = await query<{ company_code: string | null }>(
@@ -5210,7 +5204,7 @@ export class ScreenManagementService {
);
}
console.log(`V2 레이아웃 저장 완료 (레이어 ${layerId}, 조건설정 ${hasConditionConfig ? '포함' : '유지'})`);
}
/**