pathom

Brett 2024-01-28T19:34:45.514579Z

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 🤣

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]])

souenzzo 2024-01-29T09:27:16.208479Z

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

Brett 2024-01-29T12:13:27.426359Z

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

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

Brett 2024-01-29T12:14:36.625209Z

and the resolver returns :

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