Fork me on GitHub

Hi, I'm relatively new to pathom, so I'm not sure how to frame this question but How do I pass the results of a join to a resolver? here's what I'm trying to do I have a query [:patients] that returns some data

 ({:patient-id 2, :patient-name "John"}
  {:patient-id 3, :patient-name "Tina"}
  {:patient-id 0, :patient-name "Richard"}
  {:patient-id 1, :patient-name "Eve"})}
I have another query that does a join [{:patients [:patient-name :bill]}] to give me this
 [{:patient-name "John", :bill 250}
  {:patient-name "Tina", :bill 90}
  {:patient-name "Richard", :bill 100}
  {:patient-name "Eve", :bill 120}]}
I want to take this result and sort this by :bill how can I achieve this? what will the query look like and how do I write a resolver for this? also, :patients` has a separate resolver and :bill has a separate resolver. (I am on pathom2) Thanks in advance


the query (resolver) that’s returning the joined data should take a parameter that will specify the sort-key. sample eql could look like this

[{(:patients {:sort-by :bill}) 


ah, I don't have a resolver that returns the joined data. the open-ident-reader does that for me. I just have two resolvers, one for :patient and one for :bill I should mention the bill resolver uses the :patient-id to resolve the billing data for the patient ( I guess that's why the open-ident-reader resolves it for me)


there is no sorting built-in in Pathom, usually what I do is to sort the data after reading it (usually on the client side)


you have the option to use params to implement sorting, but usually I recomend avoiding this, instead think if you really need a custom sorting, usually the lists tend to have a "natural order", which you should use in the resolver