chore: remove redundant create flow mutation
This commit is contained in:
@@ -5,7 +5,6 @@ import executeFlow from './mutations/execute-flow.js';
|
|||||||
import updateUser from './mutations/update-user.ee.js';
|
import updateUser from './mutations/update-user.ee.js';
|
||||||
import deleteStep from './mutations/delete-step.js';
|
import deleteStep from './mutations/delete-step.js';
|
||||||
import verifyConnection from './mutations/verify-connection.js';
|
import verifyConnection from './mutations/verify-connection.js';
|
||||||
import createFlow from './mutations/create-flow.js';
|
|
||||||
import deleteCurrentUser from './mutations/delete-current-user.ee.js';
|
import deleteCurrentUser from './mutations/delete-current-user.ee.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';
|
||||||
@@ -18,7 +17,6 @@ import updateFlowStatus from './mutations/update-flow-status.js';
|
|||||||
|
|
||||||
const mutationResolvers = {
|
const mutationResolvers = {
|
||||||
createConnection,
|
createConnection,
|
||||||
createFlow,
|
|
||||||
createUser,
|
createUser,
|
||||||
deleteCurrentUser,
|
deleteCurrentUser,
|
||||||
deleteFlow,
|
deleteFlow,
|
||||||
|
@@ -1,45 +0,0 @@
|
|||||||
import App from '../../models/app.js';
|
|
||||||
import Step from '../../models/step.js';
|
|
||||||
|
|
||||||
const createFlow = async (_parent, params, context) => {
|
|
||||||
context.currentUser.can('create', 'Flow');
|
|
||||||
|
|
||||||
const connectionId = params?.input?.connectionId;
|
|
||||||
const appKey = params?.input?.triggerAppKey;
|
|
||||||
|
|
||||||
if (appKey) {
|
|
||||||
await App.findOneByKey(appKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
const flow = await context.currentUser.$relatedQuery('flows').insert({
|
|
||||||
name: 'Name your flow',
|
|
||||||
});
|
|
||||||
|
|
||||||
if (connectionId) {
|
|
||||||
const hasConnection = await context.currentUser
|
|
||||||
.$relatedQuery('connections')
|
|
||||||
.findById(connectionId);
|
|
||||||
|
|
||||||
if (!hasConnection) {
|
|
||||||
throw new Error('The connection does not exist!');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
await Step.query().insert({
|
|
||||||
flowId: flow.id,
|
|
||||||
type: 'trigger',
|
|
||||||
position: 1,
|
|
||||||
appKey,
|
|
||||||
connectionId,
|
|
||||||
});
|
|
||||||
|
|
||||||
await Step.query().insert({
|
|
||||||
flowId: flow.id,
|
|
||||||
type: 'action',
|
|
||||||
position: 2,
|
|
||||||
});
|
|
||||||
|
|
||||||
return flow;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default createFlow;
|
|
@@ -3,7 +3,6 @@ type Query {
|
|||||||
}
|
}
|
||||||
type Mutation {
|
type Mutation {
|
||||||
createConnection(input: CreateConnectionInput): Connection
|
createConnection(input: CreateConnectionInput): Connection
|
||||||
createFlow(input: CreateFlowInput): Flow
|
|
||||||
createUser(input: CreateUserInput): UserWithAcceptInvitationUrl
|
createUser(input: CreateUserInput): UserWithAcceptInvitationUrl
|
||||||
deleteCurrentUser: Boolean
|
deleteCurrentUser: Boolean
|
||||||
deleteFlow(input: DeleteFlowInput): Boolean
|
deleteFlow(input: DeleteFlowInput): Boolean
|
||||||
@@ -240,11 +239,6 @@ input VerifyConnectionInput {
|
|||||||
id: String!
|
id: String!
|
||||||
}
|
}
|
||||||
|
|
||||||
input CreateFlowInput {
|
|
||||||
triggerAppKey: String
|
|
||||||
connectionId: String
|
|
||||||
}
|
|
||||||
|
|
||||||
input UpdateFlowStatusInput {
|
input UpdateFlowStatusInput {
|
||||||
id: String!
|
id: String!
|
||||||
active: Boolean!
|
active: Boolean!
|
||||||
|
@@ -1,9 +0,0 @@
|
|||||||
import { gql } from '@apollo/client';
|
|
||||||
export const CREATE_FLOW = gql`
|
|
||||||
mutation CreateFlow($input: CreateFlowInput) {
|
|
||||||
createFlow(input: $input) {
|
|
||||||
id
|
|
||||||
name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
Reference in New Issue
Block a user