Passing Data Down to Other Resolvers #184
-
Hi and happy holidays! I have a question around passing data down to sub-resolvers. My EQL might look like: [{[:store/id 1]
[{:items/all [:store-item/inventory]}]}] I then might have the following resolvers to fulfill this query: (pc/defresolver all-items
[_]
{::pc/output [{:items/all [:item/id]}]}
{:items/all [{:item/id 0}
{:item/id 1}
{:item/id 2}]})
(pc/defresolver store-item-inventory
[{item-id :item/id store-id :store/id}]
{:store-item/inventory (+ item-id store-id)}) However, this won't work because inside of the context of What is the recommended way to solve for this? Thanks so much! |
Beta Was this translation helpful? Give feedback.
Answered by
wilkerlucio
Dec 24, 2020
Replies: 1 comment 5 replies
-
Hello, happy holidays too! 🎄 There are two approaches I see for this case:
(pc/defresolver all-items
[{:keys [store/id]}]
{::pc/output
[{:items/all
[:item/id :store/id]}]}
{:items/all
(mapv
#(assoc % :store/id id)
[{:item/id 0}
{:item/id 1}
{:item/id 2}])})
(pc/defresolver store-item-inventory
[{item-id :item/id store-id :store/id}]
{:store-item/inventory (+ item-id store-id)}) |
Beta Was this translation helpful? Give feedback.
5 replies
Answer selected by
wilkerlucio
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, happy holidays too! 🎄
There are two approaches I see for this case:
:item/id
to:store/id