Merge pull request #430 from automatisch/issue-425

feat: add connectionId filter in getFlows query
This commit is contained in:
Ömer Faruk Aydın
2022-08-10 22:43:32 +03:00
committed by GitHub
2 changed files with 14 additions and 2 deletions

View File

@@ -3,6 +3,7 @@ import paginate from '../../helpers/pagination';
type Params = {
appKey?: string;
connectionId?: string;
name?: string;
limit: number;
offset: number;
@@ -11,9 +12,19 @@ type Params = {
const getFlows = async (_parent: unknown, params: Params, context: Context) => {
const flowsQuery = context.currentUser
.$relatedQuery('flows')
.joinRelated('steps')
.withGraphFetched('steps.[connection]')
.joinRelated({
steps: true
})
.withGraphFetched({
steps: {
connection: true
}
})
.where((builder) => {
if (params.connectionId) {
builder.where('steps.connection_id', params.connectionId);
}
if (params.name) {
builder.where('flows.name', 'ilike', `%${params.name}%`);
}

View File

@@ -8,6 +8,7 @@ type Query {
limit: Int!
offset: Int!
appKey: String
connectionId: String
name: String
): FlowConnection
getStepWithTestExecutions(stepId: String!): [Step]