filter basesd query not working

Like I am trying to make a base query and than on that I want to apply filter asked by the request. Now for some reason the rating related filter gives me error. And generally is the way how I am doing it correct or is there way for filter or queries because thats just simple example and this will become much complexer
No description
1 Reply
Darren
Darren3mo ago
if youre going to split up your query you need to add .$dynamic(); to the end otherwise the first one is actually ran or just add your orderbys with a ternary orderBy(asc(filter=="price"? doctors.price : reviews.rating))
Want results from more Discord servers?
Add your server