jhonatansanchezp-meli / be_java_hisp_w26_g09

0 stars 0 forks source link

Unfollow #7

Closed fabian001254 closed 4 months ago

ggomezr1403 commented 5 months ago

Functionality Description: Unfollow User

This functionality allows a user to unfollow another user on the platform. Using a HTTP POST request, the user sends a request to unfollow the specified user. The request route contains the unique identifiers of both users involved.

Usage Example:

POST /users/{userId}/unfollow/{userIdToUnfollow}

Sample Request:

/users/234/unfollow/123

By executing this request, the user identified by {userId} will unfollow the user identified by {userIdToUnfollow}.

The function associated with this functionality, unfollowUser, is responsible for performing the action of unfollowing the specified user. It first searches for both users in the user repository. Once found, it removes the user to be unfollowed from the followed list of the user performing the action.

In case either of the users does not exist in the system, a "Not Found" exception is thrown indicating that the user has not been found in the repository.