엔티티조인 읽기전용 컬럼 추가
This commit is contained in:
@@ -484,6 +484,7 @@ export class EntityJoinController {
|
||||
columnName: col.columnName,
|
||||
columnLabel: col.displayName || col.columnName,
|
||||
dataType: col.dataType,
|
||||
inputType: col.inputType || "text",
|
||||
isNullable: true, // 기본값으로 설정
|
||||
maxLength: undefined, // 정보가 없으므로 undefined
|
||||
description: col.displayName,
|
||||
@@ -512,6 +513,7 @@ export class EntityJoinController {
|
||||
columnName: string;
|
||||
columnLabel: string;
|
||||
dataType: string;
|
||||
inputType: string;
|
||||
joinAlias: string;
|
||||
suggestedLabel: string;
|
||||
}> = [];
|
||||
@@ -526,6 +528,7 @@ export class EntityJoinController {
|
||||
columnName: col.columnName,
|
||||
columnLabel: col.columnLabel,
|
||||
dataType: col.dataType,
|
||||
inputType: col.inputType || "text",
|
||||
joinAlias,
|
||||
suggestedLabel,
|
||||
});
|
||||
|
||||
@@ -704,6 +704,7 @@ export class EntityJoinService {
|
||||
columnName: string;
|
||||
displayName: string;
|
||||
dataType: string;
|
||||
inputType?: string;
|
||||
}>
|
||||
> {
|
||||
try {
|
||||
@@ -722,31 +723,39 @@ export class EntityJoinService {
|
||||
[tableName]
|
||||
);
|
||||
|
||||
// 2. column_labels 테이블에서 라벨 정보 조회
|
||||
// 2. column_labels 테이블에서 라벨과 input_type 정보 조회
|
||||
const columnLabels = await query<{
|
||||
column_name: string;
|
||||
column_label: string | null;
|
||||
input_type: string | null;
|
||||
}>(
|
||||
`SELECT column_name, column_label
|
||||
`SELECT column_name, column_label, input_type
|
||||
FROM column_labels
|
||||
WHERE table_name = $1`,
|
||||
[tableName]
|
||||
);
|
||||
|
||||
// 3. 라벨 정보를 맵으로 변환
|
||||
const labelMap = new Map<string, string>();
|
||||
columnLabels.forEach((label) => {
|
||||
if (label.column_name && label.column_label) {
|
||||
labelMap.set(label.column_name, label.column_label);
|
||||
// 3. 라벨 및 inputType 정보를 맵으로 변환
|
||||
const labelMap = new Map<string, { label: string; inputType: string }>();
|
||||
columnLabels.forEach((col) => {
|
||||
if (col.column_name) {
|
||||
labelMap.set(col.column_name, {
|
||||
label: col.column_label || col.column_name,
|
||||
inputType: col.input_type || "text",
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// 4. 컬럼 정보와 라벨 정보 결합
|
||||
return columns.map((col) => ({
|
||||
columnName: col.column_name,
|
||||
displayName: labelMap.get(col.column_name) || col.column_name, // 라벨이 있으면 사용, 없으면 컬럼명
|
||||
dataType: col.data_type,
|
||||
}));
|
||||
// 4. 컬럼 정보와 라벨/inputType 정보 결합
|
||||
return columns.map((col) => {
|
||||
const labelInfo = labelMap.get(col.column_name);
|
||||
return {
|
||||
columnName: col.column_name,
|
||||
displayName: labelInfo?.label || col.column_name,
|
||||
dataType: col.data_type,
|
||||
inputType: labelInfo?.inputType || "text",
|
||||
};
|
||||
});
|
||||
} catch (error) {
|
||||
logger.error(`참조 테이블 컬럼 조회 실패: ${tableName}`, error);
|
||||
return [];
|
||||
|
||||
Reference in New Issue
Block a user