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,16 +1,15 @@
import { GraphQLString, GraphQLNonNull } from 'graphql';
import RequestWithCurrentUser from '../../types/express/request-with-current-user';
import stepType from '../types/step';
import Context from '../../types/express/context';
type Params = {
id: string;
};
const deleteStepResolver = async (
const deleteStep = async (
_parent: unknown,
params: Params,
req: RequestWithCurrentUser
context: Context
) => {
const step = await req.currentUser
const step = await context.currentUser
.$relatedQuery('steps')
.withGraphFetched('flow')
.findOne({
@@ -40,13 +39,4 @@ const deleteStepResolver = async (
return step;
};
const deleteStep = {
type: stepType,
args: {
id: { type: GraphQLNonNull(GraphQLString) },
},
resolve: (_: any, params: Params, req: RequestWithCurrentUser) =>
deleteStepResolver(params, req),
};
export default deleteStep;