2024-01-05 00:53:59 +13:00
|
|
|
defmodule AshGraphql.Resource.Subscription.DefaultResolve do
|
|
|
|
require Ash.Query
|
|
|
|
|
2024-02-22 07:01:20 +13:00
|
|
|
def resolve(%Absinthe.Resolution{state: :resolved} = resolution, _) do
|
|
|
|
dbg()
|
|
|
|
resolution
|
|
|
|
end
|
2024-01-11 08:02:15 +13:00
|
|
|
|
|
|
|
def resolve(
|
|
|
|
%{arguments: arguments, context: context} = resolution,
|
|
|
|
{api, resource, %AshGraphql.Resource.Subscription{}, input?}
|
|
|
|
) do
|
2024-02-22 07:01:20 +13:00
|
|
|
dbg()
|
|
|
|
|
2024-01-11 08:02:15 +13:00
|
|
|
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
|