mirror of
https://github.com/ash-project/ash_graphql.git
synced 2024-09-20 05:13:33 +12:00
fix: properly use primary read as default read_action
This commit is contained in:
parent
3f842045fc
commit
d8b73b56e4
2 changed files with 11 additions and 5 deletions
|
@ -921,6 +921,7 @@ defmodule AshGraphql.Graphql.Resolver do
|
|||
modify_resolution: modify
|
||||
}}
|
||||
) do
|
||||
read_action = read_action || Ash.Resource.Info.primary_action!(resource, :read).name
|
||||
input = arguments[:input] || %{}
|
||||
|
||||
args_result =
|
||||
|
@ -1067,6 +1068,7 @@ defmodule AshGraphql.Graphql.Resolver do
|
|||
modify_resolution: modify
|
||||
}}
|
||||
) do
|
||||
read_action = read_action || Ash.Resource.Info.primary_action!(resource, :read).name
|
||||
input = arguments[:input] || %{}
|
||||
|
||||
args_result =
|
||||
|
@ -1434,7 +1436,12 @@ defmodule AshGraphql.Graphql.Resolver do
|
|||
end
|
||||
|
||||
defp set_query_arguments(query, action, arg_values) do
|
||||
action = Ash.Resource.Info.action(query.resource, action)
|
||||
action =
|
||||
if is_atom(action) do
|
||||
Ash.Resource.Info.action(query.resource, action)
|
||||
else
|
||||
action
|
||||
end
|
||||
|
||||
action.arguments
|
||||
|> Enum.reject(& &1.private?)
|
||||
|
|
|
@ -169,10 +169,9 @@ defmodule AshGraphql.UpdateTest do
|
|||
end
|
||||
|
||||
test "an update with a configured read action and no identity works with an argument the same name as an attribute" do
|
||||
post =
|
||||
AshGraphql.Test.Api.create!(
|
||||
Ash.Changeset.new(AshGraphql.Test.Post, text: "foobar", best: true)
|
||||
)
|
||||
AshGraphql.Test.Api.create!(
|
||||
Ash.Changeset.new(AshGraphql.Test.Post, text: "foobar", best: true)
|
||||
)
|
||||
|
||||
resp =
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue