Michiel Pruijssers
 · Tinkerer. Designer.

Filtering a list based on another list

Hey friendly FF folks!

I looked all over the posts and couldn't find a workable solution.

I am wondering how one could accomplish the following on Supabase:

The goal of the app: a user should only see a list of restaurants that they haven't visited.

My schema:

1) There is primary table "restaurants" available for all the users. This data contains all the restaurant metadata.

2) There is another table "visits" which tracks whenever a specific user visits a restaurant. That table has a set of relational keys setup that link the #UserID and the #RestaurantID with a date.

Things I have tried:
1) (Failed) Filtering the Restaurant list based the presence of the UserID in the #UserID column of the Visits table. (If a user is present: do not show the restaurant)
2) (Failed) Querying to get only the visits of the user and then looking whether the RestaurantID is present. (If there is a RestaurantID present: do not show the restaurant)
3) (Failed) Storing the Visits and Restaurants queries in 2 AppState List arrays. The UI would not let me filter based on ID (just some time-columns)

In the past, I created a column in the restaurant table with a column "visited_by" and set that up as an array (which would track the various UserID's). This worked perfectly in Firebase, but I am struggling big time writing a custom actions for Supabase that would do this, but I could never get the code right. I have also learnt that array's are terrible for database normalization.

Question: how would you accomplish something like this?

5
3 replies