- Timestamp:
- 01/03/23 23:03:00 (23 months ago)
- Branches:
- main
- Children:
- 6832924
- Parents:
- feffc2f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/com/example/autopartz/controller/UserController.java
rfeffc2f r60de3eb 16 16 private final UserService userService; 17 17 private final RepairShopReviewSummaryRepository repairShopReviewSummaryRepository; 18 private final PartsForCarTypeAndCategoryRepository partsForCarTypeAndCategoryRepository;19 18 20 19 private final OrdersForUserRepository ordersForUserRepository; 21 20 private final RepairsForUserRepository repairsForUserRepository; 22 21 private final ReviewsForUserRepository reviewsForUserRepository; 23 public UserController(UserService userService, RepairShopReviewSummaryRepository repairShopReviewSummaryRepository, PartsForCarTypeAndCategoryRepository partsForCarTypeAndCategoryRepository,OrdersForUserRepository ordersForUserRepository, RepairsForUserRepository repairsForUserRepository, ReviewsForUserRepository reviewsForUserRepository) {22 public UserController(UserService userService, RepairShopReviewSummaryRepository repairShopReviewSummaryRepository, OrdersForUserRepository ordersForUserRepository, RepairsForUserRepository repairsForUserRepository, ReviewsForUserRepository reviewsForUserRepository) { 24 23 this.userService = userService; 25 24 this.repairShopReviewSummaryRepository = repairShopReviewSummaryRepository; 26 this.partsForCarTypeAndCategoryRepository = partsForCarTypeAndCategoryRepository;27 25 this.ordersForUserRepository = ordersForUserRepository; 28 26 this.repairsForUserRepository = repairsForUserRepository; … … 37 35 return userService.findAllUsers(); 38 36 } 39 @GetMapping("parts")40 public List<PartsForCarTypeAndCategory> getPartsForCarTypeAndCategory(@RequestParam String cartype, @RequestParam String category){41 return partsForCarTypeAndCategoryRepository.findAllByCartypeAndCategory(cartype,category);42 }43 37 @GetMapping("orders/{id}") 44 38 public String getOrdersForUser(@PathVariable Long id, Model model){ 45 39 model.addAttribute("userOrders",ordersForUserRepository.findAllByUserid(id)); 46 return "ordersForUser"; 40 model.addAttribute("bodyContent","ordersForUser"); 41 return "master-template"; 47 42 } 48 43 @GetMapping("repairs/{id}") 49 44 public String getRepairsForUser(@PathVariable Long id,Model model){ 50 45 model.addAttribute("userRepairs",repairsForUserRepository.findAllByUserid(id)); 51 return "repairsForUser"; 46 model.addAttribute("bodyContent","repairsForUser"); 47 return "master-template"; 52 48 } 53 49 @GetMapping("reviews/{id}") 54 50 public String getReviewsForUser(@PathVariable Long id, Model model){ 55 51 model.addAttribute("userReviews",reviewsForUserRepository.findAllByUserid(id)); 56 return "reviewsForUser"; 52 model.addAttribute("bodyContent","reviewsForUser"); 53 return "master-template"; 57 54 } 58 55 }
Note:
See TracChangeset
for help on using the changeset viewer.