mirror of
https://github.com/ash-project/ash_graphql.git
synced 2024-09-20 13:24:14 +12:00
28 lines
690 B
Elixir
28 lines
690 B
Elixir
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)
|
|
end
|
|
end
|