테이블 추가기능 수정사항
This commit is contained in:
@@ -42,11 +42,17 @@ export class DDLController {
|
||||
ip: req.ip,
|
||||
});
|
||||
|
||||
// inputType을 webType으로 변환 (레거시 호환성)
|
||||
const processedColumns = columns.map((col) => ({
|
||||
...col,
|
||||
webType: (col.inputType || col.webType || "text") as any,
|
||||
}));
|
||||
|
||||
// DDL 실행 서비스 호출
|
||||
const ddlService = new DDLExecutionService();
|
||||
const result = await ddlService.createTable(
|
||||
tableName,
|
||||
columns,
|
||||
processedColumns,
|
||||
userCompanyCode,
|
||||
userId,
|
||||
description
|
||||
@@ -112,12 +118,12 @@ export class DDLController {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!column || !column.name || !column.webType) {
|
||||
if (!column || !column.name || (!column.inputType && !column.webType)) {
|
||||
res.status(400).json({
|
||||
success: false,
|
||||
error: {
|
||||
code: "INVALID_INPUT",
|
||||
details: "컬럼명과 웹타입이 필요합니다.",
|
||||
details: "컬럼명과 입력타입이 필요합니다.",
|
||||
},
|
||||
});
|
||||
return;
|
||||
@@ -131,11 +137,17 @@ export class DDLController {
|
||||
ip: req.ip,
|
||||
});
|
||||
|
||||
// inputType을 webType으로 변환 (레거시 호환성)
|
||||
const processedColumn = {
|
||||
...column,
|
||||
webType: (column.inputType || column.webType || "text") as any,
|
||||
};
|
||||
|
||||
// DDL 실행 서비스 호출
|
||||
const ddlService = new DDLExecutionService();
|
||||
const result = await ddlService.addColumn(
|
||||
tableName,
|
||||
column,
|
||||
processedColumn,
|
||||
userCompanyCode,
|
||||
userId
|
||||
);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user