Integrate Flowgram visual workflow editor: update data models and add dependencies

Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-11-09 10:27:36 +00:00
co-authored by whyour
parent 3b95ea64d3
commit fffc1e4fd1
6 changed files with 219 additions and 9 deletions
+4 -2
View File
@@ -30,13 +30,14 @@ export default (app: Router) => {
body: Joi.object({
name: Joi.string().required(),
description: Joi.string().optional().allow(''),
workflowGraph: Joi.object().optional(),
triggerType: Joi.string()
.valid('variable', 'webhook', 'task_status', 'time', 'system_event')
.required(),
.optional(),
triggerConfig: Joi.object().optional(),
conditionLogic: Joi.string().valid('AND', 'OR').default('AND'),
conditions: Joi.array().optional().default([]),
actions: Joi.array().required(),
actions: Joi.array().optional(),
retryStrategy: Joi.object({
maxRetries: Joi.number().min(0).max(10),
retryDelay: Joi.number().min(1),
@@ -67,6 +68,7 @@ export default (app: Router) => {
id: Joi.number().required(),
name: Joi.string().optional(),
description: Joi.string().optional().allow(''),
workflowGraph: Joi.object().optional(),
triggerType: Joi.string()
.valid('variable', 'webhook', 'task_status', 'time', 'system_event')
.optional(),
+12 -6
View File
@@ -6,11 +6,12 @@ export class Scenario {
name: string;
description?: string;
isEnabled?: 1 | 0;
triggerType?: string; // 'variable' | 'webhook' | 'task_status' | 'time' | 'system_event'
triggerConfig?: any; // JSON configuration for the trigger
conditionLogic?: 'AND' | 'OR';
conditions?: any[]; // Array of condition objects
actions?: any[]; // Array of actions to execute
workflowGraph?: any; // Flowgram workflow graph structure
triggerType?: string; // Deprecated: kept for backward compatibility
triggerConfig?: any; // Deprecated: kept for backward compatibility
conditionLogic?: 'AND' | 'OR'; // Deprecated: kept for backward compatibility
conditions?: any[]; // Deprecated: kept for backward compatibility
actions?: any[]; // Deprecated: kept for backward compatibility
retryStrategy?: {
maxRetries: number;
retryDelay: number; // in seconds
@@ -33,6 +34,7 @@ export class Scenario {
this.name = options.name;
this.description = options.description;
this.isEnabled = options.isEnabled ?? 1;
this.workflowGraph = options.workflowGraph || null;
this.triggerType = options.triggerType;
this.triggerConfig = options.triggerConfig;
this.conditionLogic = options.conditionLogic || 'AND';
@@ -64,9 +66,13 @@ export const ScenarioModel = sequelize.define<ScenarioInstance>('Scenario', {
type: DataTypes.NUMBER,
defaultValue: 1,
},
workflowGraph: {
type: DataTypes.JSON,
allowNull: true,
},
triggerType: {
type: DataTypes.STRING,
allowNull: false,
allowNull: true,
},
triggerConfig: {
type: DataTypes.JSON,
+3
View File
@@ -60,6 +60,9 @@ export default async () => {
try {
await sequelize.query('alter table Crontabs add column task_after TEXT');
} catch (error) {}
try {
await sequelize.query('alter table Scenarios add column workflowGraph JSON');
} catch (error) {}
Logger.info('✌️ DB loaded');
} catch (error) {