diff --git a/packages/backend/src/graphql/queries/get-flows.ts b/packages/backend/src/graphql/queries/get-flows.ts index 0fa92bd4..10e3c68a 100644 --- a/packages/backend/src/graphql/queries/get-flows.ts +++ b/packages/backend/src/graphql/queries/get-flows.ts @@ -1,15 +1,21 @@ import Context from '../../types/express/context'; -const getFlows = async ( - _parent: unknown, - _params: unknown, - context: Context -) => { - const flows = await context.currentUser +type Params = { + appKey?: string; +}; + +const getFlows = async (_parent: unknown, params: Params, context: Context) => { + const flowsQuery = context.currentUser .$relatedQuery('flows') .withGraphJoined('[steps.[connection]]') .orderBy('created_at', 'desc'); + if (params.appKey) { + flowsQuery.where('steps.app_key', params.appKey); + } + + const flows = await flowsQuery; + return flows; }; diff --git a/packages/backend/src/graphql/schema.graphql b/packages/backend/src/graphql/schema.graphql index 1a44fdaf..1ff4e843 100644 --- a/packages/backend/src/graphql/schema.graphql +++ b/packages/backend/src/graphql/schema.graphql @@ -5,7 +5,7 @@ type Query { getAppConnections(key: AvailableAppsEnumType!): [Connection] testConnection(id: String!): Connection getFlow(id: String!): Flow - getFlows: [Flow] + getFlows(appKey: String): [Flow] getStepWithTestExecutions(stepId: String!): [Step] getExecutions(limit: Int!, offset: Int!): ExecutionConnection getExecutionSteps(