From 8259f3c89f114d63f981fb0f732e40c92f38de2a Mon Sep 17 00:00:00 2001 From: michaeljguarino Date: Thu, 7 Mar 2024 10:10:04 -0500 Subject: [PATCH] Fix notification router schema (#759) --- lib/console/graphql/resolvers/deployments.ex | 4 +++- .../deployments/notification_queries_test.exs | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/lib/console/graphql/resolvers/deployments.ex b/lib/console/graphql/resolvers/deployments.ex index deb589ed2d..0f737acd56 100644 --- a/lib/console/graphql/resolvers/deployments.ex +++ b/lib/console/graphql/resolvers/deployments.ex @@ -37,7 +37,8 @@ defmodule Console.GraphQl.Resolvers.Deployments do PipelineContext, NotificationSink, NotificationRouter, - NotificationFilter + NotificationFilter, + RouterFilter, } def query(Pipeline, _), do: Pipeline @@ -73,6 +74,7 @@ defmodule Console.GraphQl.Resolvers.Deployments do def query(NotificationSink, _), do: NotificationSink def query(NotificationRouter, _), do: NotificationRouter def query(NotificationFilter, _), do: NotificationFilter + def query(RouterFilter, _), do: RouterFilter def query(_, _), do: Cluster delegates Console.GraphQl.Resolvers.Deployments.Git diff --git a/test/console/graphql/queries/deployments/notification_queries_test.exs b/test/console/graphql/queries/deployments/notification_queries_test.exs index b436570912..69d696d931 100644 --- a/test/console/graphql/queries/deployments/notification_queries_test.exs +++ b/test/console/graphql/queries/deployments/notification_queries_test.exs @@ -27,6 +27,23 @@ defmodule Console.GraphQl.Deployments.NotificationQueriesTest do assert found["id"] == router.id end + + test "it can sideload filters" do + router = insert(:notification_router) + filters = insert_list(3, :router_filter, router: router) + + {:ok, %{data: %{"notificationRouter" => found}}} = run_query(""" + query router($name: String!) { + notificationRouter(name: $name) { + id + filters { id } + } + } + """, %{"name" => router.name}, %{current_user: insert(:user)}) + + assert found["id"] == router.id + assert ids_equal(found["filters"], filters) + end end describe "notificationSinks" do