Merge branch 'dev' of http://39.117.244.52:3000/kjs/ERP-node into node-nonquery

This commit is contained in:
2025-09-01 14:52:51 +09:00
40 changed files with 6359 additions and 133 deletions

View File

@@ -375,3 +375,77 @@ export async function getColumnLabels(
res.status(500).json(response);
}
}
/**
* 컬럼 웹 타입 설정
*/
export async function updateColumnWebType(
req: AuthenticatedRequest,
res: Response
): Promise<void> {
try {
const { tableName, columnName } = req.params;
const { webType, detailSettings } = req.body;
logger.info(
`=== 컬럼 웹 타입 설정 시작: ${tableName}.${columnName} = ${webType} ===`
);
if (!tableName || !columnName || !webType) {
const response: ApiResponse<null> = {
success: false,
message: "테이블명, 컬럼명, 웹 타입이 모두 필요합니다.",
error: {
code: "MISSING_PARAMETERS",
details: "필수 파라미터가 누락되었습니다.",
},
};
res.status(400).json(response);
return;
}
// PostgreSQL 클라이언트 생성
const client = new Client({
connectionString: process.env.DATABASE_URL,
});
await client.connect();
try {
const tableManagementService = new TableManagementService(client);
await tableManagementService.updateColumnWebType(
tableName,
columnName,
webType,
detailSettings
);
logger.info(
`컬럼 웹 타입 설정 완료: ${tableName}.${columnName} = ${webType}`
);
const response: ApiResponse<null> = {
success: true,
message: "컬럼 웹 타입이 성공적으로 설정되었습니다.",
data: null,
};
res.status(200).json(response);
} finally {
await client.end();
}
} 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);
}
}