We’re trying to build some results manually to return from absinthe. I’m hitting various challenges depending on which way I try to solve this. We originally had something like this working:
object :user do
field :activities, list_of(non_null(:activity)), resolve: &Activity.activities/3
end
This would pass the existing User
struct into the activities
function for processing. We then decided to place this down a level beneath a grouping. So something like this:
object :user do
field :activity_group, list_of(non_null(:activity_groups)), resolve: ?
end
object :activity_groups do
field :activities, list_of(non_null(:activity)), resolve: &Activity.activities/3
end
Unfortunately at this point the resolve function on activity_groups
doesn’t receive the parent user
object anymore so the activities
resolver couldn’t determine what to do. Is there a way to gain access to the User object at this lower level? Or define some way to pass it along? Thank you for any ideas.
(I tried another solution after this but that feels much worse.)