Class BadgeController
java.lang.Object
fr.utc.miage.sporttrack.controller.BadgeController
Spring MVC controller for athlete badge views.
Provides endpoints for viewing the current athlete's earned and unearned badges, as well as viewing badges of other athletes.
- Author:
- SportTrack Team
-
Constructor Summary
ConstructorsConstructorDescriptionBadgeController(BadgeService badgeService, AthleteRepository athleteRepository) Constructs aBadgeControllerwith the required dependencies. -
Method Summary
Modifier and TypeMethodDescriptionlistAthleteBadges(int id, jakarta.servlet.http.HttpSession session, org.springframework.ui.Model model) Displays the earned badges of a specific athlete.listMyBadges(jakarta.servlet.http.HttpSession session, org.springframework.ui.Model model) Displays all badges for the authenticated athlete, split into earned and unearned.
-
Constructor Details
-
BadgeController
Constructs aBadgeControllerwith the required dependencies.- Parameters:
badgeService- the badge serviceathleteRepository- the athlete repository
-
-
Method Details
-
listMyBadges
@GetMapping public String listMyBadges(jakarta.servlet.http.HttpSession session, org.springframework.ui.Model model) Displays all badges for the authenticated athlete, split into earned and unearned.- Parameters:
session- the HTTP session for athlete resolutionmodel- the Spring MVC model- Returns:
- the view name "athlete/badge/list", or a redirect to login
-
listAthleteBadges
@GetMapping("/athlete/{id}") public String listAthleteBadges(@PathVariable int id, jakarta.servlet.http.HttpSession session, org.springframework.ui.Model model) Displays the earned badges of a specific athlete.- Parameters:
id- the identifier of the target athletesession- the HTTP session for current user resolutionmodel- the Spring MVC model- Returns:
- the view name "athlete/badge/list", or a redirect on failure
-