From 726707afe88038f2b12de3ca83dcb501dcb1e610 Mon Sep 17 00:00:00 2001 From: Ali BARIN Date: Sun, 7 Aug 2022 15:10:11 +0200 Subject: [PATCH] feat: add search capability by name in getFlows --- packages/backend/src/graphql/queries/get-flows.ts | 5 +++++ packages/backend/src/graphql/schema.graphql | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/backend/src/graphql/queries/get-flows.ts b/packages/backend/src/graphql/queries/get-flows.ts index f8a93b05..b6fb95a1 100644 --- a/packages/backend/src/graphql/queries/get-flows.ts +++ b/packages/backend/src/graphql/queries/get-flows.ts @@ -3,6 +3,7 @@ import paginate from '../../helpers/pagination'; type Params = { appKey?: string; + name?: string; limit: number; offset: number; }; @@ -13,6 +14,10 @@ const getFlows = async (_parent: unknown, params: Params, context: Context) => { .joinRelated('steps') .withGraphFetched('steps.[connection]') .where((builder) => { + if (params.name) { + builder.where('flows.name', 'like', `%${params.name}%`); + } + if (params.appKey) { builder.where('steps.app_key', params.appKey); } diff --git a/packages/backend/src/graphql/schema.graphql b/packages/backend/src/graphql/schema.graphql index 242893ec..ed3717d4 100644 --- a/packages/backend/src/graphql/schema.graphql +++ b/packages/backend/src/graphql/schema.graphql @@ -4,7 +4,12 @@ type Query { getConnectedApps(name: String): [App] testConnection(id: String!): Connection getFlow(id: String!): Flow - getFlows(limit: Int!, offset: Int!, appKey: String): FlowConnection + getFlows( + limit: Int! + offset: Int! + appKey: String + name: String + ): FlowConnection getStepWithTestExecutions(stepId: String!): [Step] getExecutions(limit: Int!, offset: Int!): ExecutionConnection getExecutionSteps(