ash_graphql/lib/resource/subscription/default_resolve.ex

29 lines
690 B
Elixir
Raw Normal View History

2024-01-05 00:53:59 +13:00
defmodule AshGraphql.Resource.Subscription.DefaultResolve do
require Ash.Query
def resolve(%Absinthe.Resolution{state: :resolved} = resolution, _) do
dbg()
resolution
end
def resolve(
%{arguments: arguments, context: context} = resolution,
{api, resource, %AshGraphql.Resource.Subscription{}, input?}
) do
dbg()
result =
AshGraphql.Subscription.query_for_subscription(
resource,
api,
resolution
)
# |> Ash.Query.filter(id == ^args.id)
|> Ash.Query.limit(1)
|> api.read_one(actor: resolution.context[:current_user])
resolution
|> Absinthe.Resolution.put_result(result)
2024-01-05 00:53:59 +13:00
end
end