Index: src/main/java/com/example/autopartz/AutoPartzApplication.java
===================================================================
--- src/main/java/com/example/autopartz/AutoPartzApplication.java	(revision ab952abe294f21c5f425327ed185a0698e231ff4)
+++ src/main/java/com/example/autopartz/AutoPartzApplication.java	(revision 7d439571c01d0fa2a353ddb15d617c2037647352)
@@ -6,4 +6,5 @@
 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
 import org.springframework.security.crypto.password.PasswordEncoder;
+import org.thymeleaf.extras.springsecurity5.dialect.SpringSecurityDialect;
 
 @SpringBootApplication
@@ -17,5 +18,8 @@
         return new BCryptPasswordEncoder(10);
     }
-
+    @Bean
+    public SpringSecurityDialect securityDialect() {
+        return new SpringSecurityDialect();
+    }
 
 }
Index: src/main/java/com/example/autopartz/config/WebSecurityConfig.java
===================================================================
--- src/main/java/com/example/autopartz/config/WebSecurityConfig.java	(revision ab952abe294f21c5f425327ed185a0698e231ff4)
+++ src/main/java/com/example/autopartz/config/WebSecurityConfig.java	(revision 7d439571c01d0fa2a353ddb15d617c2037647352)
@@ -28,6 +28,6 @@
         http.csrf().disable()
                 .authorizeRequests()
-                .antMatchers("/", "/products", "/services", "/filtered", "/login", "/register").permitAll()
-                .antMatchers("/orders","/repairs","/reviews","/part/*").hasRole("CLIENT")
+                .antMatchers("/", "/products", "/services", "/filtered", "/login", "/register","/registerWarehouseman","/finishRegister","/test/*").permitAll()
+                .antMatchers("/orders","/repairs","/reviews","/part/*","/currentOrder").hasRole("CLIENT")
                 .anyRequest()
                 .authenticated()
Index: src/main/java/com/example/autopartz/controller/HomeController.java
===================================================================
--- src/main/java/com/example/autopartz/controller/HomeController.java	(revision ab952abe294f21c5f425327ed185a0698e231ff4)
+++ src/main/java/com/example/autopartz/controller/HomeController.java	(revision 7d439571c01d0fa2a353ddb15d617c2037647352)
@@ -1,11 +1,12 @@
 package com.example.autopartz.controller;
 
+import com.example.autopartz.model.Order;
 import com.example.autopartz.model.User;
+import com.example.autopartz.model.Warehouse;
+import com.example.autopartz.repository.OrderContainsPartRepository;
 import com.example.autopartz.repository.PartsForCarTypeAndCategoryRepository;
 import com.example.autopartz.repository.RepairShopReviewSummaryRepository;
-import com.example.autopartz.service.CarService;
-import com.example.autopartz.service.CategoryService;
-import com.example.autopartz.service.LoginService;
-import com.example.autopartz.service.PartService;
+import com.example.autopartz.repository.WarehouseRepository;
+import com.example.autopartz.service.*;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
@@ -16,4 +17,8 @@
 
 import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import java.io.IOException;
+import java.util.Objects;
 
 @Controller
@@ -26,6 +31,10 @@
     private final CategoryService categoryService;
     private final RepairShopReviewSummaryRepository repairShopReviewSummaryRepository;
+    private final WarehouseRepository warehouseRepository;
+    private final OrderContainsPartRepository orderContainsPartRepository;
+    private final OrderService orderService;
 
