Ash FrameworkAF
Ash Framework3y ago
12 replies
moxley

Return aggregate after GraphQL mutation

I have an aggregate defined like this:

aggregates do
  count :events_count, :events
end


And GraphQL queries defined like this:

  graphql do
    type :venue2

    queries do
      get :get_venue2, :read
      list :list_venues2, :read
    end

    mutations do
      create :create_venue2, :create
      update :update_venue2, :update
      destroy :delete_venue2, :destroy
    end
  end


When I call get_venue2 or list_venues2, and the query requests the aggregate, the aggregate returns successfully.

When I call update_venue2, and request the aggregate, it fails with a forbidden error in the response. Removing the aggregate from the query makes the error go away, but now I don't have the aggregate I need. Apparently, whatever automatic passing of the actor to the aggregate that happens in the read queries isn't happening with the mutation.

Is there a solution for this?
Was this page helpful?