Class CommentController

java.lang.Object
fr.utc.miage.sporttrack.controller.CommentController

@Controller @RequestMapping("/comments") public class CommentController extends Object
Spring MVC controller for adding comments (social interactions) to activities.

Handles the form submission for posting a comment on an activity, including like and cheer interactions.

Author:
SportTrack Team
  • Constructor Details

    • CommentController

      public CommentController(CommentService commentService, ActivityService activityService, AthleteService athleteService)
      Constructs a new CommentController with the specified services.
      Parameters:
      commentService - the service for managing comments
      activityService - the service for managing activities
      athleteService - the service for managing athletes
  • Method Details

    • addComment

      @PostMapping("/add") public String addComment(@RequestParam("activityId") int activityId, @RequestParam(value="content",required=false) String content, @RequestParam("interactionType") String interactionTypeStr, @RequestParam(value="redirectUrl",defaultValue="/friends") String redirectUrl)
      Adds a comment or interaction to the specified activity.
      Parameters:
      activityId - the identifier of the target activity
      content - the textual content of the comment, may be null
      interactionTypeStr - the string representation of the interaction type
      redirectUrl - the URL to redirect to after processing
      Returns:
      a redirect to the specified URL, or to login if unauthenticated