Class UserController

java.lang.Object
springboot.bg.harisauto.web.controller.UserController

@Controller @RequestMapping("/users") public class UserController extends Object
UserController.java - Controller for handling user-related web requests.
Author:
Kristian Popov
  • Constructor Details

  • Method Details

    • showDashboard

      @GetMapping("/dashboard") public org.springframework.web.servlet.ModelAndView showDashboard(@AuthenticationPrincipal AuthenticationMetaData metaData)
      Shows the dashboard page for the authenticated user.
      Parameters:
      metaData - The authentication metadata.
      Returns:
      The dashboard page.
    • showVehiclePage

      @GetMapping("/vehicles") public org.springframework.web.servlet.ModelAndView showVehiclePage(@AuthenticationPrincipal AuthenticationMetaData metaData)
      Shows the vehicle page.
      Returns:
      The vehicle page.
    • showBookings

      @GetMapping("/my-bookings") public org.springframework.web.servlet.ModelAndView showBookings(@AuthenticationPrincipal AuthenticationMetaData metaData)
      Shows the bookings page for the authenticated user.
      Parameters:
      metaData - The authentication metadata.
      Returns:
      The bookings page.
    • showSettings

      @GetMapping("/settings") public org.springframework.web.servlet.ModelAndView showSettings(@AuthenticationPrincipal AuthenticationMetaData metaData)
      Shows the settings page for the authenticated user.
      Parameters:
      metaData - The authentication metadata.
      Returns:
      The settings page.
    • createVehicle

      @PostMapping("/new-vehicle") public org.springframework.web.servlet.ModelAndView createVehicle(@AuthenticationPrincipal AuthenticationMetaData metaData, @Valid @Valid CreateVehicleRequest request, org.springframework.validation.BindingResult bindingResult)
      Creates a new vehicle for the authenticated user.
      Parameters:
      metaData - user authentication metadata
      request - vehicle creation request
      bindingResult - binding result
      Returns:
      redirect to vehicles page
    • deleteVehicle

      @DeleteMapping("/vehicle") public String deleteVehicle(@RequestParam("id") UUID id, @AuthenticationPrincipal AuthenticationMetaData metaData)
      Deletes a vehicle by id.
      Parameters:
      id - vehicle id
      metaData - user authentication metadata
      Returns:
      redirect to vehicles page
    • updateProfile

      @PutMapping("/profile") public org.springframework.web.servlet.ModelAndView updateProfile(@AuthenticationPrincipal AuthenticationMetaData metaData, @Valid @Valid ChangeProfileInfoRequest changeProfileInfoRequest, org.springframework.validation.BindingResult bindingResult)
      Updates the user's profile.
      Parameters:
      metaData - The authentication metadata.
      changeProfileInfoRequest - The request containing the new profile information.
      bindingResult - The binding result.
      Returns:
      The updated settings page.
    • changePassword

      @PutMapping("/password") public org.springframework.web.servlet.ModelAndView changePassword(@AuthenticationPrincipal AuthenticationMetaData metaData, @Valid @Valid ChangeUserPasswordRequest changeUserPasswordRequest, org.springframework.validation.BindingResult result, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes)
      Changes the user's password.
      Parameters:
      metaData - The authentication metadata.
      changeUserPasswordRequest - The request containing the new password.
      result - The binding result.
      redirectAttributes - The redirect attributes.
      Returns:
      The updated settings page.