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,6 +1,5 @@
import Step from '../../models/step';
import flowType, { flowInputType } from '../types/flow';
import RequestWithCurrentUser from '../../types/express/request-with-current-user';
import Context from '../../types/express/context';
type Params = {
input: {
@@ -8,13 +7,14 @@ type Params = {
};
};
const createFlowResolver = async (
const createFlow = async (
_parent: unknown,
params: Params,
req: RequestWithCurrentUser
context: Context
) => {
const appKey = params?.input?.triggerAppKey;
const flow = await req.currentUser.$relatedQuery('flows').insert({
const flow = await context.currentUser.$relatedQuery('flows').insert({
name: 'Name your flow',
});
@@ -28,13 +28,4 @@ const createFlowResolver = async (
return flow;
};
const createFlow = {
type: flowType,
args: {
input: { type: flowInputType },
},
resolve: (_: any, params: Params, req: RequestWithCurrentUser) =>
createFlowResolver(params, req),
};
export default createFlow;