feat: Return only related flows with given app
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
|
@@ -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(
|
||||
|
Reference in New Issue
Block a user