I am trying to implement in LIKE and COMMENT system like Instagram and Facebook in DynamoDB
I have 3 tables, user, photo and photo_likes
user table and photo table have user_id and photo_id keys.
and for photo_likes table, I have photo_id as a key and liked_by column where I store user_id as list.
So, If the photo_id 1 is liked by user_id 10, 35, I store it as:
| photo_id | liked_by |
| 1 | {10,35} |
I am really confused if it is the right way to do it? or should I just insert a new row whenever their is a new like.
| photo_id | user_id |
| 1 | 10 |
| 1 | 35 |