Ignore:
Timestamp:
01/03/23 23:03:00 (23 months ago)
Author:
andrejtodorovski <82031894+andrejtodorovski@…>
Branches:
main
Children:
6832924
Parents:
feffc2f
Message:

Added master template and added filtering parts by car and category

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/com/example/autopartz/controller/UserController.java

    rfeffc2f r60de3eb  
    1616    private final UserService userService;
    1717    private final RepairShopReviewSummaryRepository repairShopReviewSummaryRepository;
    18     private final PartsForCarTypeAndCategoryRepository partsForCarTypeAndCategoryRepository;
    1918
    2019    private final OrdersForUserRepository ordersForUserRepository;
    2120    private final RepairsForUserRepository repairsForUserRepository;
    2221    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) {
    2423        this.userService = userService;
    2524        this.repairShopReviewSummaryRepository = repairShopReviewSummaryRepository;
    26         this.partsForCarTypeAndCategoryRepository = partsForCarTypeAndCategoryRepository;
    2725        this.ordersForUserRepository = ordersForUserRepository;
    2826        this.repairsForUserRepository = repairsForUserRepository;
     
    3735        return userService.findAllUsers();
    3836    }
    39     @GetMapping("parts")
    40     public List<PartsForCarTypeAndCategory> getPartsForCarTypeAndCategory(@RequestParam String cartype, @RequestParam String category){
    41         return partsForCarTypeAndCategoryRepository.findAllByCartypeAndCategory(cartype,category);
    42     }
    4337    @GetMapping("orders/{id}")
    4438    public String getOrdersForUser(@PathVariable Long id, Model model){
    4539        model.addAttribute("userOrders",ordersForUserRepository.findAllByUserid(id));
    46         return "ordersForUser";
     40        model.addAttribute("bodyContent","ordersForUser");
     41        return "master-template";
    4742    }
    4843    @GetMapping("repairs/{id}")
    4944    public String getRepairsForUser(@PathVariable Long id,Model model){
    5045        model.addAttribute("userRepairs",repairsForUserRepository.findAllByUserid(id));
    51         return "repairsForUser";
     46        model.addAttribute("bodyContent","repairsForUser");
     47        return "master-template";
    5248    }
    5349    @GetMapping("reviews/{id}")
    5450    public String getReviewsForUser(@PathVariable Long id, Model model){
    5551        model.addAttribute("userReviews",reviewsForUserRepository.findAllByUserid(id));
    56         return "reviewsForUser";
     52        model.addAttribute("bodyContent","reviewsForUser");
     53        return "master-template";
    5754    }
    5855}
Note: See TracChangeset for help on using the changeset viewer.