플로우 외부db연결
This commit is contained in:
@@ -24,9 +24,11 @@ export class FlowStepService {
|
||||
const query = `
|
||||
INSERT INTO flow_step (
|
||||
flow_definition_id, step_name, step_order, table_name, condition_json,
|
||||
color, position_x, position_y
|
||||
color, position_x, position_y, move_type, status_column, status_value,
|
||||
target_table, field_mappings, required_fields,
|
||||
integration_type, integration_config
|
||||
)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16)
|
||||
RETURNING *
|
||||
`;
|
||||
|
||||
@@ -39,6 +41,16 @@ export class FlowStepService {
|
||||
request.color || "#3B82F6",
|
||||
request.positionX || 0,
|
||||
request.positionY || 0,
|
||||
request.moveType || null,
|
||||
request.statusColumn || null,
|
||||
request.statusValue || null,
|
||||
request.targetTable || null,
|
||||
request.fieldMappings ? JSON.stringify(request.fieldMappings) : null,
|
||||
request.requiredFields ? JSON.stringify(request.requiredFields) : null,
|
||||
request.integrationType || "internal",
|
||||
request.integrationConfig
|
||||
? JSON.stringify(request.integrationConfig)
|
||||
: null,
|
||||
]);
|
||||
|
||||
return this.mapToFlowStep(result[0]);
|
||||
@@ -79,6 +91,13 @@ export class FlowStepService {
|
||||
id: number,
|
||||
request: UpdateFlowStepRequest
|
||||
): Promise<FlowStep | null> {
|
||||
console.log("🔧 FlowStepService.update called with:", {
|
||||
id,
|
||||
statusColumn: request.statusColumn,
|
||||
statusValue: request.statusValue,
|
||||
fullRequest: JSON.stringify(request),
|
||||
});
|
||||
|
||||
// 조건 검증
|
||||
if (request.conditionJson) {
|
||||
FlowConditionParser.validateConditionGroup(request.conditionJson);
|
||||
@@ -132,6 +151,64 @@ export class FlowStepService {
|
||||
paramIndex++;
|
||||
}
|
||||
|
||||
// 하이브리드 플로우 필드
|
||||
if (request.moveType !== undefined) {
|
||||
fields.push(`move_type = $${paramIndex}`);
|
||||
params.push(request.moveType);
|
||||
paramIndex++;
|
||||
}
|
||||
|
||||
if (request.statusColumn !== undefined) {
|
||||
fields.push(`status_column = $${paramIndex}`);
|
||||
params.push(request.statusColumn);
|
||||
paramIndex++;
|
||||
}
|
||||
|
||||
if (request.statusValue !== undefined) {
|
||||
fields.push(`status_value = $${paramIndex}`);
|
||||
params.push(request.statusValue);
|
||||
paramIndex++;
|
||||
}
|
||||
|
||||
if (request.targetTable !== undefined) {
|
||||
fields.push(`target_table = $${paramIndex}`);
|
||||
params.push(request.targetTable);
|
||||
paramIndex++;
|
||||
}
|
||||
|
||||
if (request.fieldMappings !== undefined) {
|
||||
fields.push(`field_mappings = $${paramIndex}`);
|
||||
params.push(
|
||||
request.fieldMappings ? JSON.stringify(request.fieldMappings) : null
|
||||
);
|
||||
paramIndex++;
|
||||
}
|
||||
|
||||
if (request.requiredFields !== undefined) {
|
||||
fields.push(`required_fields = $${paramIndex}`);
|
||||
params.push(
|
||||
request.requiredFields ? JSON.stringify(request.requiredFields) : null
|
||||
);
|
||||
paramIndex++;
|
||||
}
|
||||
|
||||
// 외부 연동 필드
|
||||
if (request.integrationType !== undefined) {
|
||||
fields.push(`integration_type = $${paramIndex}`);
|
||||
params.push(request.integrationType);
|
||||
paramIndex++;
|
||||
}
|
||||
|
||||
if (request.integrationConfig !== undefined) {
|
||||
fields.push(`integration_config = $${paramIndex}`);
|
||||
params.push(
|
||||
request.integrationConfig
|
||||
? JSON.stringify(request.integrationConfig)
|
||||
: null
|
||||
);
|
||||
paramIndex++;
|
||||
}
|
||||
|
||||
if (fields.length === 0) {
|
||||
return this.findById(id);
|
||||
}
|
||||
@@ -202,6 +279,9 @@ export class FlowStepService {
|
||||
targetTable: row.target_table || undefined,
|
||||
fieldMappings: row.field_mappings || undefined,
|
||||
requiredFields: row.required_fields || undefined,
|
||||
// 외부 연동 필드
|
||||
integrationType: row.integration_type || "internal",
|
||||
integrationConfig: row.integration_config || undefined,
|
||||
createdAt: row.created_at,
|
||||
updatedAt: row.updated_at,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user