I have updated it to show how a workflow would work from a button click. You would have to setup a backend workflow that takes in a list of adverts and then returns adverts that align to a given user.

For scale you have to restructure your database instead of using parts as a list on user and advert.
Option 1: Add advert_id and user_id for each part which will store the unique ids of user and advert. Then you can search for part where the unique id of advert/ user is equal to the given user/advert.

Option 2: Make a third table that with part_id, id and type. Where type can be advert/user, id will be the unique id of the id of the user/advert and part_id will be the unique id of the part.

Having list types will degrade performance once the amount of parts increase and with the repeating group added you can see that I intersect first the parts for user and adverts and then have to do a secondary search to find the adverts that have those parts. Additionally, you would also have to add functionality to separate the adverts that have the same part.

1 Like