feat: Return only related flows with given app
This commit is contained in:
@@ -1,15 +1,21 @@
|
|||||||
import Context from '../../types/express/context';
|
import Context from '../../types/express/context';
|
||||||
|
|
||||||
const getFlows = async (
|
type Params = {
|
||||||
_parent: unknown,
|
appKey?: string;
|
||||||
_params: unknown,
|
};
|
||||||
context: Context
|
|
||||||
) => {
|
const getFlows = async (_parent: unknown, params: Params, context: Context) => {
|
||||||
const flows = await context.currentUser
|
const flowsQuery = context.currentUser
|
||||||
.$relatedQuery('flows')
|
.$relatedQuery('flows')
|
||||||
.withGraphJoined('[steps.[connection]]')
|
.withGraphJoined('[steps.[connection]]')
|
||||||
.orderBy('created_at', 'desc');
|
.orderBy('created_at', 'desc');
|
||||||
|
|
||||||
|
if (params.appKey) {
|
||||||
|
flowsQuery.where('steps.app_key', params.appKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
const flows = await flowsQuery;
|
||||||
|
|
||||||
return flows;
|
return flows;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -5,7 +5,7 @@ type Query {
|
|||||||
getAppConnections(key: AvailableAppsEnumType!): [Connection]
|
getAppConnections(key: AvailableAppsEnumType!): [Connection]
|
||||||
testConnection(id: String!): Connection
|
testConnection(id: String!): Connection
|
||||||
getFlow(id: String!): Flow
|
getFlow(id: String!): Flow
|
||||||
getFlows: [Flow]
|
getFlows(appKey: String): [Flow]
|
||||||
getStepWithTestExecutions(stepId: String!): [Step]
|
getStepWithTestExecutions(stepId: String!): [Step]
|
||||||
getExecutions(limit: Int!, offset: Int!): ExecutionConnection
|
getExecutions(limit: Int!, offset: Int!): ExecutionConnection
|
||||||
getExecutionSteps(
|
getExecutionSteps(
|
||||||
|
Reference in New Issue
Block a user