chore: Expose connection with step type instead of only connectionId

This commit is contained in:
Faruk AYDIN
2021-12-24 20:11:19 +03:00
committed by Ömer Faruk Aydın
parent 11bdbf1727
commit a58411ee99
4 changed files with 16 additions and 7 deletions

View File

@@ -8,11 +8,9 @@ type Params = {
}
const getFlowResolver = async (params: Params, req: RequestWithCurrentUser) => {
const flowParams = { user_id: req.currentUser.id, id: params.id }
const flow = await Flow.query()
.withGraphFetched('steps')
.findOne(flowParams)
.withGraphJoined('[steps.[connection]]')
.findOne({'flows.user_id': req.currentUser.id, 'flows.id': params.id})
.throwIfNotFound();
return flow;

View File

@@ -5,7 +5,8 @@ import flowType from '../types/flow';
const getFlowsResolver = async (req: RequestWithCurrentUser) => {
const flows = await Flow.query()
.where({ user_id: req.currentUser.id});
.withGraphJoined('[steps.[connection]]')
.where({'flows.user_id': req.currentUser.id});
return flows;
}