- Timestamp:
- 01/04/23 02:49:26 (23 months ago)
- Branches:
- main
- Children:
- ab952ab
- Parents:
- 6832924
- Location:
- src/main
- Files:
-
- 3 added
- 47 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/com/example/autopartz/AutoPartzApplication.java
r6832924 rae042f4 3 3 import org.springframework.boot.SpringApplication; 4 4 import org.springframework.boot.autoconfigure.SpringBootApplication; 5 import org.springframework.context.annotation.Bean; 6 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; 7 import org.springframework.security.crypto.password.PasswordEncoder; 5 8 6 9 @SpringBootApplication … … 10 13 SpringApplication.run(AutoPartzApplication.class, args); 11 14 } 15 @Bean 16 PasswordEncoder passwordEncoder() { 17 return new BCryptPasswordEncoder(10); 18 } 19 12 20 13 21 } -
src/main/java/com/example/autopartz/controller/HomeController.java
r6832924 rae042f4 14 14 import org.springframework.web.bind.annotation.RequestMapping; 15 15 import org.springframework.web.bind.annotation.RequestParam; 16 17 import javax.servlet.http.HttpServletRequest; 16 18 17 19 @Controller … … 35 37 36 38 @GetMapping() 37 public String getHomePage(Model model ){39 public String getHomePage(Model model, HttpServletRequest request){ 38 40 model.addAttribute("bodyContent","home"); 41 model.addAttribute("user",request.getRemoteUser()); 39 42 return "master-template"; 40 43 } -
src/main/java/com/example/autopartz/controller/PartController.java
r6832924 rae042f4 5 5 import com.example.autopartz.service.PriceService; 6 6 import com.example.autopartz.service.RepairShopService; 7 import jakarta.servlet.http.HttpServletResponse;8 7 import org.springframework.stereotype.Controller; 9 8 import org.springframework.ui.Model; 10 9 import org.springframework.web.bind.annotation.*; 11 10 11 import javax.servlet.http.HttpServletResponse; 12 12 import java.io.IOException; 13 13 … … 24 24 } 25 25 @GetMapping("/{id}") 26 public String getPartPage(@PathVariable Longid, Model model){26 public String getPartPage(@PathVariable Integer id, Model model){ 27 27 Part temp = partService.findById(id); 28 28 Integer amount = priceService.findPriceForPart(temp).stream().findFirst().orElseThrow(RuntimeException::new).getAmount(); … … 33 33 } 34 34 @GetMapping("/delivery/{id}") 35 public String getDeliveryPage(@PathVariable Longid, Model model){35 public String getDeliveryPage(@PathVariable Integer id, Model model){ 36 36 model.addAttribute("repairShops",repairShopService.findAll()); 37 37 model.addAttribute("partId",id); -
src/main/java/com/example/autopartz/controller/UserController.java
r6832924 rae042f4 1 1 package com.example.autopartz.controller; 2 2 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; 3 import com.example.autopartz.repository.OrdersForUserRepository; 4 import com.example.autopartz.repository.RepairsForUserRepository; 5 import com.example.autopartz.repository.ReviewsForUserRepository; 7 6 import org.springframework.stereotype.Controller; 8 7 import org.springframework.ui.Model; 9 import org.springframework.web.bind.annotation. *;10 11 import java.util.List;8 import org.springframework.web.bind.annotation.GetMapping; 9 import org.springframework.web.bind.annotation.PathVariable; 10 import org.springframework.web.bind.annotation.RequestMapping; 12 11 13 12 @Controller 14 13 @RequestMapping("/") 15 14 public class UserController { 16 private final UserService userService;17 15 private final OrdersForUserRepository ordersForUserRepository; 18 16 private final RepairsForUserRepository repairsForUserRepository; 19 17 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) { 22 19 this.ordersForUserRepository = ordersForUserRepository; 23 20 this.repairsForUserRepository = repairsForUserRepository; 24 21 this.reviewsForUserRepository = reviewsForUserRepository; 25 22 } 26 @GetMapping("usersTest")27 public List<User> getAllUsers(){28 return userService.findAllUsers();29 }30 23 @GetMapping("orders/{id}") 31 public String getOrdersForUser(@PathVariable Longid, Model model){24 public String getOrdersForUser(@PathVariable Integer id, Model model){ 32 25 model.addAttribute("userOrders",ordersForUserRepository.findAllByUserid(id)); 33 26 model.addAttribute("bodyContent","ordersForUser"); … … 35 28 } 36 29 @GetMapping("repairs/{id}") 37 public String getRepairsForUser(@PathVariable Longid,Model model){30 public String getRepairsForUser(@PathVariable Integer id,Model model){ 38 31 model.addAttribute("userRepairs",repairsForUserRepository.findAllByUserid(id)); 39 32 model.addAttribute("bodyContent","repairsForUser"); … … 41 34 } 42 35 @GetMapping("reviews/{id}") 43 public String getReviewsForUser(@PathVariable Longid, Model model){36 public String getReviewsForUser(@PathVariable Integer id, Model model){ 44 37 model.addAttribute("userReviews",reviewsForUserRepository.findAllByUserid(id)); 45 38 model.addAttribute("bodyContent","reviewsForUser"); -
src/main/java/com/example/autopartz/model/Administrator.java
r6832924 rae042f4 1 1 package com.example.autopartz.model; 2 2 3 import jakarta.persistence.*; 4 import lombok.*; 3 import lombok.Getter; 4 import lombok.Setter; 5 import lombok.ToString; 5 6 import org.hibernate.Hibernate; 7 import org.springframework.security.core.GrantedAuthority; 6 8 9 import javax.persistence.Entity; 7 10 import java.time.LocalDate; 11 import java.util.Collection; 12 import java.util.Collections; 8 13 import java.util.Objects; 9 14 … … 29 34 return getClass().hashCode(); 30 35 } 36 37 @Override 38 public Collection<? extends GrantedAuthority> getAuthorities() { 39 return Collections.singletonList(Role.ROLE_ADMIN); 40 } 31 41 } -
src/main/java/com/example/autopartz/model/Car.java
r6832924 rae042f4 1 1 package com.example.autopartz.model; 2 2 3 import jakarta.persistence.*; 4 import lombok.*; 3 import lombok.Getter; 4 import lombok.RequiredArgsConstructor; 5 import lombok.Setter; 6 import lombok.ToString; 5 7 import org.hibernate.Hibernate; 6 8 9 import javax.persistence.*; 7 10 import java.util.Objects; 8 11 … … 15 18 public class Car { 16 19 @Id 17 LongID_car;20 Integer ID_car; 18 21 Integer in_production_since; 19 22 Integer in_production_till; -
src/main/java/com/example/autopartz/model/CarManufacturer.java
r6832924 rae042f4 1 1 package com.example.autopartz.model; 2 2 3 import jakarta.persistence.Entity;4 import jakarta.persistence.Id;5 import jakarta.persistence.Table;6 import lombok. *;3 import lombok.Getter; 4 import lombok.RequiredArgsConstructor; 5 import lombok.Setter; 6 import lombok.ToString; 7 7 import org.hibernate.Hibernate; 8 8 9 import javax.persistence.Entity; 10 import javax.persistence.Id; 11 import javax.persistence.Table; 9 12 import java.util.Objects; 10 13 … … 17 20 public class CarManufacturer { 18 21 @Id 19 LongID_car_manufacturer;22 Integer ID_car_manufacturer; 20 23 String cm_name; 21 24 String cm_country; -
src/main/java/com/example/autopartz/model/CarSample.java
r6832924 rae042f4 1 1 package com.example.autopartz.model; 2 2 3 import jakarta.persistence.*; 4 import lombok.*; 3 import lombok.Getter; 4 import lombok.RequiredArgsConstructor; 5 import lombok.Setter; 6 import lombok.ToString; 5 7 import org.hibernate.Hibernate; 6 8 9 import javax.persistence.*; 7 10 import java.util.Objects; 8 11 -
src/main/java/com/example/autopartz/model/Category.java
r6832924 rae042f4 1 1 package com.example.autopartz.model; 2 2 3 import jakarta.persistence.*; 4 import lombok.*; 3 import lombok.Getter; 4 import lombok.RequiredArgsConstructor; 5 import lombok.Setter; 6 import lombok.ToString; 5 7 import org.hibernate.Hibernate; 6 8 9 import javax.persistence.*; 7 10 import java.util.Objects; 8 11 … … 14 17 public class Category { 15 18 @Id 16 LongID_category;19 Integer ID_category; 17 20 @Column(name = "category_name") 18 21 String cname; -
src/main/java/com/example/autopartz/model/Client.java
r6832924 rae042f4 1 1 package com.example.autopartz.model; 2 2 3 import jakarta.persistence.Entity; 4 import lombok.*; 3 import lombok.Getter; 4 import lombok.RequiredArgsConstructor; 5 import lombok.Setter; 6 import lombok.ToString; 5 7 import org.hibernate.Hibernate; 8 import org.springframework.security.core.GrantedAuthority; 6 9 10 import javax.persistence.Entity; 11 import java.util.Collection; 12 import java.util.Collections; 7 13 import java.util.Objects; 8 14 … … 25 31 return getClass().hashCode(); 26 32 } 33 @Override 34 public Collection<? extends GrantedAuthority> getAuthorities() { 35 return Collections.singletonList(Role.ROLE_CLIENT); 36 } 27 37 } -
src/main/java/com/example/autopartz/model/Delivery.java
r6832924 rae042f4 1 1 package com.example.autopartz.model; 2 2 3 import jakarta.persistence.*; 4 import lombok.*; 3 import lombok.Getter; 4 import lombok.RequiredArgsConstructor; 5 import lombok.Setter; 6 import lombok.ToString; 5 7 import org.hibernate.Hibernate; 6 8 9 import javax.persistence.*; 7 10 import java.util.Objects; 8 11 … … 14 17 public class Delivery { 15 18 @Id 16 LongID_delivery;19 Integer ID_delivery; 17 20 String delivery_status; 18 21 String delivery_address; -
src/main/java/com/example/autopartz/model/Deliveryman.java
r6832924 rae042f4 1 1 package com.example.autopartz.model; 2 2 3 import jakarta.persistence.Entity; 4 import jakarta.persistence.Table; 5 import lombok.*; 3 import lombok.Getter; 4 import lombok.RequiredArgsConstructor; 5 import lombok.Setter; 6 import lombok.ToString; 6 7 import org.hibernate.Hibernate; 8 import org.springframework.security.core.GrantedAuthority; 7 9 10 import javax.persistence.Entity; 11 import javax.persistence.Table; 8 12 import java.time.LocalDate; 13 import java.util.Collection; 14 import java.util.Collections; 9 15 import java.util.Objects; 10 16 … … 30 36 return getClass().hashCode(); 31 37 } 38 @Override 39 public Collection<? extends GrantedAuthority> getAuthorities() { 40 return Collections.singletonList(Role.ROLE_DELIVERYMAN); 41 } 32 42 } -
src/main/java/com/example/autopartz/model/Order.java
r6832924 rae042f4 1 1 package com.example.autopartz.model; 2 2 3 import jakarta.persistence.*; 4 import lombok.*; 3 import lombok.Getter; 4 import lombok.RequiredArgsConstructor; 5 import lombok.Setter; 6 import lombok.ToString; 5 7 import org.hibernate.Hibernate; 6 8 9 import javax.persistence.*; 7 10 import java.time.LocalDateTime; 8 11 import java.util.List; … … 17 20 public class Order { 18 21 @Id 19 LongID_order;22 Integer ID_order; 20 23 String order_status; 21 24 LocalDateTime order_date; -
src/main/java/com/example/autopartz/model/Part.java
r6832924 rae042f4 1 1 package com.example.autopartz.model; 2 2 3 import jakarta.persistence.*;4 3 import lombok.Getter; 5 4 import lombok.RequiredArgsConstructor; … … 8 7 import org.hibernate.Hibernate; 9 8 9 import javax.persistence.*; 10 10 import java.util.List; 11 11 import java.util.Objects; … … 19 19 @Id 20 20 @Column(name = "ID_part") 21 Longid;21 Integer id; 22 22 @Column(name = "part_name") 23 23 String name; -
src/main/java/com/example/autopartz/model/PartManufacturer.java
r6832924 rae042f4 1 1 package com.example.autopartz.model; 2 2 3 import jakarta.persistence.Column; 4 import jakarta.persistence.Entity; 5 import jakarta.persistence.Id; 6 import jakarta.persistence.Table; 7 import lombok.*; 3 import lombok.Getter; 4 import lombok.RequiredArgsConstructor; 5 import lombok.Setter; 6 import lombok.ToString; 8 7 import org.hibernate.Hibernate; 9 8 9 import javax.persistence.Column; 10 import javax.persistence.Entity; 11 import javax.persistence.Id; 12 import javax.persistence.Table; 10 13 import java.util.Objects; 11 14 … … 18 21 public class PartManufacturer { 19 22 @Id 20 LongID_part_manufacturer;23 Integer ID_part_manufacturer; 21 24 @Column(name = "pm_name") 22 25 String name; -
src/main/java/com/example/autopartz/model/Price.java
r6832924 rae042f4 1 1 package com.example.autopartz.model; 2 2 3 import jakarta.persistence.Entity; 4 import jakarta.persistence.Id; 5 import jakarta.persistence.JoinColumn; 6 import jakarta.persistence.ManyToOne; 7 import lombok.*; 3 import lombok.Getter; 4 import lombok.RequiredArgsConstructor; 5 import lombok.Setter; 6 import lombok.ToString; 8 7 import org.hibernate.Hibernate; 9 8 9 import javax.persistence.Entity; 10 import javax.persistence.Id; 11 import javax.persistence.JoinColumn; 12 import javax.persistence.ManyToOne; 10 13 import java.time.LocalDate; 11 14 import java.util.Objects; … … 18 21 public class Price { 19 22 @Id 20 LongID_price;23 Integer ID_price; 21 24 Integer amount; 22 25 LocalDate price_from; -
src/main/java/com/example/autopartz/model/Repair.java
r6832924 rae042f4 1 1 package com.example.autopartz.model; 2 2 3 import jakarta.persistence.Entity; 4 import jakarta.persistence.Id; 5 import jakarta.persistence.JoinColumn; 6 import jakarta.persistence.ManyToOne; 7 import lombok.*; 3 import lombok.Getter; 4 import lombok.RequiredArgsConstructor; 5 import lombok.Setter; 6 import lombok.ToString; 8 7 import org.hibernate.Hibernate; 9 8 9 import javax.persistence.Entity; 10 import javax.persistence.Id; 11 import javax.persistence.JoinColumn; 12 import javax.persistence.ManyToOne; 10 13 import java.util.Objects; 11 14 … … 17 20 public class Repair { 18 21 @Id 19 LongID_repair;22 Integer ID_repair; 20 23 @ManyToOne 21 24 @JoinColumn(name = "vin") -
src/main/java/com/example/autopartz/model/RepairShop.java
r6832924 rae042f4 1 1 package com.example.autopartz.model; 2 2 3 import jakarta.persistence.*; 4 import lombok.*; 3 import lombok.Getter; 4 import lombok.RequiredArgsConstructor; 5 import lombok.Setter; 6 import lombok.ToString; 5 7 import org.hibernate.Hibernate; 6 8 9 import javax.persistence.*; 7 10 import java.util.List; 8 11 import java.util.Objects; … … 17 20 @Id 18 21 @Column(name = "ID_repair_shop") 19 Longid;22 Integer id; 20 23 @Column(name = "rs_name") 21 24 String name; -
src/main/java/com/example/autopartz/model/Review.java
r6832924 rae042f4 1 1 package com.example.autopartz.model; 2 2 3 import jakarta.persistence.Entity; 4 import jakarta.persistence.Id; 5 import jakarta.persistence.JoinColumn; 6 import jakarta.persistence.ManyToOne; 7 import lombok.*; 3 import lombok.Getter; 4 import lombok.RequiredArgsConstructor; 5 import lombok.Setter; 6 import lombok.ToString; 8 7 import org.hibernate.Hibernate; 9 8 9 import javax.persistence.Entity; 10 import javax.persistence.Id; 11 import javax.persistence.JoinColumn; 12 import javax.persistence.ManyToOne; 10 13 import java.util.Objects; 11 14 … … 17 20 public class Review { 18 21 @Id 19 LongID_review;22 Integer ID_review; 20 23 Integer review_rating; 21 24 String review_comment; -
src/main/java/com/example/autopartz/model/ServiceBook.java
r6832924 rae042f4 1 1 package com.example.autopartz.model; 2 2 3 import jakarta.persistence.*; 4 import lombok.*; 3 import lombok.Getter; 4 import lombok.RequiredArgsConstructor; 5 import lombok.Setter; 6 import lombok.ToString; 5 7 import org.hibernate.Hibernate; 6 8 9 import javax.persistence.*; 7 10 import java.time.LocalDateTime; 8 11 import java.util.Objects; … … 16 19 public class ServiceBook { 17 20 @Id 18 LongID_service_book;21 Integer ID_service_book; 19 22 LocalDateTime sb_created_on; 20 23 @OneToOne -
src/main/java/com/example/autopartz/model/User.java
r6832924 rae042f4 1 1 package com.example.autopartz.model; 2 2 3 import jakarta.persistence.*; 4 import lombok.*; 3 import lombok.Getter; 4 import lombok.RequiredArgsConstructor; 5 import lombok.Setter; 6 import lombok.ToString; 5 7 import org.hibernate.Hibernate; 8 import org.springframework.security.core.GrantedAuthority; 9 import org.springframework.security.core.userdetails.UserDetails; 6 10 11 import javax.persistence.*; 7 12 import java.time.LocalDateTime; 13 import java.util.Collection; 14 import java.util.Collections; 8 15 import java.util.Objects; 9 16 … … 15 22 @Table(name = "users_table") 16 23 @Inheritance(strategy = InheritanceType.JOINED) 17 public class User {24 public class User implements UserDetails { 18 25 @Id 19 LongID_user;26 Integer ID_user; 20 27 String username; 21 28 String email; … … 50 57 return getClass().hashCode(); 51 58 } 59 60 61 @Override 62 public Collection<? extends GrantedAuthority> getAuthorities() { 63 return Collections.singletonList(Role.ROLE_USER); 64 } 65 66 @Override 67 public boolean isAccountNonExpired() { 68 return true; 69 } 70 71 @Override 72 public boolean isAccountNonLocked() { 73 return true; 74 } 75 76 @Override 77 public boolean isCredentialsNonExpired() { 78 return true; 79 } 80 81 @Override 82 public boolean isEnabled() { 83 return true; 84 } 52 85 } -
src/main/java/com/example/autopartz/model/Warehouse.java
r6832924 rae042f4 1 1 package com.example.autopartz.model; 2 2 3 import jakarta.persistence.Entity; 4 import jakarta.persistence.Id; 5 import lombok.*; 3 import lombok.Getter; 4 import lombok.RequiredArgsConstructor; 5 import lombok.Setter; 6 import lombok.ToString; 6 7 import org.hibernate.Hibernate; 7 8 9 import javax.persistence.Entity; 10 import javax.persistence.Id; 8 11 import java.util.Objects; 9 12 … … 15 18 public class Warehouse { 16 19 @Id 17 LongID_warehouse;20 Integer ID_warehouse; 18 21 String warehouse_location; 19 22 -
src/main/java/com/example/autopartz/model/Warehouseman.java
r6832924 rae042f4 1 1 package com.example.autopartz.model; 2 2 3 import jakarta.persistence.Entity;4 import jakarta.persistence.JoinColumn;5 import jakarta.persistence.ManyToOne;6 import lombok. *;3 import lombok.Getter; 4 import lombok.RequiredArgsConstructor; 5 import lombok.Setter; 6 import lombok.ToString; 7 7 import org.hibernate.Hibernate; 8 import org.springframework.security.core.GrantedAuthority; 8 9 10 import javax.persistence.Entity; 11 import javax.persistence.JoinColumn; 12 import javax.persistence.ManyToOne; 9 13 import java.time.LocalDate; 14 import java.util.Collection; 15 import java.util.Collections; 10 16 import java.util.Objects; 11 17 … … 33 39 return getClass().hashCode(); 34 40 } 41 @Override 42 public Collection<? extends GrantedAuthority> getAuthorities() { 43 return Collections.singletonList(Role.ROLE_WAREHOUSEMAN); 44 } 35 45 } -
src/main/java/com/example/autopartz/model/views/OrdersForUser.java
r6832924 rae042f4 1 1 package com.example.autopartz.model.views; 2 2 3 import jakarta.persistence.Entity; 4 import jakarta.persistence.Id; 5 import jakarta.persistence.IdClass; 6 import jakarta.persistence.Table; 7 import lombok.*; 3 import lombok.Getter; 4 import lombok.RequiredArgsConstructor; 5 import lombok.Setter; 6 import lombok.ToString; 8 7 import org.hibernate.annotations.Immutable; 9 8 9 import javax.persistence.Entity; 10 import javax.persistence.Id; 11 import javax.persistence.IdClass; 12 import javax.persistence.Table; 10 13 import java.io.Serial; 11 14 import java.io.Serializable; … … 25 28 private static final long serialVersionUID = 1L; 26 29 @Id 27 Longuserid;30 Integer userid; 28 31 @Id 29 32 LocalDateTime orderdate; -
src/main/java/com/example/autopartz/model/views/OrdersForUserId.java
r6832924 rae042f4 8 8 @Data 9 9 public class OrdersForUserId implements Serializable { 10 Longuserid;10 Integer userid; 11 11 LocalDateTime orderdate; 12 12 String partname; -
src/main/java/com/example/autopartz/model/views/PartsForCarTypeAndCategory.java
r6832924 rae042f4 1 1 package com.example.autopartz.model.views; 2 2 3 import jakarta.persistence.Entity;4 import jakarta.persistence.Id;5 import jakarta.persistence.Table;6 import lombok. *;3 import lombok.Getter; 4 import lombok.RequiredArgsConstructor; 5 import lombok.Setter; 6 import lombok.ToString; 7 7 import org.hibernate.annotations.Immutable; 8 8 9 import javax.persistence.Entity; 10 import javax.persistence.Id; 11 import javax.persistence.Table; 9 12 import java.io.Serial; 10 13 import java.io.Serializable; … … 21 24 private static final long serialVersionUID = 1L; 22 25 @Id 23 Longpartid;26 Integer partid; 24 27 String partname; 25 28 String cartype; -
src/main/java/com/example/autopartz/model/views/RepairShopReviewsSummary.java
r6832924 rae042f4 1 1 package com.example.autopartz.model.views; 2 2 3 import jakarta.persistence.Entity;4 import jakarta.persistence.Id;5 import jakarta.persistence.Table;6 import lombok. *;3 import lombok.Getter; 4 import lombok.RequiredArgsConstructor; 5 import lombok.Setter; 6 import lombok.ToString; 7 7 import org.hibernate.Hibernate; 8 8 import org.hibernate.annotations.Immutable; 9 9 10 import javax.persistence.Entity; 11 import javax.persistence.Id; 12 import javax.persistence.Table; 10 13 import java.io.Serial; 11 14 import java.io.Serializable; … … 24 27 private static final long serialVersionUID = 1L; 25 28 @Id 26 Longrsid;29 Integer rsid; 27 30 String rsname; 28 Integerreviewcount;31 Long reviewcount; 29 32 Float reviewaverage; 30 33 -
src/main/java/com/example/autopartz/model/views/RepairsForUser.java
r6832924 rae042f4 1 1 package com.example.autopartz.model.views; 2 2 3 import jakarta.persistence.Entity;4 import jakarta.persistence.Id;5 import jakarta.persistence.IdClass;6 import jakarta.persistence.Table;7 3 import lombok.Getter; 8 4 import lombok.RequiredArgsConstructor; … … 11 7 import org.hibernate.annotations.Immutable; 12 8 9 import javax.persistence.Entity; 10 import javax.persistence.Id; 11 import javax.persistence.IdClass; 12 import javax.persistence.Table; 13 13 import java.io.Serial; 14 14 import java.io.Serializable; … … 28 28 private static final long serialVersionUID = 1L; 29 29 @Id 30 Longuserid;30 Integer userid; 31 31 @Id 32 32 LocalDateTime orderdate; -
src/main/java/com/example/autopartz/model/views/ReviewsForUser.java
r6832924 rae042f4 1 1 package com.example.autopartz.model.views; 2 2 3 import jakarta.persistence.Entity;4 import jakarta.persistence.Id;5 import jakarta.persistence.Table;6 3 import lombok.Getter; 7 4 import lombok.RequiredArgsConstructor; … … 10 7 import org.hibernate.annotations.Immutable; 11 8 9 import javax.persistence.Entity; 10 import javax.persistence.Id; 11 import javax.persistence.Table; 12 12 import java.io.Serial; 13 13 import java.io.Serializable; … … 25 25 private static final long serialVersionUID = 1L; 26 26 @Id 27 Longrepairid;28 Longuserid;27 Integer repairid; 28 Integer userid; 29 29 Integer rating; 30 30 String rcomment; -
src/main/java/com/example/autopartz/repository/CarRepository.java
r6832924 rae042f4 6 6 7 7 @Repository 8 public interface CarRepository extends JpaRepository<Car, Long> {8 public interface CarRepository extends JpaRepository<Car,Integer> { 9 9 } -
src/main/java/com/example/autopartz/repository/CategoryRepository.java
r6832924 rae042f4 6 6 7 7 @Repository 8 public interface CategoryRepository extends JpaRepository<Category, Long> {8 public interface CategoryRepository extends JpaRepository<Category,Integer> { 9 9 } -
src/main/java/com/example/autopartz/repository/OrdersForUserRepository.java
r6832924 rae042f4 3 3 import com.example.autopartz.model.views.OrdersForUser; 4 4 import com.example.autopartz.model.views.OrdersForUserId; 5 import jakarta.transaction.Transactional;6 5 import org.springframework.data.jpa.repository.JpaRepository; 7 6 import org.springframework.stereotype.Repository; 8 7 8 import javax.transaction.Transactional; 9 9 import java.util.List; 10 10 … … 12 12 @Transactional 13 13 public interface OrdersForUserRepository extends JpaRepository<OrdersForUser, OrdersForUserId> { 14 List<OrdersForUser> findAllByUserid( Longuserid);14 List<OrdersForUser> findAllByUserid(Integer userid); 15 15 } -
src/main/java/com/example/autopartz/repository/PartRepository.java
r6832924 rae042f4 6 6 7 7 @Repository 8 public interface PartRepository extends JpaRepository<Part, Long> {8 public interface PartRepository extends JpaRepository<Part,Integer> { 9 9 } -
src/main/java/com/example/autopartz/repository/PartsForCarTypeAndCategoryRepository.java
r6832924 rae042f4 2 2 3 3 import com.example.autopartz.model.views.PartsForCarTypeAndCategory; 4 import jakarta.transaction.Transactional;5 4 import org.springframework.data.jpa.repository.JpaRepository; 6 5 import org.springframework.stereotype.Repository; 7 6 7 import javax.transaction.Transactional; 8 8 import java.util.List; 9 9 10 10 @Repository 11 11 @Transactional 12 public interface PartsForCarTypeAndCategoryRepository extends JpaRepository<PartsForCarTypeAndCategory, Long> {12 public interface PartsForCarTypeAndCategoryRepository extends JpaRepository<PartsForCarTypeAndCategory,Integer> { 13 13 List<PartsForCarTypeAndCategory> findAllByCartypeAndCategory(String cartype, String category); 14 14 } -
src/main/java/com/example/autopartz/repository/PriceRepository.java
r6832924 rae042f4 7 7 import java.util.List; 8 8 9 public interface PriceRepository extends JpaRepository<Price, Long> {9 public interface PriceRepository extends JpaRepository<Price,Integer> { 10 10 List<Price> findAllByPart(Part part); 11 11 } -
src/main/java/com/example/autopartz/repository/RepairShopRepository.java
r6832924 rae042f4 6 6 7 7 @Repository 8 public interface RepairShopRepository extends JpaRepository<RepairShop, Long> {8 public interface RepairShopRepository extends JpaRepository<RepairShop,Integer> { 9 9 10 10 } -
src/main/java/com/example/autopartz/repository/RepairShopReviewSummaryRepository.java
r6832924 rae042f4 2 2 3 3 import com.example.autopartz.model.views.RepairShopReviewsSummary; 4 import jakarta.transaction.Transactional;5 4 import org.springframework.data.jpa.repository.JpaRepository; 6 5 import org.springframework.stereotype.Repository; 6 7 import javax.transaction.Transactional; 7 8 8 9 // извештај за сите сервиси и за сите број на reviews и avg рејтинг 9 10 @Repository 10 11 @Transactional 11 public interface RepairShopReviewSummaryRepository extends JpaRepository<RepairShopReviewsSummary, Long> {12 // List<RepairShopReviewsSummary> findAllByRsid( Longrsid);12 public interface RepairShopReviewSummaryRepository extends JpaRepository<RepairShopReviewsSummary,Integer> { 13 // List<RepairShopReviewsSummary> findAllByRsid(Integer rsid); 13 14 } -
src/main/java/com/example/autopartz/repository/RepairsForUserRepository.java
r6832924 rae042f4 10 10 @Repository 11 11 public interface RepairsForUserRepository extends JpaRepository<RepairsForUser, OrdersForUserId> { 12 List<RepairsForUser> findAllByUserid( Longuserid);12 List<RepairsForUser> findAllByUserid(Integer userid); 13 13 } -
src/main/java/com/example/autopartz/repository/ReviewsForUserRepository.java
r6832924 rae042f4 8 8 9 9 @Repository 10 public interface ReviewsForUserRepository extends JpaRepository<ReviewsForUser, Long> {11 List<ReviewsForUser> findAllByUserid( Longid);10 public interface ReviewsForUserRepository extends JpaRepository<ReviewsForUser,Integer> { 11 List<ReviewsForUser> findAllByUserid(Integer id); 12 12 } -
src/main/java/com/example/autopartz/repository/UserRepository.java
r6832924 rae042f4 10 10 11 11 @Repository 12 public interface UserRepository extends JpaRepository<User, Long> {13 //List<User> findAllByUsername(String username);12 public interface UserRepository extends JpaRepository<User,Integer> { 13 List<User> findAllByUsername(String username); 14 14 List<User> findAllByUsernameAndPassword(String username, String password); 15 15 } -
src/main/java/com/example/autopartz/service/LoginService.java
r6832924 rae042f4 6 6 User register(String name, String username, String email, String number, String password); 7 7 User login(String username, String password); 8 // User findByUsername(String username);9 10 8 } -
src/main/java/com/example/autopartz/service/PartService.java
r6832924 rae042f4 7 7 public interface PartService { 8 8 List<Part> findAll(); 9 Part findById( Longid);9 Part findById(Integer id); 10 10 } -
src/main/java/com/example/autopartz/service/UserService.java
r6832924 rae042f4 7 7 public interface UserService { 8 8 List<User> findAllUsers(); 9 User findByUsername(String username); 10 9 11 } -
src/main/java/com/example/autopartz/service/impl/PartServiceImpl.java
r6832924 rae042f4 22 22 23 23 @Override 24 public Part findById( Longid) {24 public Part findById(Integer id) { 25 25 return partRepository.findById(id).orElseThrow(RuntimeException::new); 26 26 } -
src/main/java/com/example/autopartz/service/impl/UserServiceImpl.java
r6832924 rae042f4 20 20 return userRepository.findAll(); 21 21 } 22 23 @Override 24 public User findByUsername(String username) { 25 return userRepository.findAllByUsername(username).stream().findFirst().orElseThrow(RuntimeException::new); 26 } 22 27 } -
src/main/resources/templates/filteredParts.html
r6832924 rae042f4 1 1 <div> 2 2 <h1>Резултат од филтерот</h1> 3 <a th:href="${'/ '}">Врати се на сите производи</a>3 <a th:href="${'/products'}">Врати се на сите производи</a> 4 4 5 5 <table> -
src/main/resources/templates/fragments/header.html
r6832924 rae042f4 1 <header >1 <header xmlns:sec="http://www.w3.org/1999/xhtml"> 2 2 <nav class="navbar navbar-expand-md navbar-dark bg-dark"> 3 3 <div class="container"> … … 19 19 20 20 <ul class="nav navbar-nav navbar-right"> 21 21 <th:block th:if="${#request.getRemoteUser() != null}"> 22 22 <li class="nav-item"> 23 <a class="nav-link" href="#"> 24 <!-- <th:block th:if="${#request.getRemoteUser() != null}"--> 25 <!-- th:text="${#request.getRemoteUser()}"></th:block>--> 23 <a class="btn btn-success btn-sm ml-3" href="/register"> 24 <th:block th:text="${#request.getRemoteUser()}"></th:block> 26 25 </a> 27 26 </li> 27 </th:block> 28 <th:block th:if="${#request.getRemoteUser() == null}"> 28 29 <li class="nav-item"> 29 30 <a class="btn btn-success btn-sm ml-3" href="/register"> … … 31 32 </a> 32 33 </li> 33 <li class="nav-item"> 34 </th:block> 35 <th:block th:if="${#request.getRemoteUser() != null}"> 36 <li class="nav-item" sec:authorize="isAuthenticated()"> 34 37 <a class="btn btn-light btn-sm ml-3" href="/logout"> 35 <i class="fa fa-shopping-cart"></i> Одјави се 38 <i class="fa fa-shopping-cart"></i> 39 Одјави се 36 40 </a> 37 41 </li> 42 </th:block> 43 <th:block th:if="${#request.getRemoteUser() == null}"> 38 44 <li class="nav-item"> 39 45 <a class="btn btn-light btn-sm ml-3" href="/login"> … … 41 47 </a> 42 48 </li> 49 </th:block> 43 50 </ul> 44 51 </div>
Note:
See TracChangeset
for help on using the changeset viewer.