debug: 카테고리 컬럼 조회 상세 로깅 추가

- 테이블 조회 완료 후 count 추가
- 카테고리 컬럼 쿼리 실행 전/후 로깅
- 에러 발생 시 전체 스택 트레이스 출력
This commit is contained in:
kjs 2025-11-11 14:48:42 +09:00
parent e7ecd0a863
commit abdb6b17f8
1 changed files with 10 additions and 5 deletions

View File

@ -1645,7 +1645,7 @@ export async function getCategoryColumnsByMenu(
const tablesResult = await pool.query(tablesQuery, [siblingObjids, companyCode]);
const tableNames = tablesResult.rows.map((row: any) => row.table_name);
logger.info("✅ 형제 메뉴 테이블 조회 완료", { tableNames });
logger.info("✅ 형제 메뉴 테이블 조회 완료", { tableNames, count: tableNames.length });
if (tableNames.length === 0) {
return res.json({
@ -1656,6 +1656,8 @@ export async function getCategoryColumnsByMenu(
}
// 3. 테이블들의 카테고리 타입 컬럼 조회
logger.info("🔍 카테고리 컬럼 쿼리 준비", { tableNames, companyCode });
const columnsQuery = `
SELECT
table_name AS "tableName",
@ -1669,7 +1671,9 @@ export async function getCategoryColumnsByMenu(
ORDER BY table_name, column_name
`;
logger.info("🔍 카테고리 컬럼 쿼리 실행 중...");
const columnsResult = await pool.query(columnsQuery, [tableNames, companyCode]);
logger.info("✅ 카테고리 컬럼 쿼리 완료", { rowCount: columnsResult.rows.length });
logger.info("✅ 카테고리 컬럼 조회 완료", {
columnCount: columnsResult.rows.length
@ -1681,15 +1685,16 @@ export async function getCategoryColumnsByMenu(
message: "카테고리 컬럼 조회 성공",
});
} catch (error: any) {
logger.error("❌ 메뉴별 카테고리 컬럼 조회 실패", {
error: error.message,
errorStack: error.stack,
});
logger.error("❌ 메뉴별 카테고리 컬럼 조회 실패");
logger.error("에러 메시지:", error.message);
logger.error("에러 스택:", error.stack);
logger.error("에러 전체:", error);
res.status(500).json({
success: false,
message: "카테고리 컬럼 조회에 실패했습니다.",
error: error.message,
stack: error.stack, // 디버깅용
});
}
}