fix: destroys can still have input objects

This commit is contained in:
Zach Daniel 2021-05-21 10:56:10 -04:00
parent 70bdcf3216
commit 053cef4a65

View file

@ -366,13 +366,11 @@ defmodule AshGraphql.Resource do
action = Ash.Resource.Info.action(resource, mutation.action) action = Ash.Resource.Info.action(resource, mutation.action)
args = args =
case( case mutation_fields(
mutation_fields(
resource, resource,
schema, schema,
action, action,
mutation.type mutation.type
)
) do ) do
[] -> [] ->
[] []
@ -530,9 +528,6 @@ defmodule AshGraphql.Resource do
__reference__: ref(__ENV__) __reference__: ref(__ENV__)
} }
if mutation.type == :destroy do
[result]
else
case mutation_fields( case mutation_fields(
resource, resource,
schema, schema,
@ -553,7 +548,6 @@ defmodule AshGraphql.Resource do
[input, result] [input, result]
end end
end
end) end)
end end
@ -626,6 +620,9 @@ defmodule AshGraphql.Resource do
) )
attribute_fields = attribute_fields =
if action.type == :destroy && !action.soft? do
[]
else
resource resource
|> Ash.Resource.Info.public_attributes() |> Ash.Resource.Info.public_attributes()
|> Enum.filter(fn attribute -> |> Enum.filter(fn attribute ->
@ -654,6 +651,7 @@ defmodule AshGraphql.Resource do
__reference__: ref(__ENV__) __reference__: ref(__ENV__)
} }
end) end)
end
argument_fields = argument_fields =
action.arguments action.arguments