mirror of
https://github.com/ash-project/ash_graphql.git
synced 2024-09-21 13:53:20 +12:00
49 lines
935 B
Elixir
49 lines
935 B
Elixir
|
defmodule AshGraphql.Test.OtherResource do
|
||
|
@moduledoc false
|
||
|
|
||
|
alias AshGraphql.Test.CommonMap
|
||
|
|
||
|
use Ash.Resource,
|
||
|
domain: AshGraphql.Test.OtherDomain,
|
||
|
data_layer: Ash.DataLayer.Ets,
|
||
|
extensions: [AshGraphql.Resource]
|
||
|
|
||
|
graphql do
|
||
|
type :other_resource
|
||
|
|
||
|
queries do
|
||
|
get :get_other_resource, :read
|
||
|
list :list_other_resources, :read
|
||
|
end
|
||
|
|
||
|
mutations do
|
||
|
create :create_other_resource_with_common_map, :create_with_common_map
|
||
|
end
|
||
|
end
|
||
|
|
||
|
actions do
|
||
|
read :read do
|
||
|
primary?(true)
|
||
|
end
|
||
|
|
||
|
create :create_with_common_map do
|
||
|
argument(:common_map_arg, {:array, CommonMap})
|
||
|
end
|
||
|
end
|
||
|
|
||
|
attributes do
|
||
|
uuid_primary_key(:id)
|
||
|
|
||
|
attribute :common_map_attribute, CommonMap do
|
||
|
public?(true)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
calculations do
|
||
|
calculate :common_map_calculation, CommonMap do
|
||
|
public?(true)
|
||
|
calculation(fn records, _ -> {:ok, []} end)
|
||
|
end
|
||
|
end
|
||
|
end
|