-    public HomeController(LoginService loginService, PartService partService, PartsForCarTypeAndCategoryRepository partsForCarTypeAndCategoryRepository, CarService carService, CategoryService categoryService, RepairShopReviewSummaryRepository repairShopReviewSummaryRepository) {
+    public HomeController(LoginService loginService, PartService partService, PartsForCarTypeAndCategoryRepository partsForCarTypeAndCategoryRepository, CarService carService, CategoryService categoryService, RepairShopReviewSummaryRepository repairShopReviewSummaryRepository, WarehouseRepository warehouseRepository,
+                          OrderContainsPartRepository orderContainsPartRepository, OrderService orderService) {
         this.loginService = loginService;
         this.partService = partService;
@@ -34,4 +43,7 @@
         this.categoryService = categoryService;
         this.repairShopReviewSummaryRepository = repairShopReviewSummaryRepository;
+        this.warehouseRepository = warehouseRepository;
+        this.orderContainsPartRepository = orderContainsPartRepository;
+        this.orderService = orderService;
     }
 
@@ -54,4 +66,19 @@
         model.addAttribute("services",repairShopReviewSummaryRepository.findAll());
         model.addAttribute("bodyContent","services");
+        return "master-template";
+    }
+    @GetMapping("/currentOrder")
+    public String getCurrentOrder(Model model,HttpSession session){
+        if(session.getAttribute("order")==null){
+            model.addAttribute("hasError",true);
+            model.addAttribute("error","Нарачката е празна");
+        }
+        else {
+            Order o = (Order) session.getAttribute("order");
+            model.addAttribute("hasError",false);
+            model.addAttribute("order",o);
+            model.addAttribute("parts",orderService.findById(o.getID_order()).getPartList());
+        }
+        model.addAttribute("bodyContent","currentOrder");
         return "master-template";
     }
@@ -79,7 +106,51 @@
     @PostMapping("/register")
     public void handleRegister(@RequestParam String username, @RequestParam String name,
-                               @RequestParam String password, @RequestParam String email,
-                               @RequestParam String number){
-        User u = loginService.register(name,username,email,number,password);
+                               @RequestParam String password, @RequestParam String rpassword,
+                               @RequestParam String email, @RequestParam String number,
+                               @RequestParam String role, HttpServletResponse response, HttpSession session){
+        System.out.println(username + name + password + rpassword + email + number + role);
+        if(Objects.equals(role, "warehouseman")){
+            session.setAttribute("username", username);
+            session.setAttribute("name", name);
+            session.setAttribute("password", password);
+            session.setAttribute("rpassword", rpassword);
+            session.setAttribute("email", email);
+            session.setAttribute("number", number);
+            try {
+                response.sendRedirect("/registerWarehouseman");
+            } catch (IOException e) {
+                throw new RuntimeException(e);
+            }
+        }
+        else {
+            loginService.register(name, username, email, number, password, role);
+            try {
+                response.sendRedirect("/login");
+            } catch (IOException e) {
+                throw new RuntimeException(e);
+            }
+        }
+    }
+    @GetMapping("/registerWarehouseman")
+    public String getSelectPage(Model model){
+        model.addAttribute("locations",warehouseRepository.findAll());
+        model.addAttribute("bodyContent","selectWarehouse");
+        return "master-template";
+    }
+    @PostMapping("/finishRegister")
+    public void handleWarehousemanRegister(@RequestParam String location,Model model, HttpServletResponse response, HttpSession session){
+        System.out.println("here?");
+        String username = (String) session.getAttribute("username");
+        String name = (String) session.getAttribute("name");
+        String password = (String) session.getAttribute("password");
+        String email = (String) session.getAttribute("email");
+        String number = (String) session.getAttribute("number");
+        Warehouse warehouse = warehouseRepository.findAllByLocation(location).stream().findFirst().orElseThrow(RuntimeException::new);
+        loginService.registerWarehouseman(name,username,email,number,password,"warehouseman",warehouse);
+        try {
+            response.sendRedirect("/login");
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
     }
 }
Index: src/main/java/com/example/autopartz/controller/PartController.java
===================================================================
--- src/main/java/com/example/autopartz/controller/PartController.java	(revision ab952abe294f21c5f425327ed185a0698e231ff4)
+++ src/main/java/com/example/autopartz/controller/PartController.java	(revision 7d439571c01d0fa2a353ddb15d617c2037647352)
@@ -1,13 +1,18 @@
 package com.example.autopartz.controller;
 
+import com.example.autopartz.model.Client;
+import com.example.autopartz.model.Order;
 import com.example.autopartz.model.Part;
