refactor: Do not pass response object to throw validation error

This commit is contained in:
Faruk AYDIN
2025-03-10 15:59:39 +01:00
parent 010b8c9ad1
commit c4a94ed902
2 changed files with 4 additions and 10 deletions

View File

@@ -1,14 +1,12 @@
import Crypto from 'crypto';
import Step from '../models/step.js';
import { renderObjectionError } from './renderer.js';
import { ValidationError } from 'objection';
const importFlow = async (user, flowData, response) => {
const importFlow = async (user, flowData) => {
const steps = flowData.steps || [];
// Validation: the first step must be a trigger
if (!steps.length || steps[0].type !== 'trigger') {
return renderObjectionError(response, {
statusCode: 422,
throw new ValidationError({
type: 'ValidationError',
data: {
steps: [{ message: 'The first step must be a trigger!' }],