ash_graphql/lib/resource/subscription.ex

33 lines
821 B
Elixir
Raw Normal View History

2024-01-05 00:53:59 +13:00
defmodule AshGraphql.Resource.Subscription do
@moduledoc "Represents a configured query on a resource"
defstruct [
:name,
2024-08-06 02:35:00 +12:00
:actions,
2024-08-07 21:30:57 +12:00
:read_action,
:actor
2024-01-05 00:53:59 +13:00
]
@subscription_schema [
name: [
type: :atom,
doc: "The name to use for the subscription."
],
2024-08-07 21:30:57 +12:00
actor: [
type:
{:spark_function_behaviour, AshGraphql.Resource.Subscription.Actor,
2024-08-16 01:51:02 +12:00
{AshGraphql.Resource.Subscription.ActorFunction, 1}},
2024-08-07 21:30:57 +12:00
doc: "The actor to use for authorization."
],
2024-08-06 02:35:00 +12:00
actions: [
type: {:or, [{:list, :atom}, :atom]},
doc: "The create/update/destroy actions the subsciption should listen to. Defaults to all."
],
read_action: [
type: :atom,
doc: "The read action to use for reading data"
2024-01-05 00:53:59 +13:00
]
]
def schema, do: @subscription_schema
end