feat: Add procedure and function management in flow controller
- Introduced new endpoints in FlowController for listing procedures and retrieving procedure parameters, enhancing the flow management capabilities. - Updated FlowDataMoveService to support procedure calls during data movement, ensuring seamless integration with external and internal databases. - Enhanced NodeFlowExecutionService to execute procedure call actions, allowing for dynamic execution of stored procedures within flow nodes. - Updated frontend components to support procedure selection and parameter management, improving user experience in configuring flow steps. - Added necessary types and API functions for handling procedure-related data, ensuring type safety and clarity in implementation.
This commit is contained in:
@@ -9,6 +9,7 @@ import { FlowStepService } from "../services/flowStepService";
|
||||
import { FlowConnectionService } from "../services/flowConnectionService";
|
||||
import { FlowExecutionService } from "../services/flowExecutionService";
|
||||
import { FlowDataMoveService } from "../services/flowDataMoveService";
|
||||
import { FlowProcedureService } from "../services/flowProcedureService";
|
||||
|
||||
export class FlowController {
|
||||
private flowDefinitionService: FlowDefinitionService;
|
||||
@@ -16,6 +17,7 @@ export class FlowController {
|
||||
private flowConnectionService: FlowConnectionService;
|
||||
private flowExecutionService: FlowExecutionService;
|
||||
private flowDataMoveService: FlowDataMoveService;
|
||||
private flowProcedureService: FlowProcedureService;
|
||||
|
||||
constructor() {
|
||||
this.flowDefinitionService = new FlowDefinitionService();
|
||||
@@ -23,6 +25,7 @@ export class FlowController {
|
||||
this.flowConnectionService = new FlowConnectionService();
|
||||
this.flowExecutionService = new FlowExecutionService();
|
||||
this.flowDataMoveService = new FlowDataMoveService();
|
||||
this.flowProcedureService = new FlowProcedureService();
|
||||
}
|
||||
|
||||
// ==================== 플로우 정의 ====================
|
||||
@@ -936,4 +939,94 @@ export class FlowController {
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// ==================== 프로시저/함수 ====================
|
||||
|
||||
/**
|
||||
* 프로시저/함수 목록 조회
|
||||
*/
|
||||
listProcedures = async (req: Request, res: Response): Promise<void> => {
|
||||
try {
|
||||
const dbSource = (req.query.dbSource as string) || "internal";
|
||||
const connectionId = req.query.connectionId
|
||||
? parseInt(req.query.connectionId as string)
|
||||
: undefined;
|
||||
const schema = req.query.schema as string | undefined;
|
||||
|
||||
if (dbSource !== "internal" && dbSource !== "external") {
|
||||
res.status(400).json({
|
||||
success: false,
|
||||
message: "dbSource는 internal 또는 external이어야 합니다",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (dbSource === "external" && !connectionId) {
|
||||
res.status(400).json({
|
||||
success: false,
|
||||
message: "외부 DB 조회 시 connectionId가 필요합니다",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const procedures = await this.flowProcedureService.listProcedures(
|
||||
dbSource,
|
||||
connectionId,
|
||||
schema
|
||||
);
|
||||
|
||||
res.json({ success: true, data: procedures });
|
||||
} catch (error: any) {
|
||||
console.error("프로시저 목록 조회 실패:", error);
|
||||
res.status(500).json({
|
||||
success: false,
|
||||
message: error.message || "프로시저 목록 조회에 실패했습니다",
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 프로시저/함수 파라미터 조회
|
||||
*/
|
||||
getProcedureParameters = async (req: Request, res: Response): Promise<void> => {
|
||||
try {
|
||||
const { name } = req.params;
|
||||
const dbSource = (req.query.dbSource as string) || "internal";
|
||||
const connectionId = req.query.connectionId
|
||||
? parseInt(req.query.connectionId as string)
|
||||
: undefined;
|
||||
const schema = req.query.schema as string | undefined;
|
||||
|
||||
if (!name) {
|
||||
res.status(400).json({
|
||||
success: false,
|
||||
message: "프로시저 이름이 필요합니다",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (dbSource !== "internal" && dbSource !== "external") {
|
||||
res.status(400).json({
|
||||
success: false,
|
||||
message: "dbSource는 internal 또는 external이어야 합니다",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const parameters = await this.flowProcedureService.getProcedureParameters(
|
||||
name,
|
||||
dbSource as "internal" | "external",
|
||||
connectionId,
|
||||
schema
|
||||
);
|
||||
|
||||
res.json({ success: true, data: parameters });
|
||||
} catch (error: any) {
|
||||
console.error("프로시저 파라미터 조회 실패:", error);
|
||||
res.status(500).json({
|
||||
success: false,
|
||||
message: error.message || "프로시저 파라미터 조회에 실패했습니다",
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user