chore: remove redundant execute flow mutation

This commit is contained in:
Ali BARIN
2024-09-19 09:09:32 +00:00
parent 84d5b3b158
commit 32f7bbfbab
4 changed files with 0 additions and 52 deletions

View File

@@ -1,28 +0,0 @@
import testRun from '../../services/test-run.js';
import Step from '../../models/step.js';
const executeFlow = async (_parent, params, context) => {
const conditions = context.currentUser.can('update', 'Flow');
const isCreator = conditions.isCreator;
const allSteps = Step.query();
const userSteps = context.currentUser.$relatedQuery('steps');
const baseQuery = isCreator ? userSteps : allSteps;
const { stepId } = params.input;
const untilStep = await baseQuery.clone().findById(stepId).throwIfNotFound();
const { executionStep } = await testRun({ stepId });
if (executionStep.isFailed) {
throw new Error(JSON.stringify(executionStep.errorDetails));
}
await untilStep.$query().patch({
status: 'completed',
});
return { data: executionStep.dataOut, step: untilStep };
};
export default executeFlow;