ash_graphql/lib/resource/transformers/subscription.ex

28 lines
607 B
Elixir
Raw Normal View History

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
case dsl |> Transformer.get_entities([:graphql, :subscriptions]) do
2024-02-06 21:24:44 +13:00
[] ->
{:ok, dsl}
_ ->
{:ok,
dsl
2024-07-02 07:01:05 +12:00
|> Transformer.persist(
2024-02-06 21:24:44 +13:00
:simple_notifiers,
[
AshGraphql.Resource.Subscription.Notifier
2024-02-06 21:24:44 +13:00
] ++
2024-07-02 07:01:05 +12:00
Transformer.get_persisted(dsl, :simple_notifiers, [])
)}
2024-02-06 21:24:44 +13:00
end
end
end