ash-project / ash_json_api

The JSON:API extension for the Ash Framework
https://hexdocs.pm/ash_json_api
MIT License
63 stars 42 forks source link

Make relationship routes leverage `manage_relationship` changes instead of using the bypass #11

Closed zachdaniel closed 2 years ago

zachdaniel commented 4 years ago

At the moemnt, the code for things like add_to_relationship is actually using what is now currently considered an escape hatch, i.e:

      result
      |> Ash.Changeset.new()
      |> Ash.Changeset.append_to_relationship(relationship_name, request.resource_identifiers)
      |> Ash.Changeset.for_update(action, %{}, Request.opts(request))
      |> api.update()

We should instead require that these routes choose an action that has an argument of a specific name, and then those actions will be used. i.e

post_to_relationship :comments, :update, :add_comments
zachdaniel commented 2 years ago

Closing this in favor of #56