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,21 +1,15 @@
import { GraphQLList } from 'graphql';
import RequestWithCurrentUser from '../../types/express/request-with-current-user';
import flowType from '../types/flow';
import Context from '../../types/express/context';
const getFlowsResolver = async (
req: RequestWithCurrentUser
): Promise<any[]> => {
const flows = await req.currentUser
const getFlows = async (
_parent: unknown,
_params: unknown,
context: Context
) => {
const flows = await context.currentUser
.$relatedQuery('flows')
.withGraphJoined('[steps.[connection]]');
return flows;
};
const getFlows = {
type: GraphQLList(flowType),
resolve: (_: any, _params: any, req: RequestWithCurrentUser) =>
getFlowsResolver(req),
};
export default getFlows;