mirror of
https://github.com/ash-project/ash_graphql.git
synced 2024-09-21 13:53:20 +12:00
39 lines
722 B
Elixir
39 lines
722 B
Elixir
defmodule AshGraphql.Test.Subscribable do
|
|
@moduledoc false
|
|
use Ash.Resource,
|
|
data_layer: Ash.DataLayer.Ets,
|
|
extensions: [AshGraphql.Resource]
|
|
|
|
require Ash.Query
|
|
|
|
graphql do
|
|
type :subscribable
|
|
|
|
queries do
|
|
get :get_subscribable, :read
|
|
end
|
|
|
|
mutations do
|
|
create :create_subscribable, :create
|
|
end
|
|
|
|
subscriptions do
|
|
subscribe(:subscribable_created, fn _, _ ->
|
|
IO.inspect("bucket_created")
|
|
{:ok, topic: "*"}
|
|
end)
|
|
end
|
|
end
|
|
|
|
actions do
|
|
defaults([:create, :read, :update, :destroy])
|
|
end
|
|
|
|
attributes do
|
|
uuid_primary_key(:id)
|
|
|
|
attribute(:text, :string)
|
|
create_timestamp(:created_at)
|
|
update_timestamp(:updated_at)
|
|
end
|
|
end
|