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

View File

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