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

Deduplication of data, Implement getting Likes (for Posts) and Posts (for Users) #37

Closed aitikgupta closed 3 years ago

aitikgupta commented 3 years ago

After this fix, a simple response from GET /user/details would be:

{
  "user_id": "606655860323ed241e902b4b",
  "name": "Aitik Gupta",
  "email": "a@b.c",
  "profile_picture": "url_of_image",
  "description": "This is Aitik",
  "posts": [
    {
      "post_id": "60665c091b7088aa65352c2b",
      "user_id": "606655860323ed241e902b4b",
      "author_name": "Aitik Gupta",
      "author_email": "a@b.c",
      "report_counter": 0,
      "likes_by_users": [
        {
          "user_id": "606655860323ed241e902b4b",
          "name": "Aitik Gupta",
          "email": "a@b.c",
          "profile_picture": "url_of_image"
        },
        {
          "user_id": "6066665e44d676daed4d3490",
          "name": "New User",
          "email": "c@d.f",
          "profile_picture": "url_of_image"
        }
      ],
      "image": "URL",
      "description": "This is a post by Aitik"
    }
  ]
}

This also implements a lightweight user helper, which can be used to display small photos and names of people who liked the post. Resolves #36