Ignore:
Timestamp:
01/04/23 02:49:26 (23 months ago)
Author:
andrejtodorovski <82031894+andrejtodorovski@…>
Branches:
main
Children:
ab952ab
Parents:
6832924
Message:

Configured spring security, changed spring version

File:
1 edited

Legend:

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

    r6832924 rae042f4  
    11package com.example.autopartz.controller;
    22
    3 import com.example.autopartz.model.*;
    4 import com.example.autopartz.model.views.*;
    5 import com.example.autopartz.repository.*;
    6 import com.example.autopartz.service.UserService;
     3import com.example.autopartz.repository.OrdersForUserRepository;
     4import com.example.autopartz.repository.RepairsForUserRepository;
     5import com.example.autopartz.repository.ReviewsForUserRepository;
    76import org.springframework.stereotype.Controller;
    87import org.springframework.ui.Model;
    9 import org.springframework.web.bind.annotation.*;
    10 
    11 import java.util.List;
     8import org.springframework.web.bind.annotation.GetMapping;
     9import org.springframework.web.bind.annotation.PathVariable;
     10import org.springframework.web.bind.annotation.RequestMapping;
    1211
    1312@Controller
    1413@RequestMapping("/")
    1514public class UserController {
    16     private final UserService userService;
    1715    private final OrdersForUserRepository ordersForUserRepository;
    1816    private final RepairsForUserRepository repairsForUserRepository;
    1917    private final ReviewsForUserRepository reviewsForUserRepository;
    20     public UserController(UserService userService, OrdersForUserRepository ordersForUserRepository, RepairsForUserRepository repairsForUserRepository, ReviewsForUserRepository reviewsForUserRepository) {
    21         this.userService = userService;
     18    public UserController(OrdersForUserRepository ordersForUserRepository, RepairsForUserRepository repairsForUserRepository, ReviewsForUserRepository reviewsForUserRepository) {
    2219        this.ordersForUserRepository = ordersForUserRepository;
    2320        this.repairsForUserRepository = repairsForUserRepository;
    2421        this.reviewsForUserRepository = reviewsForUserRepository;
    2522    }
    26     @GetMapping("usersTest")
    27     public List<User> getAllUsers(){
    28         return userService.findAllUsers();
    29     }
    3023    @GetMapping("orders/{id}")
    31     public String getOrdersForUser(@PathVariable Long id, Model model){
     24    public String getOrdersForUser(@PathVariable Integer id, Model model){
    3225        model.addAttribute("userOrders",ordersForUserRepository.findAllByUserid(id));
    3326        model.addAttribute("bodyContent","ordersForUser");
     
    3528    }
    3629    @GetMapping("repairs/{id}")
    37     public String getRepairsForUser(@PathVariable Long id,Model model){
     30    public String getRepairsForUser(@PathVariable Integer id,Model model){
    3831        model.addAttribute("userRepairs",repairsForUserRepository.findAllByUserid(id));
    3932        model.addAttribute("bodyContent","repairsForUser");
     
    4134    }
    4235    @GetMapping("reviews/{id}")
    43     public String getReviewsForUser(@PathVariable Long id, Model model){
     36    public String getReviewsForUser(@PathVariable Integer id, Model model){
    4437        model.addAttribute("userReviews",reviewsForUserRepository.findAllByUserid(id));
    4538        model.addAttribute("bodyContent","reviewsForUser");
Note: See TracChangeset for help on using the changeset viewer.