refactor: Use graphql schema directly with graphql-tools library

This commit is contained in:
Faruk AYDIN
2022-03-06 18:16:28 +03:00
committed by Ömer Faruk Aydın
parent 96cca96bff
commit 9926e5589e
48 changed files with 551 additions and 839 deletions

View File

@@ -1,17 +1,17 @@
import { GraphQLString, GraphQLNonNull } from 'graphql';
import RequestWithCurrentUser from '../../types/express/request-with-current-user';
import executeFlowType from '../types/execute-flow';
import Context from '../../types/express/context';
import Processor from '../../services/processor';
import processorQueue from '../../queues/processor';
type Params = {
stepId: string;
};
const executeFlowResolver = async (
const executeFlow = async (
_parent: unknown,
params: Params,
req: RequestWithCurrentUser
): Promise<any> => {
const step = await req.currentUser
context: Context
) => {
const step = await context.currentUser
.$relatedQuery('steps')
.withGraphFetched('connection')
.findOne({
@@ -35,13 +35,4 @@ const executeFlowResolver = async (
return { data, step };
};
const executeFlow = {
type: executeFlowType,
args: {
stepId: { type: GraphQLNonNull(GraphQLString) },
},
resolve: (_: any, params: Params, req: RequestWithCurrentUser) =>
executeFlowResolver(params, req),
};
export default executeFlow;