chore: Order steps by position ascending
This commit is contained in:
@@ -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]]')
|
||||
.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;
|
||||
|
Reference in New Issue
Block a user