Class UserController
java.lang.Object
fr.utc.miage.sporttrack.controller.UserController
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 Summary
ConstructorsConstructorDescriptionUserController(AthleteService athleteService) Constructs aUserControllerwith the required service. -
Method Summary
Modifier and TypeMethodDescriptionshowProfile(org.springframework.security.core.Authentication authentication, org.springframework.ui.Model model) Displays the profile page of the currently authenticated athlete.updateProfile(AthleteProfileUpdateDTO updatedData, org.springframework.security.core.Authentication authentication) Processes the profile update form submission.
-
Constructor Details
-
UserController
Constructs aUserControllerwith 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 authenticationmodel- 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 fieldsauthentication- the current security authentication- Returns:
- a redirect to the profile page with a success or error parameter
-