feat: Implement getFlows graphQL query

This commit is contained in:
Faruk AYDIN
2021-12-09 17:42:22 +01:00
committed by Ömer Faruk Aydın
parent d8c216d8c8
commit 95d38b740e
2 changed files with 21 additions and 1 deletions

View File

@@ -0,0 +1,18 @@
import { GraphQLList, GraphQLString } from 'graphql';
import Flow from '../../models/flow';
import RequestWithCurrentUser from '../../types/express/request-with-current-user';
import flowType from '../types/flow';
const getFlowsResolver = async (req: RequestWithCurrentUser) => {
const flows = await Flow.query()
.where({ user_id: req.currentUser.id});
return flows;
}
const getFlows = {
type: GraphQLList(flowType),
resolve: (_: any, _params: any, req: RequestWithCurrentUser) => getFlowsResolver(req)
}
export default getFlows;