feat: Implement getFlows graphQL query
This commit is contained in:

committed by
Ömer Faruk Aydın

parent
d8c216d8c8
commit
95d38b740e
18
packages/backend/src/graphql/queries/get-flows.ts
Normal file
18
packages/backend/src/graphql/queries/get-flows.ts
Normal 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;
|
@@ -4,6 +4,7 @@ import getApp from './queries/get-app';
|
||||
import getConnectedApps from './queries/get-connected-apps';
|
||||
import getAppConnections from './queries/get-app-connections';
|
||||
import testConnection from './queries/test-connection';
|
||||
import getFlows from './queries/get-flows';
|
||||
|
||||
const rootQuery = new GraphQLObjectType({
|
||||
name: 'Query',
|
||||
@@ -12,7 +13,8 @@ const rootQuery = new GraphQLObjectType({
|
||||
getApp,
|
||||
getConnectedApps,
|
||||
getAppConnections,
|
||||
testConnection
|
||||
testConnection,
|
||||
getFlows
|
||||
}
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user