Class BaseController
java.lang.Object
fr.utc.miage.sporttrack.controller.BaseController
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 Summary
ConstructorsConstructorDescriptionBaseController(AthleteService athleteService, AdminService adminService, BadgeService badgeService, FriendshipService friendshipService, ActivityService activityService) Constructs aBaseControllerwith the required services. -
Method Summary
-
Constructor Details
-
BaseController
public BaseController(AthleteService athleteService, AdminService adminService, BadgeService badgeService, FriendshipService friendshipService, ActivityService activityService) Constructs aBaseControllerwith the required services.- Parameters:
athleteService- the athlete serviceadminService- the admin servicebadgeService- the badge servicefriendshipService- the friendship serviceactivityService- 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 renderingauthentication- the current security authentication, may benull- Returns:
- the view name "index" or a redirect to "/admin"
-