타입 관리 개선 및 화면 비율조정 중간커밋
This commit is contained in:
@@ -735,6 +735,207 @@ export async function editTableData(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 테이블 스키마 정보 조회 (컬럼 존재 여부 검증용)
|
||||
*/
|
||||
export async function getTableSchema(
|
||||
req: AuthenticatedRequest,
|
||||
res: Response
|
||||
): Promise<void> {
|
||||
try {
|
||||
const { tableName } = req.params;
|
||||
logger.info(`=== 테이블 스키마 정보 조회 시작: ${tableName} ===`);
|
||||
|
||||
if (!tableName) {
|
||||
const response: ApiResponse<null> = {
|
||||
success: false,
|
||||
message: "테이블명이 필요합니다.",
|
||||
error: {
|
||||
code: "MISSING_TABLE_NAME",
|
||||
details: "테이블명 파라미터가 누락되었습니다.",
|
||||
},
|
||||
};
|
||||
res.status(400).json(response);
|
||||
return;
|
||||
}
|
||||
|
||||
const tableManagementService = new TableManagementService();
|
||||
const schema = await tableManagementService.getTableSchema(tableName);
|
||||
|
||||
logger.info(
|
||||
`테이블 스키마 정보 조회 완료: ${tableName}, ${schema.length}개 컬럼`
|
||||
);
|
||||
|
||||
const response: ApiResponse<ColumnTypeInfo[]> = {
|
||||
success: true,
|
||||
message: "테이블 스키마 정보를 성공적으로 조회했습니다.",
|
||||
data: schema,
|
||||
};
|
||||
|
||||
res.status(200).json(response);
|
||||
} catch (error) {
|
||||
logger.error("테이블 스키마 정보 조회 중 오류 발생:", error);
|
||||
|
||||
const response: ApiResponse<null> = {
|
||||
success: false,
|
||||
message: "테이블 스키마 정보 조회 중 오류가 발생했습니다.",
|
||||
error: {
|
||||
code: "TABLE_SCHEMA_ERROR",
|
||||
details: error instanceof Error ? error.message : "Unknown error",
|
||||
},
|
||||
};
|
||||
|
||||
res.status(500).json(response);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 테이블 존재 여부 확인
|
||||
*/
|
||||
export async function checkTableExists(
|
||||
req: AuthenticatedRequest,
|
||||
res: Response
|
||||
): Promise<void> {
|
||||
try {
|
||||
const { tableName } = req.params;
|
||||
logger.info(`=== 테이블 존재 여부 확인 시작: ${tableName} ===`);
|
||||
|
||||
if (!tableName) {
|
||||
const response: ApiResponse<null> = {
|
||||
success: false,
|
||||
message: "테이블명이 필요합니다.",
|
||||
error: {
|
||||
code: "MISSING_TABLE_NAME",
|
||||
details: "테이블명 파라미터가 누락되었습니다.",
|
||||
},
|
||||
};
|
||||
res.status(400).json(response);
|
||||
return;
|
||||
}
|
||||
|
||||
const tableManagementService = new TableManagementService();
|
||||
const exists = await tableManagementService.checkTableExists(tableName);
|
||||
|
||||
logger.info(`테이블 존재 여부 확인 완료: ${tableName} = ${exists}`);
|
||||
|
||||
const response: ApiResponse<{ exists: boolean }> = {
|
||||
success: true,
|
||||
message: "테이블 존재 여부를 확인했습니다.",
|
||||
data: { exists },
|
||||
};
|
||||
|
||||
res.status(200).json(response);
|
||||
} catch (error) {
|
||||
logger.error("테이블 존재 여부 확인 중 오류 발생:", error);
|
||||
|
||||
const response: ApiResponse<null> = {
|
||||
success: false,
|
||||
message: "테이블 존재 여부 확인 중 오류가 발생했습니다.",
|
||||
error: {
|
||||
code: "TABLE_EXISTS_CHECK_ERROR",
|
||||
details: error instanceof Error ? error.message : "Unknown error",
|
||||
},
|
||||
};
|
||||
|
||||
res.status(500).json(response);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 컬럼 웹타입 정보 조회 (화면관리 연동용)
|
||||
*/
|
||||
export async function getColumnWebTypes(
|
||||
req: AuthenticatedRequest,
|
||||
res: Response
|
||||
): Promise<void> {
|
||||
try {
|
||||
const { tableName } = req.params;
|
||||
logger.info(`=== 컬럼 웹타입 정보 조회 시작: ${tableName} ===`);
|
||||
|
||||
if (!tableName) {
|
||||
const response: ApiResponse<null> = {
|
||||
success: false,
|
||||
message: "테이블명이 필요합니다.",
|
||||
error: {
|
||||
code: "MISSING_TABLE_NAME",
|
||||
details: "테이블명 파라미터가 누락되었습니다.",
|
||||
},
|
||||
};
|
||||
res.status(400).json(response);
|
||||
return;
|
||||
}
|
||||
|
||||
const tableManagementService = new TableManagementService();
|
||||
const webTypes = await tableManagementService.getColumnWebTypes(tableName);
|
||||
|
||||
logger.info(
|
||||
`컬럼 웹타입 정보 조회 완료: ${tableName}, ${webTypes.length}개 컬럼`
|
||||
);
|
||||
|
||||
const response: ApiResponse<ColumnTypeInfo[]> = {
|
||||
success: true,
|
||||
message: "컬럼 웹타입 정보를 성공적으로 조회했습니다.",
|
||||
data: webTypes,
|
||||
};
|
||||
|
||||
res.status(200).json(response);
|
||||
} catch (error) {
|
||||
logger.error("컬럼 웹타입 정보 조회 중 오류 발생:", error);
|
||||
|
||||
const response: ApiResponse<null> = {
|
||||
success: false,
|
||||
message: "컬럼 웹타입 정보 조회 중 오류가 발생했습니다.",
|
||||
error: {
|
||||
code: "COLUMN_WEB_TYPES_ERROR",
|
||||
details: error instanceof Error ? error.message : "Unknown error",
|
||||
},
|
||||
};
|
||||
|
||||
res.status(500).json(response);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 데이터베이스 연결 상태 확인
|
||||
*/
|
||||
export async function checkDatabaseConnection(
|
||||
req: AuthenticatedRequest,
|
||||
res: Response
|
||||
): Promise<void> {
|
||||
try {
|
||||
logger.info("=== 데이터베이스 연결 상태 확인 시작 ===");
|
||||
|
||||
const tableManagementService = new TableManagementService();
|
||||
const connectionStatus =
|
||||
await tableManagementService.checkDatabaseConnection();
|
||||
|
||||
logger.info(
|
||||
`데이터베이스 연결 상태: ${connectionStatus.connected ? "연결됨" : "연결 안됨"}`
|
||||
);
|
||||
|
||||
const response: ApiResponse<{ connected: boolean; message: string }> = {
|
||||
success: true,
|
||||
message: "데이터베이스 연결 상태를 확인했습니다.",
|
||||
data: connectionStatus,
|
||||
};
|
||||
|
||||
res.status(200).json(response);
|
||||
} catch (error) {
|
||||
logger.error("데이터베이스 연결 상태 확인 중 오류 발생:", error);
|
||||
|
||||
const response: ApiResponse<null> = {
|
||||
success: false,
|
||||
message: "데이터베이스 연결 상태 확인 중 오류가 발생했습니다.",
|
||||
error: {
|
||||
code: "DATABASE_CONNECTION_ERROR",
|
||||
details: error instanceof Error ? error.message : "Unknown error",
|
||||
},
|
||||
};
|
||||
|
||||
res.status(500).json(response);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 테이블 데이터 삭제
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user