-import com.example.autopartz.service.PartService;
-import com.example.autopartz.service.PriceService;
-import com.example.autopartz.service.RepairShopService;
+import com.example.autopartz.model.User;
+import com.example.autopartz.model.manytomany.OrderContainsPart;
+import com.example.autopartz.repository.OrderContainsPartRepository;
+import com.example.autopartz.service.*;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
 import java.io.IOException;
 
@@ -18,8 +23,14 @@
     private final RepairShopService repairShopService;
     private final PriceService priceService;
-    public PartController(PartService partService, RepairShopService repairShopService, PriceService priceService) {
+    private final OrderService orderService;
+    private final UserService userService;
+    private final OrderContainsPartRepository orderContainsPartRepository;
+    public PartController(PartService partService, RepairShopService repairShopService, PriceService priceService, OrderService orderService, UserService userService, OrderContainsPartRepository orderContainsPartRepository) {
         this.partService = partService;
         this.repairShopService = repairShopService;
         this.priceService = priceService;
+        this.orderService = orderService;
+        this.userService = userService;
+        this.orderContainsPartRepository = orderContainsPartRepository;
     }
     @GetMapping("/{id}")
@@ -32,8 +43,7 @@
         return "master-template";
     }
-    @GetMapping("/delivery/{id}")
-    public String getDeliveryPage(@PathVariable Integer id, Model model){
+    @GetMapping("/delivery")
+    public String getDeliveryPage(Model model){
         model.addAttribute("repairShops",repairShopService.findAll());
-        model.addAttribute("partId",id);
         model.addAttribute("bodyContent","deliveryForPart");
         return "master-template";
@@ -57,3 +67,18 @@
         }
     }
