테이블 추가기능 수정사항

This commit is contained in:
kjs
2025-09-23 10:40:21 +09:00
parent 474cc33aee
commit e653effac0
19 changed files with 1931 additions and 201 deletions

View File

@@ -443,24 +443,24 @@ export async function updateTableLabel(
}
/**
* 컬럼 타입 설정
* 컬럼 입력 타입 설정
*/
export async function updateColumnWebType(
export async function updateColumnInputType(
req: AuthenticatedRequest,
res: Response
): Promise<void> {
try {
const { tableName, columnName } = req.params;
const { webType, detailSettings, inputType } = req.body;
const { inputType, detailSettings } = req.body;
logger.info(
`=== 컬럼 타입 설정 시작: ${tableName}.${columnName} = ${webType} ===`
`=== 컬럼 입력 타입 설정 시작: ${tableName}.${columnName} = ${inputType} ===`
);
if (!tableName || !columnName || !webType) {
if (!tableName || !columnName || !inputType) {
const response: ApiResponse<null> = {
success: false,
message: "테이블명, 컬럼명, 타입이 모두 필요합니다.",
message: "테이블명, 컬럼명, 입력 타입이 모두 필요합니다.",
error: {
code: "MISSING_PARAMETERS",
details: "필수 파라미터가 누락되었습니다.",
@@ -471,33 +471,32 @@ export async function updateColumnWebType(
}
const tableManagementService = new TableManagementService();
await tableManagementService.updateColumnWebType(
await tableManagementService.updateColumnInputType(
tableName,
columnName,
webType,
detailSettings,
inputType
inputType,
detailSettings
);
logger.info(
`컬럼 타입 설정 완료: ${tableName}.${columnName} = ${webType}`
`컬럼 입력 타입 설정 완료: ${tableName}.${columnName} = ${inputType}`
);
const response: ApiResponse<null> = {
success: true,
message: "컬럼 타입이 성공적으로 설정되었습니다.",
message: "컬럼 입력 타입이 성공적으로 설정되었습니다.",
data: null,
};
res.status(200).json(response);
} catch (error) {
logger.error("컬럼 타입 설정 중 오류 발생:", error);
logger.error("컬럼 입력 타입 설정 중 오류 발생:", error);
const response: ApiResponse<null> = {
success: false,
message: "컬럼 타입 설정 중 오류가 발생했습니다.",
message: "컬럼 입력 타입 설정 중 오류가 발생했습니다.",
error: {
code: "WEB_TYPE_UPDATE_ERROR",
code: "INPUT_TYPE_UPDATE_ERROR",
details: error instanceof Error ? error.message : "Unknown error",
},
};
@@ -866,16 +865,17 @@ export async function getColumnWebTypes(
}
const tableManagementService = new TableManagementService();
const webTypes = await tableManagementService.getColumnWebTypes(tableName);
const inputTypes =
await tableManagementService.getColumnInputTypes(tableName);
logger.info(
`컬럼 타입 정보 조회 완료: ${tableName}, ${webTypes.length}개 컬럼`
`컬럼 입력타입 정보 조회 완료: ${tableName}, ${inputTypes.length}개 컬럼`
);
const response: ApiResponse<ColumnTypeInfo[]> = {
success: true,
message: "컬럼 타입 정보를 성공적으로 조회했습니다.",
data: webTypes,
message: "컬럼 입력타입 정보를 성공적으로 조회했습니다.",
data: inputTypes,
};
res.status(200).json(response);
@@ -1010,3 +1010,41 @@ export async function deleteTableData(
res.status(500).json(response);
}
}
/**
* 컬럼 웹 타입 설정 (레거시 지원)
* @deprecated updateColumnInputType 사용 권장
*/
export async function updateColumnWebType(
req: AuthenticatedRequest,
res: Response
): Promise<void> {
try {
const { tableName, columnName } = req.params;
const { webType, detailSettings, inputType } = req.body;
logger.warn(
`레거시 API 사용: updateColumnWebType → updateColumnInputType 사용 권장`
);
// webType을 inputType으로 변환
const convertedInputType = inputType || webType || "text";
// 새로운 메서드 호출
req.body = { inputType: convertedInputType, detailSettings };
await updateColumnInputType(req, res);
} catch (error) {
logger.error("레거시 컬럼 웹 타입 설정 중 오류 발생:", error);
const response: ApiResponse<null> = {
success: false,
message: "컬럼 웹 타입 설정 중 오류가 발생했습니다.",
error: {
code: "WEB_TYPE_UPDATE_ERROR",
details: error instanceof Error ? error.message : "Unknown error",
},
};
res.status(500).json(response);
}
}