2024-02-06 21:24:44 +13:00
|
|
|
defmodule AshGraphql.Resource.Transformers.Subscription do
|
|
|
|
@moduledoc """
|
|
|
|
Adds the notifier for Subscriptions to the Resource
|
|
|
|
"""
|
|
|
|
|
|
|
|
use Spark.Dsl.Transformer
|
|
|
|
|
|
|
|
alias Spark.Dsl.Transformer
|
|
|
|
|
|
|
|
def transform(dsl) do
|
2024-02-21 07:22:49 +13:00
|
|
|
case dsl |> Transformer.get_entities([:graphql, :subscriptions]) do
|
2024-02-06 21:24:44 +13:00
|
|
|
[] ->
|
|
|
|
{:ok, dsl}
|
|
|
|
|
|
|
|
_ ->
|
|
|
|
{:ok,
|
|
|
|
dsl
|
|
|
|
|> Transformer.set_option(
|
|
|
|
[:resource],
|
|
|
|
:simple_notifiers,
|
|
|
|
[
|
2024-02-21 07:22:49 +13:00
|
|
|
AshGraphql.Resource.Subscription.Notifier
|
2024-02-06 21:24:44 +13:00
|
|
|
] ++
|
|
|
|
Transformer.get_option(dsl, [:resource], :simple_notifiers, [])
|
2024-02-21 07:22:49 +13:00
|
|
|
)}
|
2024-02-06 21:24:44 +13:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|