Is it possible to use order_is_key when managing a many_to_many relationship?
I have the following resources.
defmodule App.Catalog.Book do actions do create :create do primary? true argument :authors, {:array, :uuid} do allow_nil? false end change manage_relationship(:authors, type: :direct_control) end end relationships do has_many :authorships, App.Catalog.Authorship, sort: [order: :asc] many_to_many :authors, App.Catalog.UserProfile, join_relationship: :authorships, destination_attribute_on_join_resource: :author_id endenddefmodule App.Catalog.Authorship do attributes do attribute :order, :integer, allow_nil?: false end relationships do belongs_to :resource, App.Catalog.Resource do primary_key? true allow_nil? false end belongs_to :author, App.Catalog.UserProfile do primary_key? true allow_nil? false end endend
defmodule App.Catalog.Book do actions do create :create do primary? true argument :authors, {:array, :uuid} do allow_nil? false end change manage_relationship(:authors, type: :direct_control) end end relationships do has_many :authorships, App.Catalog.Authorship, sort: [order: :asc] many_to_many :authors, App.Catalog.UserProfile, join_relationship: :authorships, destination_attribute_on_join_resource: :author_id endenddefmodule App.Catalog.Authorship do attributes do attribute :order, :integer, allow_nil?: false end relationships do belongs_to :resource, App.Catalog.Resource do primary_key? true allow_nil? false end belongs_to :author, App.Catalog.UserProfile do primary_key? true allow_nil? false end endend
The Elixir backend framework for unparalleled productivity. Declarative tools that let you stop wasting time. Use with Phoenix LiveView or build APIs in minutes for your front-end of choice.