Basically I’m trying to create a list of questions that people can upvote, and I want the questions with the most vote to be at the top of the list.
In supabase I have a posts table and a post_reactions table (so I can track which users react to which posts). A bit simplified but I have
- post table with id,post
- post_reaction table with id,user_id,post_id
I’m querying post with:
id,
post,
user_post_reaction: id(count)
This function works, but given the graphql nature of supabase the count is a sub object, so I access like
query.user_post_reaction[0].count
I cant find a way to path into the sub objects to sort the parent array… either on the query or on the front end collection
I tried mapping to a new table but am getting an undefined error for the count
map(query,“id”,“post”,“user_post_reaction[0].count”)
I can create a postgres function if I need to, just seems like I’m missing something small and obvious