By reading through previous questions and issues I converted my schemas from using a “many_to_many” to “has_many” and “belongs_to” in order to get the extra field from the join table. Now I’m a little bit stuck and not sure how to access it using Absinthe.
I have “users” and a “feedbacks”. It is a many to many relationship through the “users__feedbacks” table.
“users__feedbacks” table also has an extra field called “is_published”. How can I get that field in my graphql query?
These are my schemas:
schema "users" do field :first_name, :string has_many :users__feedbacks, App.Feedbacks.Users_Feedback has_many :feedbacks_as_reviewer, through: [:users__feedbacks, :feedback] timestamps() end
schema "feedbacks" do field :title, :string has_many :users__feedbacks, App.Feedbacks.Users_Feedback has_many :reviewers, through: [:users__feedbacks, :user] timestamps() end
schema "users__feedbacks" do belongs_to :user, Accounts.User belongs_to :feedback, Feedbacks.Feedback field :is_published, :boolean timestamps() end
These are my graphql query types
object :user do field :id, non_null(:id) field :first_name, :string field :feedbacks_as_reviewer, list_of(:feedback), resolve: dataloader(:db) end
object :feedback do field :id, non_null(:id) field :title, non_null(:string) field :reviewers, list_of(:user), resolve: dataloader(:db) end