diff --git a/packages/backend/src/graphql/queries/get-flow.ts b/packages/backend/src/graphql/queries/get-flow.ts index 87f2b85c..ac980d76 100644 --- a/packages/backend/src/graphql/queries/get-flow.ts +++ b/packages/backend/src/graphql/queries/get-flow.ts @@ -4,24 +4,26 @@ import RequestWithCurrentUser from '../../types/express/request-with-current-use import flowType from '../types/flow'; type Params = { - id: number -} + id: number; +}; const getFlowResolver = async (params: Params, req: RequestWithCurrentUser) => { const flow = await Flow.query() .withGraphJoined('[steps.[connection]]') - .findOne({'flows.user_id': req.currentUser.id, 'flows.id': params.id}) + .orderBy('steps.position', 'asc') + .findOne({ 'flows.user_id': req.currentUser.id, 'flows.id': params.id }) .throwIfNotFound(); return flow; -} +}; const getFlow = { type: flowType, args: { id: { type: GraphQLNonNull(GraphQLInt) }, }, - resolve: (_: any, params: Params, req: RequestWithCurrentUser) => getFlowResolver(params, req) -} + resolve: (_: any, params: Params, req: RequestWithCurrentUser) => + getFlowResolver(params, req), +}; export default getFlow;