Skip to content

Toggle like endpoint

What does this MR do?

Added endpoints for users to like comments, and to check whether a comment is liked by them

toggleLike adds or removes user_id to user_liked depending on whether the id is found in the array: image

Document before the request

image

Run the request with params in body, comment id and user id:

image

And this json return showing informing likes have been updated:

image

Document after request:

image

likedState either returns true or false depending on whether the user has liked the post or not. Was unsure if this was needed but maybe for like icon needing a state to check against?

image

the request:

image

the document:

image

the json return:

image

and showing it works when user_id not found in list: image

image

Merge request reports

Loading