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