Skip to content

Commit

Permalink
Fix notification router schema (#759)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljguarino authored Mar 7, 2024
1 parent a1ebb42 commit 8259f3c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/console/graphql/resolvers/deployments.ex
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ defmodule Console.GraphQl.Resolvers.Deployments do
PipelineContext,
NotificationSink,
NotificationRouter,
NotificationFilter
NotificationFilter,
RouterFilter,
}

def query(Pipeline, _), do: Pipeline
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8259f3c

Please sign in to comment.