Changeset 6832924


Ignore:
Timestamp:
01/03/23 23:14:33 (23 months ago)
Author:
andrejtodorovski <82031894+andrejtodorovski@…>
Branches:
main
Children:
ae042f4
Parents:
60de3eb
Message:

Moved products page and added services page

Location:
src/main
Files:
2 added
2 edited
1 moved

Legend:

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

    r60de3eb r6832924  
    33import com.example.autopartz.model.User;
    44import com.example.autopartz.repository.PartsForCarTypeAndCategoryRepository;
     5import com.example.autopartz.repository.RepairShopReviewSummaryRepository;
    56import com.example.autopartz.service.CarService;
    67import com.example.autopartz.service.CategoryService;
     
    2223    private final CarService carService;
    2324    private final CategoryService categoryService;
     25    private final RepairShopReviewSummaryRepository repairShopReviewSummaryRepository;
    2426
    25     public HomeController(LoginService loginService, PartService partService, PartsForCarTypeAndCategoryRepository partsForCarTypeAndCategoryRepository, CarService carService, CategoryService categoryService) {
     27    public HomeController(LoginService loginService, PartService partService, PartsForCarTypeAndCategoryRepository partsForCarTypeAndCategoryRepository, CarService carService, CategoryService categoryService, RepairShopReviewSummaryRepository repairShopReviewSummaryRepository) {
    2628        this.loginService = loginService;
    2729        this.partService = partService;
     
    2931        this.carService = carService;
    3032        this.categoryService = categoryService;
     33        this.repairShopReviewSummaryRepository = repairShopReviewSummaryRepository;
    3134    }
    3235
    3336    @GetMapping()
    3437    public String getHomePage(Model model){
     38        model.addAttribute("bodyContent","home");
     39        return "master-template";
     40    }
     41    @GetMapping("/products")
     42    public String getProducts(Model model){
    3543        model.addAttribute("parts",partService.findAll());
    3644        model.addAttribute("cars",carService.findAll());
    3745        model.addAttribute("categories",categoryService.findAll());
    38         model.addAttribute("bodyContent","homepage");
     46        model.addAttribute("bodyContent","products");
     47        return "master-template";
     48    }
     49    @GetMapping("/services")
     50    public String getServices(Model model){
     51        model.addAttribute("services",repairShopReviewSummaryRepository.findAll());
     52        model.addAttribute("bodyContent","services");
    3953        return "master-template";
    4054    }
  • src/main/java/com/example/autopartz/controller/UserController.java

    r60de3eb r6832924  
    1515public class UserController {
    1616    private final UserService userService;
    17     private final RepairShopReviewSummaryRepository repairShopReviewSummaryRepository;
    18 
    1917    private final OrdersForUserRepository ordersForUserRepository;
    2018    private final RepairsForUserRepository repairsForUserRepository;
    2119    private final ReviewsForUserRepository reviewsForUserRepository;
    22     public UserController(UserService userService, RepairShopReviewSummaryRepository repairShopReviewSummaryRepository, OrdersForUserRepository ordersForUserRepository, RepairsForUserRepository repairsForUserRepository, ReviewsForUserRepository reviewsForUserRepository) {
     20    public UserController(UserService userService, OrdersForUserRepository ordersForUserRepository, RepairsForUserRepository repairsForUserRepository, ReviewsForUserRepository reviewsForUserRepository) {
    2321        this.userService = userService;
    24         this.repairShopReviewSummaryRepository = repairShopReviewSummaryRepository;
    2522        this.ordersForUserRepository = ordersForUserRepository;
    2623        this.repairsForUserRepository = repairsForUserRepository;
    2724        this.reviewsForUserRepository = reviewsForUserRepository;
    28     }
    29     @GetMapping("reportTest")
    30     public List<RepairShopReviewsSummary> getRepairShopReport(){
    31         return repairShopReviewSummaryRepository.findAll();
    3225    }
    3326    @GetMapping("usersTest")
Note: See TracChangeset for help on using the changeset viewer.