플로우 위젝 라벨표시 및 , 배치관리 회사별 분리

This commit is contained in:
kjs
2025-10-28 12:06:54 +09:00
parent c0f2fbbd88
commit 7c45b3e254
8 changed files with 486 additions and 270 deletions

View File

@@ -557,9 +557,14 @@ export class FlowController {
getStepColumnLabels = async (req: Request, res: Response): Promise<void> => {
try {
const { flowId, stepId } = req.params;
console.log("🏷️ [FlowController] 컬럼 라벨 조회 요청:", {
flowId,
stepId,
});
const step = await this.flowStepService.getById(parseInt(stepId));
const step = await this.flowStepService.findById(parseInt(stepId));
if (!step) {
console.warn("⚠️ [FlowController] 스텝을 찾을 수 없음:", stepId);
res.status(404).json({
success: false,
message: "Step not found",
@@ -567,10 +572,11 @@ export class FlowController {
return;
}
const flowDef = await this.flowDefinitionService.getById(
const flowDef = await this.flowDefinitionService.findById(
parseInt(flowId)
);
if (!flowDef) {
console.warn("⚠️ [FlowController] 플로우를 찾을 수 없음:", flowId);
res.status(404).json({
success: false,
message: "Flow definition not found",
@@ -580,7 +586,14 @@ export class FlowController {
// 테이블명 결정 (스텝 테이블 우선, 없으면 플로우 테이블)
const tableName = step.tableName || flowDef.tableName;
console.log("📋 [FlowController] 테이블명 결정:", {
stepTableName: step.tableName,
flowTableName: flowDef.tableName,
selectedTableName: tableName,
});
if (!tableName) {
console.warn("⚠️ [FlowController] 테이블명이 지정되지 않음");
res.json({
success: true,
data: {},
@@ -589,7 +602,7 @@ export class FlowController {
}
// column_labels 테이블에서 라벨 정보 조회
const { query } = await import("../config/database");
const { query } = await import("../database/db");
const labelRows = await query<{
column_name: string;
column_label: string | null;
@@ -600,6 +613,15 @@ export class FlowController {
[tableName]
);
console.log(`✅ [FlowController] column_labels 조회 완료:`, {
tableName,
rowCount: labelRows.length,
labels: labelRows.map((r) => ({
col: r.column_name,
label: r.column_label,
})),
});
// { columnName: label } 형태의 객체로 변환
const labels: Record<string, string> = {};
labelRows.forEach((row) => {
@@ -608,12 +630,14 @@ export class FlowController {
}
});
console.log("📦 [FlowController] 반환할 라벨 객체:", labels);
res.json({
success: true,
data: labels,
});
} catch (error: any) {
console.error("Error getting step column labels:", error);
console.error("❌ [FlowController] 컬럼 라벨 조회 오류:", error);
res.status(500).json({
success: false,
message: error.message || "Failed to get step column labels",