Index: src/main/java/com/example/autopartz/controller/UserController.java
===================================================================
--- src/main/java/com/example/autopartz/controller/UserController.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
+++ src/main/java/com/example/autopartz/controller/UserController.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
@@ -0,0 +1,31 @@
+package com.example.autopartz.controller;
+
+import com.example.autopartz.model.RepairShopReviewsSummary;
+import com.example.autopartz.model.User;
+import com.example.autopartz.repository.RepairShopReviewSummaryRepository;
+import com.example.autopartz.service.UserService;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+@RestController
+@RequestMapping("/")
+public class UserController {
+    private final UserService userService;
+    private final RepairShopReviewSummaryRepository rspsr;
+
+    public UserController(UserService userService, RepairShopReviewSummaryRepository rspsr) {
+        this.userService = userService;
+        this.rspsr = rspsr;
+    }
+    @GetMapping("reportTest")
+    public List<RepairShopReviewsSummary> getRepairShopReport(){
+        return rspsr.findAllByRsid(2L);
+    }
+    @GetMapping("usersTest")
+    public List<User> getAllUsers(){
+        return userService.findAllUsers();
+    }
+}
Index: src/main/java/com/example/autopartz/model/Administrator.java
===================================================================
--- src/main/java/com/example/autopartz/model/Administrator.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
+++ src/main/java/com/example/autopartz/model/Administrator.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
@@ -0,0 +1,31 @@
+package com.example.autopartz.model;
+
+import jakarta.persistence.*;
+import lombok.*;
+import org.hibernate.Hibernate;
+
+import java.time.LocalDate;
+import java.util.Objects;
+
+@Getter
+@Setter
+@ToString
+@Entity
+public class Administrator extends User{
+    LocalDate authorized_from;
+    LocalDate authorized_till;
+
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
+        Administrator that = (Administrator) o;
+        return ID_user != null && Objects.equals(ID_user, that.ID_user);
+    }
+
+    @Override
+    public int hashCode() {
+        return getClass().hashCode();
+    }
+}
Index: src/main/java/com/example/autopartz/model/Car.java
===================================================================
--- src/main/java/com/example/autopartz/model/Car.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
+++ src/main/java/com/example/autopartz/model/Car.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
@@ -0,0 +1,37 @@
+package com.example.autopartz.model;
+
+import jakarta.persistence.*;
+import lombok.*;
+import org.hibernate.Hibernate;
+
+import java.util.Objects;
+
+@Getter
+@Setter
+@ToString
+@RequiredArgsConstructor
+@Entity
+@Table(name = "car")
+public class Car {
+    @Id
+    Long ID_car;
+    Integer in_production_since;
+    Integer in_production_till;
+    String car_type;
+    @ManyToOne
+    @JoinColumn(name = "id_car_manufacturer")
+    CarManufacturer car_manufacturer;
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
+        Car car = (Car) o;
+        return ID_car != null && Objects.equals(ID_car, car.ID_car);
+    }
+
+    @Override
+    public int hashCode() {
+        return getClass().hashCode();
+    }
+}
Index: src/main/java/com/example/autopartz/model/CarManufacturer.java
===================================================================
--- src/main/java/com/example/autopartz/model/CarManufacturer.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
+++ src/main/java/com/example/autopartz/model/CarManufacturer.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
@@ -0,0 +1,35 @@
+package com.example.autopartz.model;
+
+import jakarta.persistence.Entity;
+import jakarta.persistence.Id;
+import jakarta.persistence.Table;
+import lombok.*;
+import org.hibernate.Hibernate;
+
+import java.util.Objects;
+
+@Getter
+@Setter
+@ToString
+@RequiredArgsConstructor
+@Entity
+@Table(name = "car_manufacturer", schema = "project")
+public class CarManufacturer {
+    @Id
+    Long ID_car_manufacturer;
+    String cm_name;
+    String cm_country;
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
+        CarManufacturer that = (CarManufacturer) o;
+        return ID_car_manufacturer != null && Objects.equals(ID_car_manufacturer, that.ID_car_manufacturer);
+    }
+
+    @Override
+    public int hashCode() {
+        return getClass().hashCode();
+    }
+}
Index: src/main/java/com/example/autopartz/model/CarSample.java
===================================================================
--- src/main/java/com/example/autopartz/model/CarSample.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
+++ src/main/java/com/example/autopartz/model/CarSample.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
@@ -0,0 +1,42 @@
+package com.example.autopartz.model;
+
+import jakarta.persistence.*;
+import lombok.*;
+import org.hibernate.Hibernate;
+
+import java.util.Objects;
+
+@Getter
+@Setter
+@ToString
+@RequiredArgsConstructor
+@Entity
+@Table(name = "car_sample")
+public class CarSample {
+    @Id
+    Integer vin;
+    Integer year_of_production;
+    Integer engine_power;
+    Integer displacement;
+    String fuel_type;
+    Integer km_driven;
+    @ManyToOne
+    @JoinColumn(name = "id_user")
+    Client client;
+    @ManyToOne
+    @JoinColumn(name = "id_car")
+    Car car;
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
+        CarSample carSample = (CarSample) o;
+        return vin != null && Objects.equals(vin, carSample.vin);
+    }
+
+    @Override
+    public int hashCode() {
+        return getClass().hashCode();
+    }
+}
Index: src/main/java/com/example/autopartz/model/Category.java
===================================================================
--- src/main/java/com/example/autopartz/model/Category.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
+++ src/main/java/com/example/autopartz/model/Category.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
@@ -0,0 +1,37 @@
+package com.example.autopartz.model;
+
+import jakarta.persistence.Entity;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import lombok.*;
+import org.hibernate.Hibernate;
+
+import java.util.Objects;
+
+@Getter
+@Setter
+@ToString
+@RequiredArgsConstructor
+@Entity
+public class Category {
+    @Id
+    Long ID_category;
+    String category_name;
+    @ManyToOne
+    @JoinColumn(name = "id_parent_category")
+    Category ID_parent_category;
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
+        Category category = (Category) o;
+        return ID_category != null && Objects.equals(ID_category, category.ID_category);
+    }
+
+    @Override
+    public int hashCode() {
+        return getClass().hashCode();
+    }
+}
Index: src/main/java/com/example/autopartz/model/Client.java
===================================================================
--- src/main/java/com/example/autopartz/model/Client.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
+++ src/main/java/com/example/autopartz/model/Client.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
@@ -0,0 +1,27 @@
+package com.example.autopartz.model;
+
+import jakarta.persistence.Entity;
+import lombok.*;
+import org.hibernate.Hibernate;
+
+import java.util.Objects;
+
+@Getter
+@Setter
+@ToString
+@RequiredArgsConstructor
+@Entity
+public class Client extends User{
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
+        Client client = (Client) o;
+        return ID_user != null && Objects.equals(ID_user, client.ID_user);
+    }
+
+    @Override
+    public int hashCode() {
+        return getClass().hashCode();
+    }
+}
Index: src/main/java/com/example/autopartz/model/Delivery.java
===================================================================
--- src/main/java/com/example/autopartz/model/Delivery.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
+++ src/main/java/com/example/autopartz/model/Delivery.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
@@ -0,0 +1,38 @@
+package com.example.autopartz.model;
+
+import jakarta.persistence.*;
+import lombok.*;
+import org.hibernate.Hibernate;
+
+import java.util.Objects;
+
+@Entity
+@Getter
+@Setter
+@ToString
+@RequiredArgsConstructor
+public class Delivery {
+    @Id
+    Long ID_delivery;
+    String delivery_status;
+    String delivery_address;
+    @ManyToOne
+    @JoinColumn(name = "id_user")
+    Deliveryman deliveryman;
+    @JoinColumn(name = "id_order")
+    @OneToOne
+    Order order;
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
+        Delivery delivery = (Delivery) o;
+        return ID_delivery != null && Objects.equals(ID_delivery, delivery.ID_delivery);
+    }
+
+    @Override
+    public int hashCode() {
+        return getClass().hashCode();
+    }
+}
Index: src/main/java/com/example/autopartz/model/Deliveryman.java
===================================================================
--- src/main/java/com/example/autopartz/model/Deliveryman.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
+++ src/main/java/com/example/autopartz/model/Deliveryman.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
@@ -0,0 +1,32 @@
+package com.example.autopartz.model;
+
+import jakarta.persistence.Entity;
+import jakarta.persistence.Table;
+import lombok.*;
+import org.hibernate.Hibernate;
+
+import java.time.LocalDate;
+import java.util.Objects;
+
+@Getter
+@Setter
+@ToString
+@RequiredArgsConstructor
+@Entity
+@Table(name = "delivery_man")
+public class Deliveryman extends User{
+    LocalDate employed_from;
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
+        Deliveryman that = (Deliveryman) o;
+        return ID_user != null && Objects.equals(ID_user, that.ID_user);
+    }
+
+    @Override
+    public int hashCode() {
+        return getClass().hashCode();
+    }
+}
Index: src/main/java/com/example/autopartz/model/Order.java
===================================================================
--- src/main/java/com/example/autopartz/model/Order.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
+++ src/main/java/com/example/autopartz/model/Order.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
@@ -0,0 +1,37 @@
+package com.example.autopartz.model;
+
+import jakarta.persistence.*;
+import lombok.*;
+import org.hibernate.Hibernate;
+
+import java.time.LocalDateTime;
+import java.util.Objects;
+
+@Entity
+@Getter
+@Setter
+@ToString
+@RequiredArgsConstructor
+@Table(name = "order_table")
+public class Order {
+    @Id
+    Long ID_order;
+    String order_status;
+    LocalDateTime order_date;
+    @JoinColumn(name = "id_user")
+    @ManyToOne
+    Client user;
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
+        Order order = (Order) o;
+        return ID_order != null && Objects.equals(ID_order, order.ID_order);
+    }
+
+    @Override
+    public int hashCode() {
+        return getClass().hashCode();
+    }
+}
Index: src/main/java/com/example/autopartz/model/Part.java
===================================================================
--- src/main/java/com/example/autopartz/model/Part.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
+++ src/main/java/com/example/autopartz/model/Part.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
@@ -0,0 +1,38 @@
+package com.example.autopartz.model;
+
+import jakarta.persistence.Entity;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import lombok.*;
+import org.hibernate.Hibernate;
+
+import java.util.Objects;
+
+@Getter
+@Setter
+@ToString
+@RequiredArgsConstructor
+@Entity
+public class Part {
+    @Id
+    Long ID_part;
+    String part_name;
+    String part_description;
+    @ManyToOne
+    @JoinColumn(name = "id_part_manufacturer")
+    PartManufacturer partManufacturer;
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
+        Part part = (Part) o;
+        return ID_part != null && Objects.equals(ID_part, part.ID_part);
+    }
+
+    @Override
+    public int hashCode() {
+        return getClass().hashCode();
+    }
+}
Index: src/main/java/com/example/autopartz/model/PartManufacturer.java
===================================================================
--- src/main/java/com/example/autopartz/model/PartManufacturer.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
+++ src/main/java/com/example/autopartz/model/PartManufacturer.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
@@ -0,0 +1,35 @@
+package com.example.autopartz.model;
+
+import jakarta.persistence.Entity;
+import jakarta.persistence.Id;
+import jakarta.persistence.Table;
+import lombok.*;
+import org.hibernate.Hibernate;
+
+import java.util.Objects;
+
+@Getter
+@Setter
+@ToString
+@RequiredArgsConstructor
+@Entity
+@Table(name = "part_manufacturer")
+public class PartManufacturer {
+    @Id
+    Long ID_part_manufacturer;
+    String pm_name;
+    String pm_location;
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
+        PartManufacturer that = (PartManufacturer) o;
+        return ID_part_manufacturer != null && Objects.equals(ID_part_manufacturer, that.ID_part_manufacturer);
+    }
+
+    @Override
+    public int hashCode() {
+        return getClass().hashCode();
+    }
+}
Index: src/main/java/com/example/autopartz/model/Price.java
===================================================================
--- src/main/java/com/example/autopartz/model/Price.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
+++ src/main/java/com/example/autopartz/model/Price.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
@@ -0,0 +1,40 @@
+package com.example.autopartz.model;
+
+import jakarta.persistence.Entity;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import lombok.*;
+import org.hibernate.Hibernate;
+
+import java.time.LocalDate;
+import java.util.Objects;
+
+@Entity
+@Getter
+@Setter
+@ToString
+@RequiredArgsConstructor
+public class Price {
+    @Id
+    Long ID_price;
+    Integer amount;
+    LocalDate price_from;
+    LocalDate price_till;
+    @ManyToOne
+    @JoinColumn(name = "id_part")
+    Part part;
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
+        Price price = (Price) o;
+        return ID_price != null && Objects.equals(ID_price, price.ID_price);
+    }
+
+    @Override
+    public int hashCode() {
+        return getClass().hashCode();
+    }
+}
Index: src/main/java/com/example/autopartz/model/Repair.java
===================================================================
--- src/main/java/com/example/autopartz/model/Repair.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
+++ src/main/java/com/example/autopartz/model/Repair.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
@@ -0,0 +1,42 @@
+package com.example.autopartz.model;
+
+import jakarta.persistence.Entity;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import lombok.*;
+import org.hibernate.Hibernate;
+
+import java.util.Objects;
+
+@Getter
+@Setter
+@ToString
+@RequiredArgsConstructor
+@Entity
+public class Repair {
+    @Id
+    Long ID_repair;
+    @ManyToOne
+    @JoinColumn(name = "vin")
+    CarSample carSample;
+    @ManyToOne
+    @JoinColumn(name = "id_repair_shop")
+    RepairShop repairShop;
+    @ManyToOne
+    @JoinColumn(name = "id_service_book")
+    ServiceBook serviceBook;
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
+        Repair repair = (Repair) o;
+        return ID_repair != null && Objects.equals(ID_repair, repair.ID_repair);
+    }
+
+    @Override
+    public int hashCode() {
+        return getClass().hashCode();
+    }
+}
Index: src/main/java/com/example/autopartz/model/RepairShop.java
===================================================================
--- src/main/java/com/example/autopartz/model/RepairShop.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
+++ src/main/java/com/example/autopartz/model/RepairShop.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
@@ -0,0 +1,36 @@
+package com.example.autopartz.model;
+
+import jakarta.persistence.Entity;
+import jakarta.persistence.Id;
+import jakarta.persistence.Table;
+import lombok.*;
+import org.hibernate.Hibernate;
+
+import java.util.Objects;
+
+@Getter
+@Setter
+@ToString
+@RequiredArgsConstructor
+@Entity
+@Table(name = "repair_shop")
+public class RepairShop {
+    @Id
+    Long ID_repair_shop;
+    String rs_name;
+    String rs_location;
+    String rs_phone_number;
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
+        RepairShop that = (RepairShop) o;
+        return ID_repair_shop != null && Objects.equals(ID_repair_shop, that.ID_repair_shop);
+    }
+
+    @Override
+    public int hashCode() {
+        return getClass().hashCode();
+    }
+}
Index: src/main/java/com/example/autopartz/model/RepairShopReviewsSummary.java
===================================================================
--- src/main/java/com/example/autopartz/model/RepairShopReviewsSummary.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
+++ src/main/java/com/example/autopartz/model/RepairShopReviewsSummary.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
@@ -0,0 +1,45 @@
+package com.example.autopartz.model;
+
+import jakarta.persistence.Entity;
+import jakarta.persistence.Id;
+import jakarta.persistence.Table;
+import lombok.*;
+import org.hibernate.Hibernate;
+import org.hibernate.annotations.Immutable;
+import org.hibernate.annotations.Subselect;
+
+import java.io.Serial;
+import java.io.Serializable;
+import java.util.Objects;
+
+// извештај за сите сервиси и за сите број на reviews и avg рејтинг
+@Entity
+@Getter
+@Setter
+@ToString
+@RequiredArgsConstructor
+@Immutable
+@Table(name = "repair_shop_reviews_summary")
+@Subselect("select * from repair_shop_reviews_summary")
+public class RepairShopReviewsSummary implements Serializable {
+    @Serial
+    private static final long serialVersionUID = 1L;
+    @Id
+    Long rsid;
+    String rsname;
+    Integer reviewcount;
+    Float reviewaverage;
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
+        RepairShopReviewsSummary that = (RepairShopReviewsSummary) o;
+        return rsid != null && Objects.equals(rsid, that.rsid);
+    }
+
+    @Override
+    public int hashCode() {
+        return getClass().hashCode();
+    }
+}
Index: src/main/java/com/example/autopartz/model/Review.java
===================================================================
--- src/main/java/com/example/autopartz/model/Review.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
+++ src/main/java/com/example/autopartz/model/Review.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
@@ -0,0 +1,41 @@
+package com.example.autopartz.model;
+
+import jakarta.persistence.Entity;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import lombok.*;
+import org.hibernate.Hibernate;
+
+import java.util.Objects;
+
+@Getter
+@Setter
+@ToString
+@RequiredArgsConstructor
+@Entity
+public class Review {
+    @Id
+    Long ID_review;
+    Integer review_rating;
+    String review_comment;
+    @ManyToOne
+    @JoinColumn(name = "id_repair")
+    Repair repair;
+    @ManyToOne
+    @JoinColumn(name = "id_user")
+    Client client;
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
+        Review review = (Review) o;
+        return ID_review != null && Objects.equals(ID_review, review.ID_review);
+    }
+
+    @Override
+    public int hashCode() {
+        return getClass().hashCode();
+    }
+}
Index: src/main/java/com/example/autopartz/model/ServiceBook.java
===================================================================
--- src/main/java/com/example/autopartz/model/ServiceBook.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
+++ src/main/java/com/example/autopartz/model/ServiceBook.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
@@ -0,0 +1,36 @@
+package com.example.autopartz.model;
+
+import jakarta.persistence.*;
+import lombok.*;
+import org.hibernate.Hibernate;
+
+import java.time.LocalDateTime;
+import java.util.Objects;
+
+@Getter
+@Setter
+@ToString
+@RequiredArgsConstructor
+@Entity
+@Table(name = "service_book")
+public class ServiceBook {
+    @Id
+    Long ID_service_book;
+    LocalDateTime sb_created_on;
+    @OneToOne
+    @JoinColumn(name = "vin")
+    CarSample carSample;
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
+        ServiceBook that = (ServiceBook) o;
+        return ID_service_book != null && Objects.equals(ID_service_book, that.ID_service_book);
+    }
+
+    @Override
+    public int hashCode() {
+        return getClass().hashCode();
+    }
+}
Index: src/main/java/com/example/autopartz/model/User.java
===================================================================
--- src/main/java/com/example/autopartz/model/User.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
+++ src/main/java/com/example/autopartz/model/User.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
@@ -0,0 +1,42 @@
+package com.example.autopartz.model;
+
+import jakarta.persistence.*;
+import lombok.*;
+import org.hibernate.Hibernate;
+
+import java.time.LocalDateTime;
+import java.util.Objects;
+
+@Getter
+@Setter
+@ToString
+@RequiredArgsConstructor
+@Entity
+@Table(name = "users_table")
+@Inheritance(strategy = InheritanceType.JOINED)
+public class User {
+    @Id
+    Long ID_user;
+    String username;
+    String email;
+    String name_user;
+    String password_user;
+    LocalDateTime user_created_on;
+    String phone_number;
+    @ManyToOne
+    @JoinColumn(name = "id_administrator")
+    Administrator administrator;
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
+        User user = (User) o;
+        return ID_user != null && Objects.equals(ID_user, user.ID_user);
+    }
+
+    @Override
+    public int hashCode() {
+        return getClass().hashCode();
+    }
+}
Index: src/main/java/com/example/autopartz/model/Warehouse.java
===================================================================
--- src/main/java/com/example/autopartz/model/Warehouse.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
+++ src/main/java/com/example/autopartz/model/Warehouse.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
@@ -0,0 +1,32 @@
+package com.example.autopartz.model;
+
+import jakarta.persistence.Entity;
+import jakarta.persistence.Id;
+import lombok.*;
+import org.hibernate.Hibernate;
+
+import java.util.Objects;
+
+@Getter
+@Setter
+@ToString
+@RequiredArgsConstructor
+@Entity
+public class Warehouse {
+    @Id
+    Long ID_warehouse;
+    String warehouse_location;
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
+        Warehouse warehouse = (Warehouse) o;
+        return ID_warehouse != null && Objects.equals(ID_warehouse, warehouse.ID_warehouse);
+    }
+
+    @Override
+    public int hashCode() {
+        return getClass().hashCode();
+    }
+}
Index: src/main/java/com/example/autopartz/model/Warehouseman.java
===================================================================
--- src/main/java/com/example/autopartz/model/Warehouseman.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
+++ src/main/java/com/example/autopartz/model/Warehouseman.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
@@ -0,0 +1,35 @@
+package com.example.autopartz.model;
+
+import jakarta.persistence.Entity;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import lombok.*;
+import org.hibernate.Hibernate;
+
+import java.time.LocalDate;
+import java.util.Objects;
+
+@Getter
+@Setter
+@ToString
+@RequiredArgsConstructor
+@Entity
+public class Warehouseman extends User{
+    LocalDate employed_from;
+    @ManyToOne
+    @JoinColumn(name = "id_warehouse")
+    Warehouse warehouse;
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
+        Warehouseman that = (Warehouseman) o;
+        return ID_user != null && Objects.equals(ID_user, that.ID_user);
+    }
+
+    @Override
+    public int hashCode() {
+        return getClass().hashCode();
+    }
+}
Index: src/main/java/com/example/autopartz/repository/RepairShopReviewSummaryRepository.java
===================================================================
--- src/main/java/com/example/autopartz/repository/RepairShopReviewSummaryRepository.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
+++ src/main/java/com/example/autopartz/repository/RepairShopReviewSummaryRepository.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
@@ -0,0 +1,15 @@
+package com.example.autopartz.repository;
+
+import com.example.autopartz.model.RepairShopReviewsSummary;
+import jakarta.transaction.Transactional;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+// извештај за сите сервиси и за сите број на reviews и avg рејтинг
+@Repository
+@Transactional
+public interface RepairShopReviewSummaryRepository extends JpaRepository<RepairShopReviewsSummary,Long> {
+    List<RepairShopReviewsSummary> findAllByRsid(Long rsid);
+}
Index: src/main/java/com/example/autopartz/repository/UserRepository.java
===================================================================
--- src/main/java/com/example/autopartz/repository/UserRepository.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
+++ src/main/java/com/example/autopartz/repository/UserRepository.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
@@ -0,0 +1,12 @@
+package com.example.autopartz.repository;
+
+import com.example.autopartz.model.User;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+// import java.util.List;
+
+@Repository
+public interface UserRepository extends JpaRepository<User,Long> {
+    // List<User> findAllByUsername(String username);
+}
Index: src/main/java/com/example/autopartz/service/UserService.java
===================================================================
--- src/main/java/com/example/autopartz/service/UserService.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
+++ src/main/java/com/example/autopartz/service/UserService.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
@@ -0,0 +1,9 @@
+package com.example.autopartz.service;
+
+import com.example.autopartz.model.User;
+
+import java.util.List;
+
+public interface UserService {
+    List<User> findAllUsers();
+}
Index: src/main/java/com/example/autopartz/service/impl/UserServiceImpl.java
===================================================================
--- src/main/java/com/example/autopartz/service/impl/UserServiceImpl.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
+++ src/main/java/com/example/autopartz/service/impl/UserServiceImpl.java	(revision f094f6c409345b74661afd84bd147a6a076a8967)
@@ -0,0 +1,22 @@
+package com.example.autopartz.service.impl;
+
+import com.example.autopartz.model.User;
+import com.example.autopartz.repository.UserRepository;
+import com.example.autopartz.service.UserService;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class UserServiceImpl implements UserService {
+    private final UserRepository userRepository;
+
+    public UserServiceImpl(UserRepository userRepository) {
+        this.userRepository = userRepository;
+    }
+
+    @Override
+    public List<User> findAllUsers() {
+        return userRepository.findAll();
+    }
+}
Index: src/main/resources/application-prod.properties
===================================================================
--- src/main/resources/application-prod.properties	(revision f094f6c409345b74661afd84bd147a6a076a8967)
+++ src/main/resources/application-prod.properties	(revision f094f6c409345b74661afd84bd147a6a076a8967)
@@ -0,0 +1,16 @@
+## PostgreSQL
+spring.datasource.url=jdbc:postgresql://localhost:5444/db_202223z_va_prj_autopartzmk
+spring.datasource.username=db_202223z_va_prj_autopartzmk_owner
+spring.datasource.password=ce8a327b3b72
+
+
+## default connection pool
+spring.datasource.hikari.connectionTimeout=20000
+spring.datasource.hikari.maximumPoolSize=5
+
+spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQL95Dialect
+spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
+spring.jpa.properties.hibernate.default_schema=project
+
+spring.jpa.hibernate.ddl-auto=validate
+spring.jpa.show-sql=true
Index: src/main/resources/application.properties
===================================================================
--- src/main/resources/application.properties	(revision 75464a67ea2f22596aa294c59f56acaa4dfa19c1)
+++ src/main/resources/application.properties	(revision f094f6c409345b74661afd84bd147a6a076a8967)
@@ -1,1 +1,3 @@
-
+server.port=9999
+spring.profiles.active=prod
+spring.jpa.properties.hibernate.default_schema=project
