Class ReactionController

java.lang.Object
com.example.blogs.app.api.reaction.controller.ReactionController

@RestController public class ReactionController extends Object
Handles HTTP requests for reaction-related operations.
  • Constructor Details

    • ReactionController

      public ReactionController()
  • Method Details

    • setReaction

      @PostMapping("/posts/{postId}/reactions") public ResponseEntity<ReactionDTO> setReaction(@PathVariable Long postId, @AuthenticationPrincipal UserPrincipal userPrincipal, @Valid @NotNull @RequestBody @Valid @NotNull ReactionSetRequestDTO requestDTO)
      Sets or updates a reaction on a post. If the user has already reacted, updates the reaction type. If the user hasn't reacted yet, creates a new reaction.
      Parameters:
      postId - the ID of the post to react to
      userPrincipal - authenticated user making the reaction
      requestDTO - request containing the reaction type
      Returns:
      the created or updated reaction with HTTP 200 status