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;
|
Reference in New Issue
Block a user