Class CommentController
java.lang.Object
fr.utc.miage.sporttrack.controller.CommentController
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 Summary
ConstructorsConstructorDescriptionCommentController(CommentService commentService, ActivityService activityService, AthleteService athleteService) Constructs a new CommentController with the specified services. -
Method Summary
Modifier and TypeMethodDescriptionaddComment(int activityId, String content, String interactionTypeStr, String redirectUrl) Adds a comment or interaction to the specified activity.
-
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 commentsactivityService- the service for managing activitiesathleteService- 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 activitycontent- the textual content of the comment, may benullinteractionTypeStr- the string representation of the interaction typeredirectUrl- the URL to redirect to after processing- Returns:
- a redirect to the specified URL, or to login if unauthenticated
-