Class ReactionServiceImpl

java.lang.Object
com.example.blogs.app.api.reaction.service.ReactionServiceImpl
All Implemented Interfaces:
ReactionService

@Service public class ReactionServiceImpl extends Object implements ReactionService
Orchestrates reaction operations by coordinating with repository adapters.
  • Constructor Details

    • ReactionServiceImpl

      public ReactionServiceImpl()
  • Method Details

    • setReaction

      public ReactionDTO setReaction(Long postId, Long userId, ReactionType reactionType)
      Sets or updates a user's reaction on a post. Attempts to find an existing reaction and update it. If not found, creates a new reaction.
      Specified by:
      setReaction in interface ReactionService
      Parameters:
      postId - the ID of the post to react to
      userId - the ID of the user making the reaction
      reactionType - the type of reaction (LIKE or DISLIKE)
      Returns:
      the created or updated reaction as DTO