Fork me on GitHub
#pathom
<
2024-01-28
>
Brett19:01:45

Hey all, i'm trying simple stuff but i'm struggling. I just want a list of entities that I can retrieve with a global resolver: Example below. Am I on the right track ? Really a tought time with the syntax also, query are one vector, two vectors or maps in vector... who knows :rolling_on_the_floor_laughing:

Example data :
{:id 1 :when "14.01.24"}
{:id 2 :when "13.01.24"}
{:id 3 :when "12.01.24"}

(pc/defresolver reservation-resolver [env {:keys [id]}]
  {::pc/input #{:id}
   ::pc/output [:when]}
  (get-it-from-somewhere id))

(pc/defresolver all-reservations-resolver [_ _]
  {::pc/output [:all-reservations]}
  {:all-reservations (get-all-of-them)})

Queries :

(pathom-parser {} [:all-reservations])
(pathom-parser {} [[:all-reservations] [:id :when]])

souenzzo09:01:16

(pathom-parser {} [[:all-reservations] [:id :when]]) looks odd. i think that you are trying to do (pathom-parser {} [{:all-reservations [:id :when]}])

Brett12:01:27

Thanks, yes I got it working and it looks more or less like this :

[{:all-reservations [{:list/reservations [:when]}]}]

Brett12:01:36

and the resolver returns :

{:all-reservations {:list/reservations (get-all-of-them)}}