MLH-Fellowship / SocioMark

A social media platform that lets you upload images and secures them by embedding a personalised hash.
https://sociomark.netlify.app
MIT License
16 stars 8 forks source link

Remove Post ID from User's Posts #22

Closed aitikgupta closed 3 years ago

aitikgupta commented 3 years ago

/post/delete only deletes the instance from posts_collection, it should also remove it's unique id from user's posts (list of unique ids)

bodhisha commented 3 years ago

@aitikgupta Actually, is that really needed to store the unique id of posts in the users' table

aitikgupta commented 3 years ago

@bodhisha That makes sense, similar argument can be made for storing the unique id of likes in the posts' table

We can divide our /posts API in a way that 2 calls will have to be made for a single post. (Actually 3)

  1. To get all the data we get from a post right now
  2. To get all the likes on that post (call on likes_collection with post_id = id)
  3. To get all the comments on that post (call on comments_collection with post_id = id)

But from an end-user's perspective, the question is do we want 3 calls to get a single post? (I think Yes)

Let's say a user clicked on the Like button -> We will call the 2nd API to update the likes Let's say a user commented -> We will call the 3rd API to update the comments All other metadata like Image and Description and Author Name/Email -> We will call the 1st API