56 lines
1.4 KiB
Java
56 lines
1.4 KiB
Java
package org.hso.ecommerce.controller;
|
|
|
|
import org.hso.ecommerce.entities.user.User;
|
|
import org.hso.ecommerce.repos.user.UserRepository;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.ui.Model;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
import javax.servlet.http.HttpSession;
|
|
|
|
@Controller
|
|
@RequestMapping("/user")
|
|
public class UserController {
|
|
|
|
@Autowired
|
|
private final UserRepository userRepository = null;
|
|
|
|
@GetMapping("/")
|
|
public String user() {
|
|
return "redirect:/user/settings";
|
|
}
|
|
|
|
@GetMapping("/settings")
|
|
public String userSettings(Model model,
|
|
HttpSession session
|
|
) {
|
|
long userId = (long) session.getAttribute("userId");
|
|
User user = userRepository.findById(userId).get();
|
|
model.addAttribute("user", user);
|
|
|
|
//TODO: klären wegen Geschäftskundenunterscheidung
|
|
|
|
return "user/settings";
|
|
}
|
|
|
|
@GetMapping("/notifications/")
|
|
public String userNotifications() {
|
|
return "user/notifications/index";
|
|
}
|
|
|
|
@GetMapping("/orders/")
|
|
public String userOrdeers() {
|
|
return "user/orders/index";
|
|
}
|
|
|
|
// @GetMapping("/bonuspoints")
|
|
// public String userBonuspoints() {
|
|
// return "user/bonuspoints";
|
|
// }
|
|
|
|
|
|
|
|
}
|