mirror of
https://github.com/ash-project/ash_graphql.git
synced 2024-09-20 21:32:59 +12:00
365b3aedc6
* feat: add support for relay global IDs * improvement: use the GraphQL type when projecting fields This allows picking also up fields coming from fragments in queries returning an interface * feat: add relay node query Allow retrieving a resource implementing the Node interface given its Relay global id.
32 lines
569 B
Elixir
32 lines
569 B
Elixir
defmodule AshGraphql.Test.RelayIds.User do
|
|
@moduledoc false
|
|
|
|
use Ash.Resource,
|
|
data_layer: Ash.DataLayer.Ets,
|
|
extensions: [AshGraphql.Resource]
|
|
|
|
graphql do
|
|
type :user
|
|
|
|
queries do
|
|
get :get_user, :read
|
|
end
|
|
|
|
mutations do
|
|
create :create_user, :create
|
|
end
|
|
end
|
|
|
|
actions do
|
|
defaults([:create, :update, :destroy, :read])
|
|
end
|
|
|
|
attributes do
|
|
uuid_primary_key(:id)
|
|
attribute(:name, :string)
|
|
end
|
|
|
|
relationships do
|
|
has_many(:posts, AshGraphql.Test.RelayIds.Post, destination_attribute: :author_id)
|
|
end
|
|
end
|