Class BaseController

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

@Controller @RequestMapping("/") public class BaseController extends Object
Spring MVC controller that handles the application's home page.

Renders the index view with athlete profile data, earned badges, and the latest activities from the authenticated athlete's friends. Unauthenticated or unrecognised users see the public landing page.

Author:
SportTrack Team
  • Constructor Details

    • BaseController

      public BaseController(AthleteService athleteService, AdminService adminService, BadgeService badgeService, FriendshipService friendshipService, ActivityService activityService)
      Constructs a BaseController with the required services.
      Parameters:
      athleteService - the athlete service
      adminService - the admin service
      badgeService - the badge service
      friendshipService - the friendship service
      activityService - the activity service
  • Method Details

    • home

      @GetMapping("/") public String home(org.springframework.ui.Model model, org.springframework.security.core.Authentication authentication)
      Renders the home page. If the current user is an authenticated athlete, populates the model with profile data, badges, and friends' latest activities. If the user is an admin, redirects to the admin dashboard.
      Parameters:
      model - the Spring MVC model for view rendering
      authentication - the current security authentication, may be null
      Returns:
      the view name "index" or a redirect to "/admin"