We are planning to upload Image only available for selected users. Here we have store the Image with visible users list in MuSql database.
At the same time consider a mobile API (Node JS), In that we have to fetch the all list of image urls that are visible for some random list of users (Users list from API request body). The image urls that are shown should be available only for the users in the request. The images that are not visible for the requested users should not be shown in the response list.
Please help us with how we have to setup the table and its columns in order the achieve the functionlaity.
We have tried adding a column users_list
of JSON
type to the table. With this we have made loop with requested users list with the users_list
in the table. The difficulty is that when the requested users list very long then the loops gets more time execute.
Is there any way to fetch the images list that are available for requested users using MySql query without looping.