chore: remove redundant execute flow mutation
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
// Converted mutations
|
||||
import executeFlow from './mutations/execute-flow.js';
|
||||
import verifyConnection from './mutations/verify-connection.js';
|
||||
import updateCurrentUser from './mutations/update-current-user.js';
|
||||
import generateAuthUrl from './mutations/generate-auth-url.js';
|
||||
@@ -9,7 +8,6 @@ import updateConnection from './mutations/update-connection.js';
|
||||
|
||||
const mutationResolvers = {
|
||||
createConnection,
|
||||
executeFlow,
|
||||
generateAuthUrl,
|
||||
resetConnection,
|
||||
updateConnection,
|
||||
|
@@ -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;
|
@@ -3,7 +3,6 @@ type Query {
|
||||
}
|
||||
type Mutation {
|
||||
createConnection(input: CreateConnectionInput): Connection
|
||||
executeFlow(input: ExecuteFlowInput): executeFlowType
|
||||
generateAuthUrl(input: GenerateAuthUrlInput): AuthLink
|
||||
resetConnection(input: ResetConnectionInput): Connection
|
||||
updateConnection(input: UpdateConnectionInput): Connection
|
||||
@@ -153,11 +152,6 @@ type ConnectionData {
|
||||
screenName: String
|
||||
}
|
||||
|
||||
type executeFlowType {
|
||||
data: JSONObject
|
||||
step: Step
|
||||
}
|
||||
|
||||
type ExecutionStep {
|
||||
id: String
|
||||
executionId: String
|
||||
@@ -232,10 +226,6 @@ input VerifyConnectionInput {
|
||||
id: String!
|
||||
}
|
||||
|
||||
input ExecuteFlowInput {
|
||||
stepId: String!
|
||||
}
|
||||
|
||||
input UserRoleInput {
|
||||
id: String
|
||||
}
|
||||
|
@@ -1,12 +0,0 @@
|
||||
import { gql } from '@apollo/client';
|
||||
export const EXECUTE_FLOW = gql`
|
||||
mutation ExecuteFlow($input: ExecuteFlowInput) {
|
||||
executeFlow(input: $input) {
|
||||
step {
|
||||
id
|
||||
status
|
||||
}
|
||||
data
|
||||
}
|
||||
}
|
||||
`;
|
Reference in New Issue
Block a user