컬럼 세부 타입 설정
This commit is contained in:
@@ -27,13 +27,13 @@ export class TableManagementService {
|
||||
columnName: string
|
||||
): Promise<{ isCodeType: boolean; codeCategory?: string }> {
|
||||
try {
|
||||
// column_labels 테이블에서 해당 컬럼의 web_type이 'code'인지 확인
|
||||
// column_labels 테이블에서 해당 컬럼의 input_type이 'code'인지 확인
|
||||
const result = await query(
|
||||
`SELECT web_type, code_category
|
||||
`SELECT input_type, code_category
|
||||
FROM column_labels
|
||||
WHERE table_name = $1
|
||||
AND column_name = $2
|
||||
AND web_type = 'code'`,
|
||||
AND input_type = 'code'`,
|
||||
[tableName, columnName]
|
||||
);
|
||||
|
||||
@@ -167,7 +167,7 @@ export class TableManagementService {
|
||||
COALESCE(cl.column_label, c.column_name) as "displayName",
|
||||
c.data_type as "dataType",
|
||||
c.data_type as "dbType",
|
||||
COALESCE(cl.web_type, 'text') as "webType",
|
||||
COALESCE(cl.input_type, 'text') as "webType",
|
||||
COALESCE(cl.input_type, 'direct') as "inputType",
|
||||
COALESCE(cl.detail_settings, '') as "detailSettings",
|
||||
COALESCE(cl.description, '') as "description",
|
||||
@@ -483,7 +483,7 @@ export class TableManagementService {
|
||||
table_name: string;
|
||||
column_name: string;
|
||||
column_label: string | null;
|
||||
web_type: string | null;
|
||||
input_type: string | null;
|
||||
detail_settings: any;
|
||||
description: string | null;
|
||||
display_order: number | null;
|
||||
@@ -495,7 +495,7 @@ export class TableManagementService {
|
||||
created_date: Date | null;
|
||||
updated_date: Date | null;
|
||||
}>(
|
||||
`SELECT id, table_name, column_name, column_label, web_type, detail_settings,
|
||||
`SELECT id, table_name, column_name, column_label, input_type, detail_settings,
|
||||
description, display_order, is_visible, code_category, code_value,
|
||||
reference_table, reference_column, created_date, updated_date
|
||||
FROM column_labels
|
||||
@@ -512,7 +512,7 @@ export class TableManagementService {
|
||||
tableName: columnLabel.table_name || "",
|
||||
columnName: columnLabel.column_name || "",
|
||||
columnLabel: columnLabel.column_label || undefined,
|
||||
webType: columnLabel.web_type || undefined,
|
||||
webType: columnLabel.input_type || undefined,
|
||||
detailSettings: columnLabel.detail_settings || undefined,
|
||||
description: columnLabel.description || undefined,
|
||||
displayOrder: columnLabel.display_order || undefined,
|
||||
@@ -539,7 +539,7 @@ export class TableManagementService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 컬럼 웹 타입 설정
|
||||
* 컬럼 입력 타입 설정 (web_type → input_type 통합)
|
||||
*/
|
||||
async updateColumnWebType(
|
||||
tableName: string,
|
||||
@@ -550,7 +550,7 @@ export class TableManagementService {
|
||||
): Promise<void> {
|
||||
try {
|
||||
logger.info(
|
||||
`컬럼 웹 타입 설정 시작: ${tableName}.${columnName} = ${webType}`
|
||||
`컬럼 입력 타입 설정 시작: ${tableName}.${columnName} = ${webType}`
|
||||
);
|
||||
|
||||
// 웹 타입별 기본 상세 설정 생성
|
||||
@@ -562,35 +562,28 @@ export class TableManagementService {
|
||||
...detailSettings,
|
||||
};
|
||||
|
||||
// column_labels UPSERT로 업데이트 또는 생성
|
||||
// column_labels UPSERT로 업데이트 또는 생성 (input_type만 사용)
|
||||
await query(
|
||||
`INSERT INTO column_labels (
|
||||
table_name, column_name, web_type, detail_settings, input_type, created_date, updated_date
|
||||
) VALUES ($1, $2, $3, $4, $5, NOW(), NOW())
|
||||
table_name, column_name, input_type, detail_settings, created_date, updated_date
|
||||
) VALUES ($1, $2, $3, $4, NOW(), NOW())
|
||||
ON CONFLICT (table_name, column_name)
|
||||
DO UPDATE SET
|
||||
web_type = EXCLUDED.web_type,
|
||||
input_type = EXCLUDED.input_type,
|
||||
detail_settings = EXCLUDED.detail_settings,
|
||||
input_type = COALESCE(EXCLUDED.input_type, column_labels.input_type),
|
||||
updated_date = NOW()`,
|
||||
[
|
||||
tableName,
|
||||
columnName,
|
||||
webType,
|
||||
JSON.stringify(finalDetailSettings),
|
||||
inputType || null,
|
||||
]
|
||||
[tableName, columnName, webType, JSON.stringify(finalDetailSettings)]
|
||||
);
|
||||
logger.info(
|
||||
`컬럼 웹 타입 설정 완료: ${tableName}.${columnName} = ${webType}`
|
||||
`컬럼 입력 타입 설정 완료: ${tableName}.${columnName} = ${webType}`
|
||||
);
|
||||
} catch (error) {
|
||||
logger.error(
|
||||
`컬럼 웹 타입 설정 중 오류 발생: ${tableName}.${columnName}`,
|
||||
`컬럼 입력 타입 설정 중 오류 발생: ${tableName}.${columnName}`,
|
||||
error
|
||||
);
|
||||
throw new Error(
|
||||
`컬럼 웹 타입 설정 실패: ${error instanceof Error ? error.message : "Unknown error"}`
|
||||
`컬럼 입력 타입 설정 실패: ${error instanceof Error ? error.message : "Unknown error"}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user