feat: Expose flow count with connections of getApp query

This commit is contained in:
Faruk AYDIN
2022-08-13 01:50:03 +03:00
parent c7d5584cd9
commit bb37299c5b
4 changed files with 30 additions and 9 deletions

View File

@@ -11,10 +11,14 @@ const getApp = async (_parent: unknown, params: Params, context: Context) => {
if (context.currentUser) {
const connections = await context.currentUser
.$relatedQuery('connections')
.select('connections.*')
.fullOuterJoinRelated('steps')
.where({
key: params.key,
draft: false,
'connections.key': params.key,
'connections.draft': false,
})
.countDistinct('steps.flow_id as flowCount')
.groupBy('connections.id')
.orderBy('created_at', 'desc');
return {