In my working on Jakub's Fulcro exercise 7, TASK 3, I'm trying to play with some EQL queries.
After implementing the resolvers for team, player, address,
While [{:teams [:team/id]}]
works to get the expected results, but likewise,
[{:teams [:player/id]}]
yields {:teams [{:player/id :com.wsscode.pathom.core/not-found}]}
[{:teams [:address/id]}]
yields {:teams [{:address/id :com.wsscode.pathom.core/not-found}]}
Here are my implementation the resolvers for player and address repsectively:
(defresolver player [_ {id :player/id}]
{::pc/input #{:player/id}
::pc/output [:player/id :player/name :player/address]}
(case id
1 #:player{:id 1 :name "Luna" :address {:address/id 1}}
2 #:player{:id 2 :name "Sol" :address {:address/id 2}}))
(defresolver address [_ {id :address/id}] ; an ident resolver
{::pc/input #{:address/id}
::pc/output [:address/id :address/city]}
(case id
1 #:address{:id 1 :city "Oslo"}
2 #:address{:id 2 :city "Trondheim"}))
What are my mistakes? Thanks!
I guess it should be {:teams [{:team/players [:player/address] ]} - you must join on the team's property that actually links to players
Thanks! Yes, the query has to follow the join path (structure): [{:teams [{:team/players [{:player/address [:address/id :address/city]}]}]}]