+    @PostMapping("/addToOrder/{id}")
+    public void addToOrder(@PathVariable Integer id,@RequestParam Integer quantity, HttpSession session, HttpServletResponse response, HttpServletRequest request){
+        if(session.getAttribute("order")==null){
+            User u = userService.findByUsername(request.getRemoteUser());
+            Order newOrder = orderService.create((Client) u);
+            session.setAttribute("order",newOrder);
+        }
+        Order order = (Order) session.getAttribute("order");
+        orderContainsPartRepository.save(new OrderContainsPart(id,order.getID_order(),quantity));
+        try {
+            response.sendRedirect("/products");
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
 }
Index: src/main/java/com/example/autopartz/controller/TestController.java
===================================================================
--- src/main/java/com/example/autopartz/controller/TestController.java	(revision 7d439571c01d0fa2a353ddb15d617c2037647352)
+++ src/main/java/com/example/autopartz/controller/TestController.java	(revision 7d439571c01d0fa2a353ddb15d617c2037647352)
@@ -0,0 +1,45 @@
+package com.example.autopartz.controller;
+
+import com.example.autopartz.model.Client;
+import com.example.autopartz.model.Order;
+import com.example.autopartz.model.Part;
+import com.example.autopartz.model.User;
+import com.example.autopartz.model.manytomany.OrderContainsPart;
+import com.example.autopartz.repository.OrderContainsPartRepository;
+import com.example.autopartz.service.OrderService;
+import com.example.autopartz.service.PartService;
+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("/test")
+public class TestController {
+    private final OrderService orderService;
+    private final PartService partService;
+    private final OrderContainsPartRepository orderContainsPartRepository;
+    private final UserService userService;
+
+    public TestController(OrderService orderService, PartService partService, OrderContainsPartRepository orderContainsPartRepository, UserService userService) {
+        this.orderService = orderService;
+        this.partService = partService;
+        this.orderContainsPartRepository = orderContainsPartRepository;
+        this.userService = userService;
+    }
+
+    @GetMapping("/m")
+    public void getPartsInOrder(){
+
+        User u = userService.findByUsername("client13");
+        Order o = orderService.create((Client) u);
+        orderContainsPartRepository.save(new OrderContainsPart(5,o.getID_order(),2));
+        orderContainsPartRepository.save(new OrderContainsPart(7,o.getID_order(),1));
+    }
+    @GetMapping("/t")
+    public List<Part> getParts(){
+        return orderService.findById(24).getPartList();
+    }
+}
Index: src/main/java/com/example/autopartz/model/Client.java
===================================================================
--- src/main/java/com/example/autopartz/model/Client.java	(revision ab952abe294f21c5f425327ed185a0698e231ff4)
+++ src/main/java/com/example/autopartz/model/Client.java	(revision 7d439571c01d0fa2a353ddb15d617c2037647352)
@@ -19,4 +19,8 @@
 @Entity
 public class Client extends User{
+    public Client(String username, String name, String email, String password, String number) {
+        super(username, name, email, password, number);
+    }
+
     @Override
     public boolean equals(Object o) {
Index: src/main/java/com/example/autopartz/model/Deliveryman.java
===================================================================
--- src/main/java/com/example/autopartz/model/Deliveryman.java	(revision ab952abe294f21c5f425327ed185a0698e231ff4)
+++ src/main/java/com/example/autopartz/model/Deliveryman.java	(revision 7d439571c01d0fa2a353ddb15d617c2037647352)
@@ -23,4 +23,10 @@
 public class Deliveryman extends User{
     LocalDate employed_from;
+    public static final LocalDate defaultEmployedFrom = LocalDate.of(2020,1,1);
+
+    public Deliveryman(String username, String name, String email, String password, String number) {
+        super(username, name, email, password, number);
+        this.employed_from = defaultEmployedFrom;
+    }
 
     @Override
@@ -38,5 +44,8 @@
     @Override
     public Collection<? extends GrantedAuthority> getAuthorities() {
-        return Collections.singletonList(Role.ROLE_DELIVERYMAN);
+        if(Objects.equals(employed_from, defaultEmployedFrom))
+            return Collections.singletonList(Role.ROLE_PENDING_DELIVERYMAN);
+        else
+            return Collections.singletonList(Role.ROLE_DELIVERYMAN);
     }
 }
Index: src/main/java/com/example/autopartz/model/Order.java
===================================================================
--- src/main/java/com/example/autopartz/model/Order.java	(revision ab952abe294f21c5f425327ed185a0698e231ff4)
+++ src/main/java/com/example/autopartz/model/Order.java	(revision 7d439571c01d0fa2a353ddb15d617c2037647352)
@@ -20,4 +20,5 @@
 public class Order {
     @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
     Integer ID_order;
     String order_status;
@@ -32,4 +33,10 @@
     @ToString.Exclude
     List<Part> partList;
+
+    public Order(Client user) {
+        this.order_status = "created";
+        this.user = user;
+        this.order_date = LocalDateTime.now();
+    }
 
     @Override
Index: src/main/java/com/example/autopartz/model/Repair.java
===================================================================
--- src/main/java/com/example/autopartz/model/Repair.java	(revision ab952abe294f21c5f425327ed185a0698e231ff4)
+++ src/main/java/com/example/autopartz/model/Repair.java	(revision 7d439571c01d0fa2a353ddb15d617c2037647352)
@@ -7,8 +7,5 @@
 import org.hibernate.Hibernate;
 
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
+import javax.persistence.*;
 import java.util.Objects;
 
@@ -21,7 +18,7 @@
     @Id
     Integer ID_repair;
-    @ManyToOne
-    @JoinColumn(name = "vin")
-    CarSample carSample;
+    @OneToOne
+    @JoinColumn(name = "id_order")
+    Order order;
     @ManyToOne
     @JoinColumn(name = "id_repair_shop")
Index: src/main/java/com/example/autopartz/model/Role.java
===================================================================
--- src/main/java/com/example/autopartz/model/Role.java	(revision ab952abe294f21c5f425327ed185a0698e231ff4)
+++ src/main/java/com/example/autopartz/model/Role.java	(revision 7d439571c01d0fa2a353ddb15d617c2037647352)
@@ -6,5 +6,5 @@
 public enum Role implements GrantedAuthority {
 
-    ROLE_USER,ROLE_CLIENT, ROLE_ADMIN, ROLE_WAREHOUSEMAN, ROLE_DELIVERYMAN;
+    ROLE_USER,ROLE_CLIENT, ROLE_ADMIN, ROLE_WAREHOUSEMAN, ROLE_DELIVERYMAN, ROLE_PENDING_WAREHOUSEMAN,ROLE_PENDING_DELIVERYMAN;
 
     @Override
Index: src/main/java/com/example/autopartz/model/User.java
===================================================================
--- src/main/java/com/example/autopartz/model/User.java	(revision ab952abe294f21c5f425327ed185a0698e231ff4)
+++ src/main/java/com/example/autopartz/model/User.java	(revision 7d439571c01d0fa2a353ddb15d617c2037647352)
@@ -24,4 +24,5 @@
 public class User implements UserDetails {
     @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
     Integer ID_user;
     String username;
Index: src/main/java/com/example/autopartz/model/Warehouse.java
===================================================================
--- src/main/java/com/example/autopartz/model/Warehouse.java	(revision ab952abe294f21c5f425327ed185a0698e231ff4)
+++ src/main/java/com/example/autopartz/model/Warehouse.java	(revision 7d439571c01d0fa2a353ddb15d617c2037647352)
@@ -7,4 +7,5 @@
 import org.hibernate.Hibernate;
 
+import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.Id;
@@ -19,5 +20,6 @@
     @Id
     Integer ID_warehouse;
-    String warehouse_location;
+    @Column(name = "warehouse_location")
+    String location;
 
     @Override
Index: src/main/java/com/example/autopartz/model/Warehouseman.java
===================================================================
--- src/main/java/com/example/autopartz/model/Warehouseman.java	(revision ab952abe294f21c5f425327ed185a0698e231ff4)
+++ src/main/java/com/example/autopartz/model/Warehouseman.java	(revision 7d439571c01d0fa2a353ddb15d617c2037647352)
@@ -23,7 +23,14 @@
 public class Warehouseman extends User{
     LocalDate employed_from;
+    public static final LocalDate defaultEmployedFrom = LocalDate.of(2020,1,1);
     @ManyToOne
     @JoinColumn(name = "id_warehouse")
     Warehouse warehouse;
+
+    public Warehouseman(String username, String name, String email, String password, String number, Warehouse warehouse) {
+        super(username, name, email, password, number);
+        this.employed_from=defaultEmployedFrom;
+        this.warehouse= warehouse;
+    }
 
     @Override
@@ -41,5 +48,8 @@
     @Override
     public Collection<? extends GrantedAuthority> getAuthorities() {
-        return Collections.singletonList(Role.ROLE_WAREHOUSEMAN);
+        if(employed_from==defaultEmployedFrom)
+            return Collections.singletonList(Role.ROLE_PENDING_WAREHOUSEMAN);
+        else
+            return Collections.singletonList(Role.ROLE_WAREHOUSEMAN);
     }
 }
Index: src/main/java/com/example/autopartz/model/manytomany/OrderContainsPart.java
===================================================================
--- src/main/java/com/example/autopartz/model/manytomany/OrderContainsPart.java	(revision 7d439571c01d0fa2a353ddb15d617c2037647352)
+++ src/main/java/com/example/autopartz/model/manytomany/OrderContainsPart.java	(revision 7d439571c01d0fa2a353ddb15d617c2037647352)
@@ -0,0 +1,31 @@
+package com.example.autopartz.model.manytomany;
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
+
+import javax.persistence.*;
+
+@Entity
+@Getter
+@Setter
+@ToString
+@RequiredArgsConstructor
+@Table(name = "`order_contains_part`")
+@IdClass(OrderContainsPartId.class)
+public class OrderContainsPart {
+    @Id
+    @Column(name = "id_part")
+    Integer partid;
+    @Column(name = "id_order")
+    @Id
+    Integer orderid;
+    Integer quantity_order;
+
+    public OrderContainsPart(Integer partid, Integer orderid, Integer quantity_order) {
+        this.partid = partid;
+        this.orderid = orderid;
+        this.quantity_order = quantity_order;
+    }
+}
Index: src/main/java/com/example/autopartz/model/manytomany/OrderContainsPartId.java
===================================================================
--- src/main/java/com/example/autopartz/model/manytomany/OrderContainsPartId.java	(revision 7d439571c01d0fa2a353ddb15d617c2037647352)
+++ src/main/java/com/example/autopartz/model/manytomany/OrderContainsPartId.java	(revision 7d439571c01d0fa2a353ddb15d617c2037647352)
@@ -0,0 +1,12 @@
+package com.example.autopartz.model.manytomany;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class OrderContainsPartId implements Serializable {
+    Integer partid;
+    Integer orderid;
+}
+
Index: src/main/java/com/example/autopartz/model/views/RepairsForUser.java
===================================================================
--- src/main/java/com/example/autopartz/model/views/RepairsForUser.java	(revision ab952abe294f21c5f425327ed185a0698e231ff4)
+++ src/main/java/com/example/autopartz/model/views/RepairsForUser.java	(revision 7d439571c01d0fa2a353ddb15d617c2037647352)
@@ -33,5 +33,5 @@
     @Id
     String partname;
-    Integer vin;
+    Integer orderid;
     String rsname;
 }
Index: src/main/java/com/example/autopartz/repository/OrderContainsPartRepository.java
===================================================================
--- src/main/java/com/example/autopartz/repository/OrderContainsPartRepository.java	(revision 7d439571c01d0fa2a353ddb15d617c2037647352)
+++ src/main/java/com/example/autopartz/repository/OrderContainsPartRepository.java	(revision 7d439571c01d0fa2a353ddb15d617c2037647352)
@@ -0,0 +1,13 @@
+package com.example.autopartz.repository;
+
+import com.example.autopartz.model.manytomany.OrderContainsPart;
+import com.example.autopartz.model.manytomany.OrderContainsPartId;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface OrderContainsPartRepository extends JpaRepository<OrderContainsPart, OrderContainsPartId> {
+    List<OrderContainsPart> findAllByOrderid(Integer orderid);
+}
Index: src/main/java/com/example/autopartz/repository/OrderRepository.java
===================================================================
--- src/main/java/com/example/autopartz/repository/OrderRepository.java	(revision 7d439571c01d0fa2a353ddb15d617c2037647352)
+++ src/main/java/com/example/autopartz/repository/OrderRepository.java	(revision 7d439571c01d0fa2a353ddb15d617c2037647352)
@@ -0,0 +1,9 @@
+package com.example.autopartz.repository;
+
+import com.example.autopartz.model.Order;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface OrderRepository extends JpaRepository<Order,Integer> {
+}
Index: src/main/java/com/example/autopartz/repository/WarehouseRepository.java
===================================================================
--- src/main/java/com/example/autopartz/repository/WarehouseRepository.java	(revision 7d439571c01d0fa2a353ddb15d617c2037647352)
+++ src/main/java/com/example/autopartz/repository/WarehouseRepository.java	(revision 7d439571c01d0fa2a353ddb15d617c2037647352)
@@ -0,0 +1,10 @@
+package com.example.autopartz.repository;
+
+import com.example.autopartz.model.Warehouse;
+import org.springframework.data.jpa.repository.JpaRepository;
+
+import java.util.List;
+
+public interface WarehouseRepository extends JpaRepository<Warehouse,Integer> {
+    List<Warehouse> findAllByLocation(String location);
+}
Index: src/main/java/com/example/autopartz/service/LoginService.java
===================================================================
--- src/main/java/com/example/autopartz/service/LoginService.java	(revision ab952abe294f21c5f425327ed185a0698e231ff4)
+++ src/main/java/com/example/autopartz/service/LoginService.java	(revision 7d439571c01d0fa2a353ddb15d617c2037647352)
@@ -2,7 +2,9 @@
 
 import com.example.autopartz.model.User;
+import com.example.autopartz.model.Warehouse;
 
 public interface LoginService {
-    User register(String name, String username, String email, String number, String password);
+    void register(String name, String username, String email, String number, String password, String role);
     User login(String username, String password);
+    void registerWarehouseman(String name, String username, String email, String number, String password, String role, Warehouse warehouse);
 }
Index: src/main/java/com/example/autopartz/service/OrderService.java
===================================================================
--- src/main/java/com/example/autopartz/service/OrderService.java	(revision 7d439571c01d0fa2a353ddb15d617c2037647352)
+++ src/main/java/com/example/autopartz/service/OrderService.java	(revision 7d439571c01d0fa2a353ddb15d617c2037647352)
@@ -0,0 +1,13 @@
+package com.example.autopartz.service;
+
+import com.example.autopartz.model.Client;
+import com.example.autopartz.model.Order;
+
+import java.util.List;
+
+public interface OrderService {
+    List<Order> findAll();
+    Order create(Client user);
+    Order findById(Integer id);
+}
+
Index: src/main/java/com/example/autopartz/service/impl/LoginServiceImpl.java
===================================================================
--- src/main/java/com/example/autopartz/service/impl/LoginServiceImpl.java	(revision ab952abe294f21c5f425327ed185a0698e231ff4)
+++ src/main/java/com/example/autopartz/service/impl/LoginServiceImpl.java	(revision 7d439571c01d0fa2a353ddb15d617c2037647352)
@@ -1,8 +1,10 @@
 package com.example.autopartz.service.impl;
 
-import com.example.autopartz.model.User;
+import com.example.autopartz.model.*;
 import com.example.autopartz.repository.UserRepository;
 import com.example.autopartz.service.LoginService;
 import org.springframework.stereotype.Service;
+
+import java.util.Objects;
 
 @Service
@@ -15,6 +17,11 @@
 
     @Override
-    public User register(String name, String username, String email, String number, String password) {
-        return userRepository.save(new User(username,name,email,password,number));
+    public void register(String name, String username, String email, String number, String password, String role) {
+        if (Objects.equals(role, "client")) {
+            userRepository.save(new Client(username, name, email, password, number));
+        }
+        else {
+            userRepository.save(new Deliveryman(username, name, email, password, number));
+        }
     }
 
@@ -24,4 +31,10 @@
     }
 
+    @Override
+    public void registerWarehouseman(String name, String username, String email, String number, String password, String role, Warehouse warehouse) {
+        userRepository.save(new Warehouseman(username, name, email, password, number, warehouse));
+
+    }
+
 //    @Override
 //    public User findByUsername(String username) {
Index: src/main/java/com/example/autopartz/service/impl/OrderServiceImpl.java
===================================================================
--- src/main/java/com/example/autopartz/service/impl/OrderServiceImpl.java	(revision 7d439571c01d0fa2a353ddb15d617c2037647352)
+++ src/main/java/com/example/autopartz/service/impl/OrderServiceImpl.java	(revision 7d439571c01d0fa2a353ddb15d617c2037647352)
@@ -0,0 +1,32 @@
+package com.example.autopartz.service.impl;
+
+import com.example.autopartz.model.Client;
+import com.example.autopartz.model.Order;
+import com.example.autopartz.repository.OrderRepository;
+import com.example.autopartz.service.OrderService;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+@Service
+public class OrderServiceImpl implements OrderService {
+    private final OrderRepository orderRepository;
+
+    public OrderServiceImpl(OrderRepository orderRepository) {
+        this.orderRepository = orderRepository;
+    }
+
+    @Override
+    public List<Order> findAll() {
+        return orderRepository.findAll();
+    }
+
+    @Override
+    public Order create(Client user) {
+        return orderRepository.save(new Order(user));
+    }
+
+    @Override
+    public Order findById(Integer id) {
+        return orderRepository.findById(id).get();
+    }
+}
