Class BadgeController

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

@Controller @RequestMapping("/badges") public class BadgeController extends Object
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 Details

    • BadgeController

      public BadgeController(BadgeService badgeService, AthleteRepository athleteRepository)
      Constructs a BadgeController with the required dependencies.
      Parameters:
      badgeService - the badge service
      athleteRepository - 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 resolution
      model - 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 athlete
      session - the HTTP session for current user resolution
      model - the Spring MVC model
      Returns:
      the view name "athlete/badge/list", or a redirect on failure