graphql do
mutations do
update :increment_view_count, :increment_view_count
end
end
actions do
update :increment_view_count do
argument :id, :uuid, allow_nil?: false
change set_attribute(:count_of_view, expr(count_of_view + 1))
end
end
Have you tried adding accept [] to your action? And I think you don’t need ID as an argument, as update always takes the ID. You probably need to get the ID by using Ash.Changeset.get_data to get the ID of the Record that should be changed.
Also you can’t use change set_attribute use change atomic_update and you won’t take an id as an argument, ash_graphql adds the id argument to the mutation automatically.