Skip to content
Snippets Groups Projects

Toggle like endpoint

Closed Talty-Kerr, Patrick (UG - Comp Sci & Elec Eng) requested to merge toggle-like-endpoint into main

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
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Loading
  • Loading
Please register or sign in to reply
Loading