Class UserController

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

@Controller @RequestMapping("/") public class UserController extends Object
Spring MVC controller for the current athlete's profile management.

Provides endpoints for viewing and updating the authenticated athlete's profile.

Author:
SportTrack Team
  • Constructor Details

    • UserController

      public UserController(AthleteService athleteService)
      Constructs a UserController with the required service.
      Parameters:
      athleteService - the athlete service
  • Method Details

    • showProfile

      @GetMapping("/profile") public String showProfile(org.springframework.security.core.Authentication authentication, org.springframework.ui.Model model)
      Displays the profile page of the currently authenticated athlete.
      Parameters:
      authentication - the current security authentication
      model - the Spring MVC model
      Returns:
      the view name "athlete/profile", or a redirect to login if unauthenticated
    • updateProfile

      @PostMapping("/profile/update") public String updateProfile(@ModelAttribute AthleteProfileUpdateDTO updatedData, org.springframework.security.core.Authentication authentication)
      Processes the profile update form submission.
      Parameters:
      updatedData - the DTO containing the updated profile fields
      authentication - the current security authentication
      Returns:
      a redirect to the profile page with a success or error parameter