samedi 4 mai 2019

What way would you keep track on already seen content?

Let's say we have some site where you can post your photos, subscribe to other users. There is an endpoint like /feed where you see photos of people you're subscribed on and there the site should hide what you have already seen.

I have been thinking about ways to keep track on what have been already seen and almost the only thing I came up with is organizing many-to-many relationship between, let's say, User and Photos and 3rd table would save user_id and photo_id for every single entry and every single entry means that user with such a user_id read the post with a post_id so now I can filter what was seen.

Another way I came up with is saving id of just seen post in localStorage which seems a wrong way...

So, are there better ways than the first one I thought of? What way would you do this if this differs from what I suggested?

Also, if we need also consider "likes", is it a good idea to make one more field for the 3rd table - is_liked (because logically thinking, liked photo should be considered as seen)




Aucun commentaire:

Enregistrer un commentaire