Social Media Like feature

0
Hello everyone, I’m trying to implement a “like functionality” similar to social media where every user will be able to like the post. And in my case when the post is posted by the user every users are able to see the post and when one user likes the post and logs out and other user signs’ in and hit the like button of the same post he is disliking the post liked by the other user. how can I refresh the like for perticular users?  I have “Post Entity” and in that I have a boolean attribute “Islike” to check whether the like is true or false and integer attribute ”Like” to keep a count on likes. Thanks in advance!! Regards, Harish
asked
3 answers
0

Hi Harish, I would suggest you create two different unique IDs, one for the user and one for the post. create an entity that can store both IDs and a boolean IsLiked. while loading the page for the user, call a microflow to create an object in that entity with the current user id and the particular id and Isliked as false. when the user clicks the like change the boolean to true. for the like count create an calculated value that counts all boolean is liked with the post ID. one more suggestion is to use nanoflows as they work efficiently on browers.

answered
1

Your association is wrong. You must have *-* association or you dont have an association at all.

1 post will be liked by many users and 1 user can like many posts. 

If the association is wrong, then mostly the user will be using the same association that exists for another user.

answered
0

Hi Harish,

There are multiple ways to achieve it. You can have a separate entity to keep track of whether a particular post is liked by a particular account or not. That way you can like or dislike a post by altering the LinkHelper object associated with that Account for that particular Post.

Something like this:

 

You can ofcourse construct it in a different manner based upon your domain model.

answered