bounswe / bounswe2024group7

Collaborative hub for 2024Group7
https://bounswe.github.io/bounswe2024group7/
4 stars 3 forks source link

Implement Bookmark and Like Features for Posts #202

Closed oguzhekim closed 12 hours ago

oguzhekim commented 6 days ago

Title: Implement Bookmark and Like Features for Posts Category:

Detailed Description: We should create new endpoints to allow users to like posts and bookmark them.

Proposed Timeline: 22.11.2024

aasimdag commented 23 hours ago

From now on, the like, unlike, bookmark, remove bookmark and get bookmarked posts feature is implemented into backend api. here is the updated endpoints: POST /api/posts/{postId}/like - Like a post DELETE /api/posts/{postId}/like - Unlike a post POST /api/posts/{postId}/bookmark - Bookmark a post DELETE /api/posts/{postId}/bookmark - Remove bookmark of a post GET /api/posts/bookmarked - Get all bookmarked posts for the current user

Each post response will now include: likeCount: Total number of likes isLiked: Whether the current user has liked the post isBookmarked: Whether the current user has bookmarked the post

if user is not authenticated (guest user), this error returns with status code 401 Unauthorized: { "message": "You must be logged in to perform this action", "timestamp": "2024-11-25T04:54:49.8285567" }

Opening PR.