Index: sources/app/src/main/java/parkup/configs/RegistrationController.java
===================================================================
--- sources/app/src/main/java/parkup/configs/RegistrationController.java	(revision ce6ad22249e902dea17e6ba473846ccebdd4330c)
+++ 	(revision )
@@ -1,23 +1,0 @@
-//package parkup.configs;
-//
-//import org.springframework.web.bind.annotation.*;
-//
-//@RestController
-//public class RegistrationController {
-//
-//    private final RegistrationService registrationService;
-//
-//    public RegistrationController(RegistrationService registrationService) {
-//        this.registrationService = registrationService;
-//    }
-//
-//    @PostMapping(path = "/registration")
-//    public String register(@RequestBody RegistrationRequest request) {
-//        return registrationService.register(request);
-//    }
-//
-//    @GetMapping(path = "/registration/confirm")
-//    public String confirm(@RequestParam("token") String token) {
-//        return registrationService.confirmToken(token);
-//    }
-//}
Index: sources/app/src/main/java/parkup/configs/RegistrationRequest.java
===================================================================
--- sources/app/src/main/java/parkup/configs/RegistrationRequest.java	(revision ce6ad22249e902dea17e6ba473846ccebdd4330c)
+++ sources/app/src/main/java/parkup/configs/RegistrationRequest.java	(revision f6bc52d991e03ece15d64dc62eaeb0f2aed0805b)
@@ -6,10 +6,12 @@
     private final String email;
     private final String password;
+    private final String mobile;
 
-    public RegistrationRequest(String firstName, String lastName, String email, String password) {
+    public RegistrationRequest(String firstName, String lastName, String email, String password, String mobile) {
         this.firstName = firstName;
         this.lastName = lastName;
         this.email = email;
         this.password = password;
+        this.mobile = mobile;
     }
 
@@ -30,3 +32,7 @@
     }
 
+    public String getMobile(){
+        return mobile;
+    }
+
 }
Index: sources/app/src/main/java/parkup/configs/RegistrationService.java
===================================================================
--- sources/app/src/main/java/parkup/configs/RegistrationService.java	(revision ce6ad22249e902dea17e6ba473846ccebdd4330c)
+++ 	(revision )
@@ -1,147 +1,0 @@
-package parkup.configs;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import parkup.configs.email.EmailSender;
-import parkup.configs.email.EmailValidator;
-import parkup.configs.token.ConfirmationToken;
-import parkup.configs.token.ConfirmationTokenService;
-import parkup.entities.Administrator;
-import parkup.services.AdministratorService;
-
-import javax.transaction.Transactional;
-import java.time.LocalDateTime;
-
-@Service
-public class RegistrationService {
-    private final AdministratorService administratorService;
-    private final EmailValidator emailValidator;
-    private final ConfirmationTokenService confirmationTokenService;
-    private final EmailSender emailSender;
-
-    @Autowired
-    public RegistrationService(AdministratorService administratorService, EmailValidator emailValidator,
-                               ConfirmationTokenService confirmationTokenService, EmailSender emailSender) {
-        this.administratorService = administratorService;
-        this.emailValidator = emailValidator;
-        this.confirmationTokenService = confirmationTokenService;
-        this.emailSender = emailSender;
-    }
-
-    public String register(RegistrationRequest request) {
-        boolean isValidEmail = emailValidator.
-                test(request.getEmail());
-
-        if (!isValidEmail) {
-            throw new IllegalStateException("email not valid");
-        }
-
-        String token = administratorService.signUpAdministrator(
-                new Administrator(
-                        request.getFirstName(),
-                        request.getLastName(),
-                        request.getEmail(),
-                        request.getPassword()
-                )
-        );
-
-        String link = "http://localhost:8080/administrator/registration/confirm?token=" + token;
-        emailSender.send(
-                request.getEmail(),
-                buildEmail(request.getFirstName(), link));
-
-        return token;
-    }
-
-    @Transactional
-    public String confirmToken(String token) {
-        ConfirmationToken confirmationToken = confirmationTokenService
-                .getToken(token)
-                .orElseThrow(() ->
-                        new IllegalStateException("token not found"));
-
-        if (confirmationToken.getConfirmedAt() != null) {
-            throw new IllegalStateException("email already confirmed");
-        }
-
-        LocalDateTime expiredAt = confirmationToken.getExpiresAt();
-
-        if (expiredAt.isBefore(LocalDateTime.now())) {
-            throw new IllegalStateException("token expired");
-        }
-
-        confirmationTokenService.setConfirmedAt(token);
-
-        administratorService.enableAdministrator(confirmationToken.getAdministrator().getEmail());
-        return "confirmed";
-    }
-
-    private String buildEmail(String name, String link) {
-        return "<div style=\"font-family:Helvetica,Arial,sans-serif;font-size:16px;margin:0;color:#0b0c0c\">\n" +
-                "\n" +
-                "<span style=\"display:none;font-size:1px;color:#fff;max-height:0\"></span>\n" +
-                "\n" +
-                "  <table role=\"presentation\" width=\"100%\" style=\"border-collapse:collapse;min-width:100%;width:100%!important\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n" +
-                "    <tbody><tr>\n" +
-                "      <td width=\"100%\" height=\"53\" bgcolor=\"#0b0c0c\">\n" +
-                "        \n" +
-                "        <table role=\"presentation\" width=\"100%\" style=\"border-collapse:collapse;max-width:580px\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"center\">\n" +
-                "          <tbody><tr>\n" +
-                "            <td width=\"70\" bgcolor=\"#0b0c0c\" valign=\"middle\">\n" +
-                "                <table role=\"presentation\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border-collapse:collapse\">\n" +
-                "                  <tbody><tr>\n" +
-                "                    <td style=\"padding-left:10px\">\n" +
-                "                  \n" +
-                "                    </td>\n" +
-                "                    <td style=\"font-size:28px;line-height:1.315789474;Margin-top:4px;padding-left:10px\">\n" +
-                "                      <span style=\"font-family:Helvetica,Arial,sans-serif;font-weight:700;color:#ffffff;text-decoration:none;vertical-align:top;display:inline-block\">Confirm your email</span>\n" +
-                "                    </td>\n" +
-                "                  </tr>\n" +
-                "                </tbody></table>\n" +
-                "              </a>\n" +
-                "            </td>\n" +
-                "          </tr>\n" +
-                "        </tbody></table>\n" +
-                "        \n" +
-                "      </td>\n" +
-                "    </tr>\n" +
-                "  </tbody></table>\n" +
-                "  <table role=\"presentation\" class=\"m_-6186904992287805515content\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border-collapse:collapse;max-width:580px;width:100%!important\" width=\"100%\">\n" +
-                "    <tbody><tr>\n" +
-                "      <td width=\"10\" height=\"10\" valign=\"middle\"></td>\n" +
-                "      <td>\n" +
-                "        \n" +
-                "                <table role=\"presentation\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border-collapse:collapse\">\n" +
-                "                  <tbody><tr>\n" +
-                "                    <td bgcolor=\"#1D70B8\" width=\"100%\" height=\"10\"></td>\n" +
-                "                  </tr>\n" +
-                "                </tbody></table>\n" +
-                "        \n" +
-                "      </td>\n" +
-                "      <td width=\"10\" valign=\"middle\" height=\"10\"></td>\n" +
-                "    </tr>\n" +
-                "  </tbody></table>\n" +
-                "\n" +
-                "\n" +
-                "\n" +
-                "  <table role=\"presentation\" class=\"m_-6186904992287805515content\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border-collapse:collapse;max-width:580px;width:100%!important\" width=\"100%\">\n" +
-                "    <tbody><tr>\n" +
-                "      <td height=\"30\"><br></td>\n" +
-                "    </tr>\n" +
-                "    <tr>\n" +
-                "      <td width=\"10\" valign=\"middle\"><br></td>\n" +
-                "      <td style=\"font-family:Helvetica,Arial,sans-serif;font-size:19px;line-height:1.315789474;max-width:560px\">\n" +
-                "        \n" +
-                "            <p style=\"Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c\">Hi " + name + ",</p><p style=\"Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c\"> Thank you for registering. Please click on the below link to activate your account: </p><blockquote style=\"Margin:0 0 20px 0;border-left:10px solid #b1b4b6;padding:15px 0 0.1px 15px;font-size:19px;line-height:25px\"><p style=\"Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c\"> <a href=\"" + link + "\">Activate Now</a> </p></blockquote>\n Link will expire in 15 minutes. <p>See you soon</p>" +
-                "        \n" +
-                "      </td>\n" +
-                "      <td width=\"10\" valign=\"middle\"><br></td>\n" +
-                "    </tr>\n" +
-                "    <tr>\n" +
-                "      <td height=\"30\"><br></td>\n" +
-                "    </tr>\n" +
-                "  </tbody></table><div class=\"yj6qo\"></div><div class=\"adL\">\n" +
-                "\n" +
-                "</div></div>";
-    }
-}
Index: sources/app/src/main/java/parkup/configs/RegistrationServiceRP.java
===================================================================
--- sources/app/src/main/java/parkup/configs/RegistrationServiceRP.java	(revision f6bc52d991e03ece15d64dc62eaeb0f2aed0805b)
+++ sources/app/src/main/java/parkup/configs/RegistrationServiceRP.java	(revision f6bc52d991e03ece15d64dc62eaeb0f2aed0805b)
@@ -0,0 +1,148 @@
+package parkup.configs;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import parkup.configs.email.EmailSender;
+import parkup.configs.email.EmailValidator;
+import parkup.configs.token.ConfirmationTokenRP;
+import parkup.configs.token.ConfirmationTokenService;
+import parkup.entities.RegistriranParkirac;
+import parkup.services.RegistriranParkiracService;
+
+import javax.transaction.Transactional;
+import java.time.LocalDateTime;
+
+@Service
+public class RegistrationServiceRP {
+    private final RegistriranParkiracService registriranParkiracService;
+    private final EmailValidator emailValidator;
+    private final ConfirmationTokenService confirmationTokenService;
+    private final EmailSender emailSender;
+
+    @Autowired
+    public RegistrationServiceRP(RegistriranParkiracService registriranParkiracService, EmailValidator emailValidator,
+                                 ConfirmationTokenService confirmationTokenService, EmailSender emailSender) {
+        this.registriranParkiracService = registriranParkiracService;
+        this.emailValidator = emailValidator;
+        this.confirmationTokenService = confirmationTokenService;
+        this.emailSender = emailSender;
+    }
+
+    public String register(RegistrationRequest request) {
+        boolean isValidEmail = emailValidator.
+                test(request.getEmail());
+
+        if (!isValidEmail) {
+            throw new IllegalStateException("email not valid");
+        }
+
+        String token = registriranParkiracService.signUpRegistriranParkirac(
+                new RegistriranParkirac(
+                        request.getFirstName(),
+                        request.getLastName(),
+                        request.getEmail(),
+                        request.getPassword(),
+                        request.getMobile()
+                )
+        );
+
+        String link = "http://localhost:8080/registriranParkirac/registration/confirm?token=" + token;
+        emailSender.send(
+                request.getEmail(),
+                buildEmail(request.getFirstName(), link));
+
+        return token;
+    }
+
+    @Transactional
+    public String confirmToken(String token) {
+        ConfirmationTokenRP confirmationTokenRP = confirmationTokenService
+                .getTokenRP(token)
+                .orElseThrow(() ->
+                        new IllegalStateException("token not found"));
+
+        if (confirmationTokenRP.getConfirmedAt() != null) {
+            throw new IllegalStateException("email already confirmed");
+        }
+
+        LocalDateTime expiredAt = confirmationTokenRP.getExpiresAt();
+
+        if (expiredAt.isBefore(LocalDateTime.now())) {
+            throw new IllegalStateException("token expired");
+        }
+
+        confirmationTokenService.setConfirmedAtRP(token);
+
+        registriranParkiracService.enableRegistriranParkirac(confirmationTokenRP.getRegistriranParkirac().getEmail());
+        return "confirmed";
+    }
+
+    private String buildEmail(String name, String link) {
+        return "<div style=\"font-family:Helvetica,Arial,sans-serif;font-size:16px;margin:0;color:#0b0c0c\">\n" +
+                "\n" +
+                "<span style=\"display:none;font-size:1px;color:#fff;max-height:0\"></span>\n" +
+                "\n" +
+                "  <table role=\"presentation\" width=\"100%\" style=\"border-collapse:collapse;min-width:100%;width:100%!important\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n" +
+                "    <tbody><tr>\n" +
+                "      <td width=\"100%\" height=\"53\" bgcolor=\"#0b0c0c\">\n" +
+                "        \n" +
+                "        <table role=\"presentation\" width=\"100%\" style=\"border-collapse:collapse;max-width:580px\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"center\">\n" +
+                "          <tbody><tr>\n" +
+                "            <td width=\"70\" bgcolor=\"#0b0c0c\" valign=\"middle\">\n" +
+                "                <table role=\"presentation\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border-collapse:collapse\">\n" +
+                "                  <tbody><tr>\n" +
+                "                    <td style=\"padding-left:10px\">\n" +
+                "                  \n" +
+                "                    </td>\n" +
+                "                    <td style=\"font-size:28px;line-height:1.315789474;Margin-top:4px;padding-left:10px\">\n" +
+                "                      <span style=\"font-family:Helvetica,Arial,sans-serif;font-weight:700;color:#ffffff;text-decoration:none;vertical-align:top;display:inline-block\">Confirm your email</span>\n" +
+                "                    </td>\n" +
+                "                  </tr>\n" +
+                "                </tbody></table>\n" +
+                "              </a>\n" +
+                "            </td>\n" +
+                "          </tr>\n" +
+                "        </tbody></table>\n" +
+                "        \n" +
+                "      </td>\n" +
+                "    </tr>\n" +
+                "  </tbody></table>\n" +
+                "  <table role=\"presentation\" class=\"m_-6186904992287805515content\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border-collapse:collapse;max-width:580px;width:100%!important\" width=\"100%\">\n" +
+                "    <tbody><tr>\n" +
+                "      <td width=\"10\" height=\"10\" valign=\"middle\"></td>\n" +
+                "      <td>\n" +
+                "        \n" +
+                "                <table role=\"presentation\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border-collapse:collapse\">\n" +
+                "                  <tbody><tr>\n" +
+                "                    <td bgcolor=\"#1D70B8\" width=\"100%\" height=\"10\"></td>\n" +
+                "                  </tr>\n" +
+                "                </tbody></table>\n" +
+                "        \n" +
+                "      </td>\n" +
+                "      <td width=\"10\" valign=\"middle\" height=\"10\"></td>\n" +
+                "    </tr>\n" +
+                "  </tbody></table>\n" +
+                "\n" +
+                "\n" +
+                "\n" +
+                "  <table role=\"presentation\" class=\"m_-6186904992287805515content\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border-collapse:collapse;max-width:580px;width:100%!important\" width=\"100%\">\n" +
+                "    <tbody><tr>\n" +
+                "      <td height=\"30\"><br></td>\n" +
+                "    </tr>\n" +
+                "    <tr>\n" +
+                "      <td width=\"10\" valign=\"middle\"><br></td>\n" +
+                "      <td style=\"font-family:Helvetica,Arial,sans-serif;font-size:19px;line-height:1.315789474;max-width:560px\">\n" +
+                "        \n" +
+                "            <p style=\"Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c\">Hi " + name + ",</p><p style=\"Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c\"> Thank you for registering. Please click on the below link to activate your account: </p><blockquote style=\"Margin:0 0 20px 0;border-left:10px solid #b1b4b6;padding:15px 0 0.1px 15px;font-size:19px;line-height:25px\"><p style=\"Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c\"> <a href=\"" + link + "\">Activate Now</a> </p></blockquote>\n Link will expire in 15 minutes. <p>See you soon</p>" +
+                "        \n" +
+                "      </td>\n" +
+                "      <td width=\"10\" valign=\"middle\"><br></td>\n" +
+                "    </tr>\n" +
+                "    <tr>\n" +
+                "      <td height=\"30\"><br></td>\n" +
+                "    </tr>\n" +
+                "  </tbody></table><div class=\"yj6qo\"></div><div class=\"adL\">\n" +
+                "\n" +
+                "</div></div>";
+    }
+}
Index: sources/app/src/main/java/parkup/configs/RegistrationServiceW.java
===================================================================
--- sources/app/src/main/java/parkup/configs/RegistrationServiceW.java	(revision f6bc52d991e03ece15d64dc62eaeb0f2aed0805b)
+++ sources/app/src/main/java/parkup/configs/RegistrationServiceW.java	(revision f6bc52d991e03ece15d64dc62eaeb0f2aed0805b)
@@ -0,0 +1,148 @@
+package parkup.configs;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import parkup.configs.email.EmailSender;
+import parkup.configs.email.EmailValidator;
+import parkup.configs.token.ConfirmationTokenW;
+import parkup.configs.token.ConfirmationTokenService;
+import parkup.entities.Vraboten;
+import parkup.services.VrabotenService;
+
+import javax.transaction.Transactional;
+import java.time.LocalDateTime;
+
+@Service
+public class RegistrationServiceW {
+    private final VrabotenService vrabotenService;
+    private final EmailValidator emailValidator;
+    private final ConfirmationTokenService confirmationTokenService;
+    private final EmailSender emailSender;
+
+    @Autowired
+    public RegistrationServiceW(VrabotenService vrabotenService, EmailValidator emailValidator,
+                                 ConfirmationTokenService confirmationTokenService, EmailSender emailSender) {
+        this.vrabotenService = vrabotenService;
+        this.emailValidator = emailValidator;
+        this.confirmationTokenService = confirmationTokenService;
+        this.emailSender = emailSender;
+    }
+
+    public String register(RegistrationRequest request) {
+        boolean isValidEmail = emailValidator.
+                test(request.getEmail());
+
+        if (!isValidEmail) {
+            throw new IllegalStateException("email not valid");
+        }
+
+        String token = vrabotenService.signUpVraboten(
+                new Vraboten(
+                        request.getFirstName(),
+                        request.getLastName(),
+                        request.getEmail(),
+                        request.getPassword(),
+                        request.getMobile()
+                )
+        );
+
+        String link = "http://localhost:8080/vraboten/registration/confirm?token=" + token;
+        emailSender.send(
+                request.getEmail(),
+                buildEmail(request.getFirstName(), link));
+
+        return token;
+    }
+
+    @Transactional
+    public String confirmToken(String token) {
+        ConfirmationTokenW confirmationTokenW = confirmationTokenService
+                .getTokenW(token)
+                .orElseThrow(() ->
+                        new IllegalStateException("token not found"));
+
+        if (confirmationTokenW.getConfirmedAt() != null) {
+            throw new IllegalStateException("email already confirmed");
+        }
+
+        LocalDateTime expiredAt = confirmationTokenW.getExpiresAt();
+
+        if (expiredAt.isBefore(LocalDateTime.now())) {
+            throw new IllegalStateException("token expired");
+        }
+
+        confirmationTokenService.setConfirmedAtW(token);
+
+        vrabotenService.enableVraboten(confirmationTokenW.getRegistriranParkirac().getEmail());
+        return "confirmed";
+    }
+
+    private String buildEmail(String name, String link) {
+        return "<div style=\"font-family:Helvetica,Arial,sans-serif;font-size:16px;margin:0;color:#0b0c0c\">\n" +
+                "\n" +
+                "<span style=\"display:none;font-size:1px;color:#fff;max-height:0\"></span>\n" +
+                "\n" +
+                "  <table role=\"presentation\" width=\"100%\" style=\"border-collapse:collapse;min-width:100%;width:100%!important\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n" +
+                "    <tbody><tr>\n" +
+                "      <td width=\"100%\" height=\"53\" bgcolor=\"#0b0c0c\">\n" +
+                "        \n" +
+                "        <table role=\"presentation\" width=\"100%\" style=\"border-collapse:collapse;max-width:580px\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"center\">\n" +
+                "          <tbody><tr>\n" +
+                "            <td width=\"70\" bgcolor=\"#0b0c0c\" valign=\"middle\">\n" +
+                "                <table role=\"presentation\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border-collapse:collapse\">\n" +
+                "                  <tbody><tr>\n" +
+                "                    <td style=\"padding-left:10px\">\n" +
+                "                  \n" +
+                "                    </td>\n" +
+                "                    <td style=\"font-size:28px;line-height:1.315789474;Margin-top:4px;padding-left:10px\">\n" +
+                "                      <span style=\"font-family:Helvetica,Arial,sans-serif;font-weight:700;color:#ffffff;text-decoration:none;vertical-align:top;display:inline-block\">Confirm your email</span>\n" +
+                "                    </td>\n" +
+                "                  </tr>\n" +
+                "                </tbody></table>\n" +
+                "              </a>\n" +
+                "            </td>\n" +
+                "          </tr>\n" +
+                "        </tbody></table>\n" +
+                "        \n" +
+                "      </td>\n" +
+                "    </tr>\n" +
+                "  </tbody></table>\n" +
+                "  <table role=\"presentation\" class=\"m_-6186904992287805515content\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border-collapse:collapse;max-width:580px;width:100%!important\" width=\"100%\">\n" +
+                "    <tbody><tr>\n" +
+                "      <td width=\"10\" height=\"10\" valign=\"middle\"></td>\n" +
+                "      <td>\n" +
+                "        \n" +
+                "                <table role=\"presentation\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border-collapse:collapse\">\n" +
+                "                  <tbody><tr>\n" +
+                "                    <td bgcolor=\"#1D70B8\" width=\"100%\" height=\"10\"></td>\n" +
+                "                  </tr>\n" +
+                "                </tbody></table>\n" +
+                "        \n" +
+                "      </td>\n" +
+                "      <td width=\"10\" valign=\"middle\" height=\"10\"></td>\n" +
+                "    </tr>\n" +
+                "  </tbody></table>\n" +
+                "\n" +
+                "\n" +
+                "\n" +
+                "  <table role=\"presentation\" class=\"m_-6186904992287805515content\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border-collapse:collapse;max-width:580px;width:100%!important\" width=\"100%\">\n" +
+                "    <tbody><tr>\n" +
+                "      <td height=\"30\"><br></td>\n" +
+                "    </tr>\n" +
+                "    <tr>\n" +
+                "      <td width=\"10\" valign=\"middle\"><br></td>\n" +
+                "      <td style=\"font-family:Helvetica,Arial,sans-serif;font-size:19px;line-height:1.315789474;max-width:560px\">\n" +
+                "        \n" +
+                "            <p style=\"Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c\">Hi " + name + ",</p><p style=\"Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c\"> Thank you for registering. Please click on the below link to activate your account: </p><blockquote style=\"Margin:0 0 20px 0;border-left:10px solid #b1b4b6;padding:15px 0 0.1px 15px;font-size:19px;line-height:25px\"><p style=\"Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c\"> <a href=\"" + link + "\">Activate Now</a> </p></blockquote>\n Link will expire in 15 minutes. <p>See you soon</p>" +
+                "        \n" +
+                "      </td>\n" +
+                "      <td width=\"10\" valign=\"middle\"><br></td>\n" +
+                "    </tr>\n" +
+                "    <tr>\n" +
+                "      <td height=\"30\"><br></td>\n" +
+                "    </tr>\n" +
+                "  </tbody></table><div class=\"yj6qo\"></div><div class=\"adL\">\n" +
+                "\n" +
+                "</div></div>";
+    }
+}
Index: sources/app/src/main/java/parkup/configs/WebSecurityConfig.java
===================================================================
--- sources/app/src/main/java/parkup/configs/WebSecurityConfig.java	(revision ce6ad22249e902dea17e6ba473846ccebdd4330c)
+++ sources/app/src/main/java/parkup/configs/WebSecurityConfig.java	(revision f6bc52d991e03ece15d64dc62eaeb0f2aed0805b)
@@ -9,41 +9,54 @@
 import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
-import parkup.services.AdministratorService;
+import parkup.services.RegistriranParkiracService;
+import parkup.services.VrabotenService;
 
+@EnableWebSecurity
 @Configuration
-@EnableWebSecurity
 public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
+        private final VrabotenService vrabotenService;
+        private final BCryptPasswordEncoder bCryptPasswordEncoder;
+        private final RegistriranParkiracService registriranParkiracService;
 
-    private final AdministratorService administratorService;
-    private final BCryptPasswordEncoder bCryptPasswordEncoder;
+        public WebSecurityConfig(VrabotenService vrabotenService, BCryptPasswordEncoder bCryptPasswordEncoder, RegistriranParkiracService registriranParkiracService) {
+            this.vrabotenService = vrabotenService;
+            this.bCryptPasswordEncoder = bCryptPasswordEncoder;
+            this.registriranParkiracService = registriranParkiracService;
+        }
 
-    public WebSecurityConfig(AdministratorService administratorService, BCryptPasswordEncoder bCryptPasswordEncoder) {
-        this.bCryptPasswordEncoder = bCryptPasswordEncoder;
-        this.administratorService = administratorService;
+        @Override
+        protected void configure(HttpSecurity http) throws Exception {
+            http
+                    .csrf().disable()
+                    .authorizeRequests()
+                        .antMatchers("/vraboten/registration/**")
+                        .permitAll()
+                        .antMatchers("/registriranParkirac/registration/**")
+                        .permitAll()
+                    .anyRequest()
+                    .authenticated().and().formLogin();
+        }
+
+        @Override
+        protected void configure(AuthenticationManagerBuilder auth) throws Exception {
+            auth.authenticationProvider(daoAuthenticationProviderW());
+            auth.authenticationProvider(daoAuthenticationProviderRP());
+        }
+
+        @Bean
+        public DaoAuthenticationProvider daoAuthenticationProviderW() {
+            DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
+            provider.setPasswordEncoder(bCryptPasswordEncoder);
+            provider.setUserDetailsService(vrabotenService);
+            return provider;
+        }
+
+        @Bean
+        public DaoAuthenticationProvider daoAuthenticationProviderRP(){
+            DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
+            provider.setPasswordEncoder(bCryptPasswordEncoder);
+            provider.setUserDetailsService(registriranParkiracService);
+            return provider;
+        }
+
     }
-
-    @Override
-    protected void configure(HttpSecurity http) throws Exception {
-        http
-                .csrf().disable()
-                .authorizeRequests()
-                    .antMatchers("/administrator/registration/**")
-                    .permitAll()
-                .anyRequest()
-                .authenticated().and()
-                .formLogin();
-    }
-
-    @Override
-    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
-        auth.authenticationProvider(daoAuthenticationProvider());
-    }
-
-    @Bean
-    public DaoAuthenticationProvider daoAuthenticationProvider(){
-        DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
-        provider.setPasswordEncoder(bCryptPasswordEncoder);
-        provider.setUserDetailsService(administratorService);
-        return provider;
-    }
-}
Index: sources/app/src/main/java/parkup/configs/token/ConfirmationToken.java
===================================================================
--- sources/app/src/main/java/parkup/configs/token/ConfirmationToken.java	(revision ce6ad22249e902dea17e6ba473846ccebdd4330c)
+++ 	(revision )
@@ -1,105 +1,0 @@
-package parkup.configs.token;
-
-import parkup.entities.Administrator;
-
-import javax.persistence.*;
-import java.time.LocalDateTime;
-
-@Entity
-public class ConfirmationToken {
-
-    @Id
-    @Column(name = "confirmation_token_id")
-    @SequenceGenerator(
-            name="confirmation_token_generator",
-            sequenceName = "confirmation_token_sequence",
-            allocationSize = 1,
-            initialValue = 900
-    )
-    @GeneratedValue(    //za postgres treba sequence da se namesti i ime na generator mi ga davamo kako od gore sto e
-            strategy = GenerationType.SEQUENCE,
-            generator = "confirmation_token_sequence_generator"
-    )
-    private int id;
-
-    @Column(nullable = false)
-    private String token;
-
-    @Column(nullable = false)
-    private LocalDateTime createdAt;
-
-    @Column(nullable = false)
-    private LocalDateTime expiresAt;
-
-    private LocalDateTime confirmedAt;
-
-    @ManyToOne
-    @JoinColumn(nullable = false, name = "administrator_id")
-    //many confirmation tokens to one administrator
-    private Administrator administrator;
-
-    public ConfirmationToken() {}
-
-    public ConfirmationToken(int id, String token, LocalDateTime createdAt, LocalDateTime expiresAt, Administrator administrator) {
-        this.id = id;
-        this.token = token;
-        this.createdAt = createdAt;
-        this.expiresAt = expiresAt;
-        this.administrator = administrator;
-    }
-
-    public ConfirmationToken(String token, LocalDateTime createdAt, LocalDateTime expiresAt, Administrator administrator) {
-        this.token = token;
-        this.createdAt = createdAt;
-        this.expiresAt = expiresAt;
-        this.administrator = administrator;
-    }
-
-    public int getId() {
-        return id;
-    }
-
-    public void setId(int id) {
-        this.id = id;
-    }
-
-    public String getToken() {
-        return token;
-    }
-
-    public void setToken(String token) {
-        this.token = token;
-    }
-
-    public LocalDateTime getCreatedAt() {
-        return createdAt;
-    }
-
-    public void setCreatedAt(LocalDateTime createdAt) {
-        this.createdAt = createdAt;
-    }
-
-    public LocalDateTime getExpiresAt() {
-        return expiresAt;
-    }
-
-    public void setExpiresAt(LocalDateTime expiresAt) {
-        this.expiresAt = expiresAt;
-    }
-
-    public LocalDateTime getConfirmedAt() {
-        return confirmedAt;
-    }
-
-    public void setConfirmedAt(LocalDateTime confirmedAt) {
-        this.confirmedAt = confirmedAt;
-    }
-
-    public Administrator getAdministrator() {
-        return administrator;
-    }
-
-    public void setAdministrator(Administrator administrator) {
-        this.administrator = administrator;
-    }
-}
Index: sources/app/src/main/java/parkup/configs/token/ConfirmationTokenRP.java
===================================================================
--- sources/app/src/main/java/parkup/configs/token/ConfirmationTokenRP.java	(revision f6bc52d991e03ece15d64dc62eaeb0f2aed0805b)
+++ sources/app/src/main/java/parkup/configs/token/ConfirmationTokenRP.java	(revision f6bc52d991e03ece15d64dc62eaeb0f2aed0805b)
@@ -0,0 +1,105 @@
+package parkup.configs.token;
+
+import parkup.entities.RegistriranParkirac;
+
+import javax.persistence.*;
+import java.time.LocalDateTime;
+
+@Entity
+public class ConfirmationTokenRP {
+
+    @Id
+    @Column(name = "confirmation_token_id")
+    @SequenceGenerator(
+            name="confirmation_token_sequence_generator_RP",
+            sequenceName = "confirmation_token_sequence_RP",
+            allocationSize = 1,
+            initialValue = 1100
+    )
+    @GeneratedValue(    //za postgres treba sequence da se namesti i ime na generator mi ga davamo kako od gore sto e
+            strategy = GenerationType.SEQUENCE,
+            generator = "confirmation_token_sequence_generator_RP"
+    )
+    private int id;
+
+    @Column(nullable = false)
+    private String token;
+
+    @Column(nullable = false)
+    private LocalDateTime createdAt;
+
+    @Column(nullable = false)
+    private LocalDateTime expiresAt;
+
+    private LocalDateTime confirmedAt;
+
+    @ManyToOne
+    @JoinColumn(nullable = false, name = "registriranParkirac_id")
+    //many confirmation tokens to one registriranParkirac
+    private RegistriranParkirac registriranParkirac;
+
+    public ConfirmationTokenRP() {}
+
+    public ConfirmationTokenRP(int id, String token, LocalDateTime createdAt, LocalDateTime expiresAt, RegistriranParkirac registriranParkirac) {
+        this.id = id;
+        this.token = token;
+        this.createdAt = createdAt;
+        this.expiresAt = expiresAt;
+        this.registriranParkirac = registriranParkirac;
+    }
+
+    public ConfirmationTokenRP(String token, LocalDateTime createdAt, LocalDateTime expiresAt, RegistriranParkirac registriranParkirac) {
+        this.token = token;
+        this.createdAt = createdAt;
+        this.expiresAt = expiresAt;
+        this.registriranParkirac = registriranParkirac;
+    }
+
+    public int getId() {
+        return id;
+    }
+
+    public void setId(int id) {
+        this.id = id;
+    }
+
+    public String getToken() {
+        return token;
+    }
+
+    public void setToken(String token) {
+        this.token = token;
+    }
+
+    public LocalDateTime getCreatedAt() {
+        return createdAt;
+    }
+
+    public void setCreatedAt(LocalDateTime createdAt) {
+        this.createdAt = createdAt;
+    }
+
+    public LocalDateTime getExpiresAt() {
+        return expiresAt;
+    }
+
+    public void setExpiresAt(LocalDateTime expiresAt) {
+        this.expiresAt = expiresAt;
+    }
+
+    public LocalDateTime getConfirmedAt() {
+        return confirmedAt;
+    }
+
+    public void setConfirmedAt(LocalDateTime confirmedAt) {
+        this.confirmedAt = confirmedAt;
+    }
+
+    public RegistriranParkirac getRegistriranParkirac() {
+        return registriranParkirac;
+    }
+
+    public void setRegistriranParkirac(RegistriranParkirac registriranParkirac) {
+        this.registriranParkirac = registriranParkirac;
+    }
+}
Index: sources/app/src/main/java/parkup/configs/token/ConfirmationTokenRepository.java
===================================================================
--- sources/app/src/main/java/parkup/configs/token/ConfirmationTokenRepository.java	(revision ce6ad22249e902dea17e6ba473846ccebdd4330c)
+++ 	(revision )
@@ -1,23 +1,0 @@
-package parkup.configs.token;
-
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.Modifying;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.stereotype.Repository;
-
-import javax.transaction.Transactional;
-import java.time.LocalDateTime;
-import java.util.Optional;
-
-@Repository
-public interface ConfirmationTokenRepository extends JpaRepository<ConfirmationToken,Integer> {
-
-    Optional<ConfirmationToken> findByToken(String token);
-
-    @Transactional
-    @Modifying
-    @Query("UPDATE ConfirmationToken c " +
-            "SET c.confirmedAt = ?2 " +
-            "WHERE c.token = ?1")
-    int updateConfirmedAt(String token, LocalDateTime confirmedAt);
-}
Index: sources/app/src/main/java/parkup/configs/token/ConfirmationTokenRepositoryRP.java
===================================================================
--- sources/app/src/main/java/parkup/configs/token/ConfirmationTokenRepositoryRP.java	(revision f6bc52d991e03ece15d64dc62eaeb0f2aed0805b)
+++ sources/app/src/main/java/parkup/configs/token/ConfirmationTokenRepositoryRP.java	(revision f6bc52d991e03ece15d64dc62eaeb0f2aed0805b)
@@ -0,0 +1,25 @@
+package parkup.configs.token;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+
+import javax.transaction.Transactional;
+import java.time.LocalDateTime;
+import java.util.Optional;
+
+@Repository
+public interface ConfirmationTokenRepositoryRP extends JpaRepository<ConfirmationTokenRP,Integer> {
+
+    Optional<ConfirmationTokenRP> findByToken(String token);
+
+    void deleteByRegistriranParkirac_RegParkId(int regParkId);
+
+    @Transactional
+    @Modifying
+    @Query("UPDATE ConfirmationTokenRP c " +
+            "SET c.confirmedAt = ?2 " +
+            "WHERE c.token = ?1")
+    int updateConfirmedAt(String token, LocalDateTime confirmedAt);
+}
Index: sources/app/src/main/java/parkup/configs/token/ConfirmationTokenRepositoryW.java
===================================================================
--- sources/app/src/main/java/parkup/configs/token/ConfirmationTokenRepositoryW.java	(revision f6bc52d991e03ece15d64dc62eaeb0f2aed0805b)
+++ sources/app/src/main/java/parkup/configs/token/ConfirmationTokenRepositoryW.java	(revision f6bc52d991e03ece15d64dc62eaeb0f2aed0805b)
@@ -0,0 +1,25 @@
+package parkup.configs.token;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+
+import javax.transaction.Transactional;
+import java.time.LocalDateTime;
+import java.util.Optional;
+
+@Repository
+public interface ConfirmationTokenRepositoryW extends JpaRepository<ConfirmationTokenW,Integer> {
+
+    Optional<ConfirmationTokenW> findByToken(String token);
+
+    void deleteByVraboten_VrabotenId(int vraboten_id);
+
+    @Transactional
+    @Modifying
+    @Query("UPDATE ConfirmationTokenW c " +
+            "SET c.confirmedAt = ?2 " +
+            "WHERE c.token = ?1")
+    int updateConfirmedAt(String token, LocalDateTime confirmedAt);
+}
Index: sources/app/src/main/java/parkup/configs/token/ConfirmationTokenService.java
===================================================================
--- sources/app/src/main/java/parkup/configs/token/ConfirmationTokenService.java	(revision ce6ad22249e902dea17e6ba473846ccebdd4330c)
+++ sources/app/src/main/java/parkup/configs/token/ConfirmationTokenService.java	(revision f6bc52d991e03ece15d64dc62eaeb0f2aed0805b)
@@ -9,20 +9,39 @@
 public class ConfirmationTokenService {
 
-    private final ConfirmationTokenRepository confirmationTokenRepository;
+    private final ConfirmationTokenRepositoryRP confirmationTokenRepositoryRP;
+    private final ConfirmationTokenRepositoryW confirmationTokenRepositoryW;
 
-    public ConfirmationTokenService(ConfirmationTokenRepository confirmationTokenRepository) {
-        this.confirmationTokenRepository = confirmationTokenRepository;
+    public ConfirmationTokenService(ConfirmationTokenRepositoryRP confirmationTokenRepositoryRP, ConfirmationTokenRepositoryW confirmationTokenRepositoryW) {
+        this.confirmationTokenRepositoryRP = confirmationTokenRepositoryRP;
+        this.confirmationTokenRepositoryW = confirmationTokenRepositoryW;
     }
 
-    public void saveConfirmationToken(ConfirmationToken token){
-        confirmationTokenRepository.save(token);
+    public void saveConfirmationTokenRP(ConfirmationTokenRP token){
+        confirmationTokenRepositoryRP.save(token);
     }
 
-    public Optional<ConfirmationToken> getToken(String token) {
-        return confirmationTokenRepository.findByToken(token);
+    public void saveConfirmationTokenW(ConfirmationTokenW token){
+        confirmationTokenRepositoryW.save(token);}
+
+    public Optional<ConfirmationTokenRP> getTokenRP(String token) {
+        return confirmationTokenRepositoryRP.findByToken(token);
+    }
+    public Optional<ConfirmationTokenW> getTokenW(String token){
+        return confirmationTokenRepositoryW.findByToken(token);
     }
 
-    public int setConfirmedAt(String token) {
-        return confirmationTokenRepository.updateConfirmedAt(token, LocalDateTime.now());
+    public void deleteByVraboten_VrabotenId(int vraboten_id){
+        confirmationTokenRepositoryW.deleteByVraboten_VrabotenId(vraboten_id);
+    }
+
+    public void deleteByRegistriranParkirac_RegParkId(int regParkId){
+        confirmationTokenRepositoryRP.deleteByRegistriranParkirac_RegParkId(regParkId);
+    }
+
+    public int setConfirmedAtRP(String token) {
+        return confirmationTokenRepositoryRP.updateConfirmedAt(token, LocalDateTime.now());
+    }
+    public int setConfirmedAtW(String token){
+        return confirmationTokenRepositoryW.updateConfirmedAt(token,LocalDateTime.now());
     }
 }
Index: sources/app/src/main/java/parkup/configs/token/ConfirmationTokenW.java
===================================================================
--- sources/app/src/main/java/parkup/configs/token/ConfirmationTokenW.java	(revision f6bc52d991e03ece15d64dc62eaeb0f2aed0805b)
+++ sources/app/src/main/java/parkup/configs/token/ConfirmationTokenW.java	(revision f6bc52d991e03ece15d64dc62eaeb0f2aed0805b)
@@ -0,0 +1,105 @@
+package parkup.configs.token;
+
+import parkup.entities.Vraboten;
+
+import javax.persistence.*;
+import java.time.LocalDateTime;
+
+@Entity
+public class ConfirmationTokenW {
+
+    @Id
+    @Column(name = "confirmation_token_id")
+    @SequenceGenerator(
+            name="confirmation_token_sequence_generator_W",
+            sequenceName = "confirmation_token_sequence_W",
+            allocationSize = 1,
+            initialValue = 1200
+    )
+    @GeneratedValue(    //za postgres treba sequence da se namesti i ime na generator mi ga davamo kako od gore sto e
+            strategy = GenerationType.SEQUENCE,
+            generator = "confirmation_token_sequence_generator_W"
+    )
+    private int id;
+
+    @Column(nullable = false)
+    private String token;
+
+    @Column(nullable = false)
+    private LocalDateTime createdAt;
+
+    @Column(nullable = false)
+    private LocalDateTime expiresAt;
+
+    private LocalDateTime confirmedAt;
+
+    @ManyToOne(cascade = {CascadeType.ALL})
+    @JoinColumn(nullable = false, name = "vraboten_id")
+    //many confirmation tokens to one registriranParkirac
+    private Vraboten vraboten;
+
+    public ConfirmationTokenW() {}
+
+    public ConfirmationTokenW(int id, String token, LocalDateTime createdAt, LocalDateTime expiresAt, Vraboten vraboten) {
+        this.id = id;
+        this.token = token;
+        this.createdAt = createdAt;
+        this.expiresAt = expiresAt;
+        this.vraboten = vraboten;
+    }
+
+    public ConfirmationTokenW(String token, LocalDateTime createdAt, LocalDateTime expiresAt, Vraboten vraboten) {
+        this.token = token;
+        this.createdAt = createdAt;
+        this.expiresAt = expiresAt;
+        this.vraboten = vraboten;
+    }
+
+    public int getId() {
+        return id;
+    }
+
+    public void setId(int id) {
+        this.id = id;
+    }
+
+    public String getToken() {
+        return token;
+    }
+
+    public void setToken(String token) {
+        this.token = token;
+    }
+
+    public LocalDateTime getCreatedAt() {
+        return createdAt;
+    }
+
+    public void setCreatedAt(LocalDateTime createdAt) {
+        this.createdAt = createdAt;
+    }
+
+    public LocalDateTime getExpiresAt() {
+        return expiresAt;
+    }
+
+    public void setExpiresAt(LocalDateTime expiresAt) {
+        this.expiresAt = expiresAt;
+    }
+
+    public LocalDateTime getConfirmedAt() {
+        return confirmedAt;
+    }
+
+    public void setConfirmedAt(LocalDateTime confirmedAt) {
+        this.confirmedAt = confirmedAt;
+    }
+
+    public Vraboten getRegistriranParkirac() {
+        return vraboten;
+    }
+
+    public void setRegistriranParkirac(Vraboten vraboten) {
+        this.vraboten = vraboten;
+    }
+}
Index: sources/app/src/main/java/parkup/controllers/AdministratorController.java
===================================================================
--- sources/app/src/main/java/parkup/controllers/AdministratorController.java	(revision ce6ad22249e902dea17e6ba473846ccebdd4330c)
+++ sources/app/src/main/java/parkup/controllers/AdministratorController.java	(revision f6bc52d991e03ece15d64dc62eaeb0f2aed0805b)
@@ -2,8 +2,10 @@
 
 import java.util.List;
+import java.util.Optional;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import parkup.configs.RegistrationRequest;
-import parkup.configs.RegistrationService;
+import parkup.configs.RegistrationServiceRP;
 import parkup.entities.Administrator;
 import parkup.services.AdministratorService;
@@ -12,10 +14,10 @@
 public class AdministratorController {
     private final AdministratorService administratorService;
-    private final RegistrationService registrationService;
+    private final RegistrationServiceRP registrationServiceRP;
 
     @Autowired
-    public AdministratorController(AdministratorService administratorService, RegistrationService registrationService) {
+    public AdministratorController(AdministratorService administratorService, RegistrationServiceRP registrationServiceRP) {
         this.administratorService = administratorService;
-        this.registrationService = registrationService;
+        this.registrationServiceRP = registrationServiceRP;
     }
 
@@ -36,26 +38,26 @@
 
     @PostMapping({"/administrator"})
-    public void addAdministrator(@RequestBody Administrator administrator) {
-        this.administratorService.addAdministrator(administrator);
+    public Optional<Administrator> addAdministrator(@RequestBody Administrator administrator) {
+        return this.administratorService.addAdministrator(administrator);
     }
 
     @PutMapping({"/administrator/{administratorId}"})
-    public void updateAdministrator(@PathVariable int administratorId, @RequestBody Administrator administrator) {
-        this.administratorService.updateAdministrator(administratorId, administrator.getFirstName(), administrator.getLastName(), administrator.getMobile(), administrator.getEmail());
+    public Administrator updateAdministrator(@PathVariable int administratorId, @RequestBody Administrator administrator) {
+        return this.administratorService.updateAdministrator(administratorId, administrator.getFirstName(), administrator.getLastName(), administrator.getMobile(), administrator.getEmail());
     }
 
     @DeleteMapping({"/administrator/{administratorId}"})
-    public void deleteAdministrator(@PathVariable int administratorId) {
-        this.administratorService.deleteAdministrator(administratorId);
+    public Optional<Administrator> deleteAdministrator(@PathVariable int administratorId) {
+        return this.administratorService.deleteAdministrator(administratorId);
     }
 
     @PostMapping({"/administrator/registration"})
     public String register(@RequestBody RegistrationRequest request){
-        return registrationService.register(request);
+        return registrationServiceRP.register(request);
     }
 
     @GetMapping(path = "/administrator/registration/confirm")
     public String confirm(@RequestParam("token") String token) {
-        return registrationService.confirmToken(token);
+        return registrationServiceRP.confirmToken(token);
     }
 }
Index: sources/app/src/main/java/parkup/controllers/ParkingSessionController.java
===================================================================
--- sources/app/src/main/java/parkup/controllers/ParkingSessionController.java	(revision ce6ad22249e902dea17e6ba473846ccebdd4330c)
+++ sources/app/src/main/java/parkup/controllers/ParkingSessionController.java	(revision f6bc52d991e03ece15d64dc62eaeb0f2aed0805b)
@@ -7,4 +7,5 @@
 
 import java.util.List;
+import java.util.Optional;
 
 @RestController
@@ -33,17 +34,18 @@
 
     @PostMapping({"/parkingSession"})
-    public void addParkingSession(@RequestBody ParkingSession parkingSession) {
+    public Optional<ParkingSession> addParkingSession(@RequestBody ParkingSession parkingSession) {
         //System.out.println("???????");
-        parkingSessionService.addParkingSession(parkingSession);
+        return this.parkingSessionService.addParkingSession(parkingSession);
     }
 
     @PutMapping({"/parkingSession/{parkingSessionId}"})
     public void updateParkingSession(@PathVariable int parkingSessionId, @RequestBody ParkingSession parkingSession) {
-        parkingSessionService.updateParkingSession(parkingSessionId, parkingSession.getTimeStart(), parkingSession.getTimeEnd());
+        parkingSessionService.updateParkingSession(parkingSessionId,
+                parkingSession.getTimeStart(), parkingSession.getTimeEnd(), parkingSession.getTablica());
     }
 
     @DeleteMapping({"/parkingSession/{parkingSessionId}"})
-    public void deleteParkingSession(@PathVariable int parkingSessionId) {
-        parkingSessionService.deleteParkingSession(parkingSessionId);
+    public Optional<ParkingSession> deleteParkingSession(@PathVariable int parkingSessionId) {
+        return this.parkingSessionService.deleteParkingSession(parkingSessionId);
     }
 }
Index: sources/app/src/main/java/parkup/controllers/ParkingSpaceController.java
===================================================================
--- sources/app/src/main/java/parkup/controllers/ParkingSpaceController.java	(revision ce6ad22249e902dea17e6ba473846ccebdd4330c)
+++ sources/app/src/main/java/parkup/controllers/ParkingSpaceController.java	(revision f6bc52d991e03ece15d64dc62eaeb0f2aed0805b)
@@ -7,4 +7,5 @@
 
 import java.util.List;
+import java.util.Optional;
 
 @RestController
@@ -33,17 +34,18 @@
 
     @PostMapping({"/parkingSpace"})
-    public void addParkingSpace(@RequestBody ParkingSpace parkingSpace) {
+    public Optional<ParkingSpace> addParkingSpace(@RequestBody ParkingSpace parkingSpace) {
         //System.out.println("???????");
-        parkingSpaceService.addParkingSpace(parkingSpace);
+        return this.parkingSpaceService.addParkingSpace(parkingSpace);
     }
 
     @PutMapping({"/parkingSpace/{parkingSpaceId}"})
     public void updateParkingSpace(@PathVariable int parkingSpaceId, @RequestBody ParkingSpace parkingSpace) {
-        parkingSpaceService.updateParkingSpace(parkingSpaceId, parkingSpace.getPsName(), parkingSpace.isTaken(), parkingSpace.isHandicaped());
+        parkingSpaceService.updateParkingSpace(parkingSpaceId, parkingSpace.getPsName(), parkingSpace.isTaken(),
+                parkingSpace.isHandicaped(), parkingSpace.getLat(), parkingSpace.getLng());
     }
 
     @DeleteMapping({"/parkingSpace/{parkingSpaceId}"})
-    public void deleteParkingSpace(@PathVariable int parkingSpaceId) {
-        parkingSpaceService.deleteParkingSpace(parkingSpaceId);
+    public Optional<ParkingSpace> deleteParkingSpace(@PathVariable int parkingSpaceId) {
+        return this.parkingSpaceService.deleteParkingSpace(parkingSpaceId);
     }
 }
Index: sources/app/src/main/java/parkup/controllers/ParkingZoneController.java
===================================================================
--- sources/app/src/main/java/parkup/controllers/ParkingZoneController.java	(revision ce6ad22249e902dea17e6ba473846ccebdd4330c)
+++ sources/app/src/main/java/parkup/controllers/ParkingZoneController.java	(revision f6bc52d991e03ece15d64dc62eaeb0f2aed0805b)
@@ -7,4 +7,5 @@
 
 import java.util.List;
+import java.util.Optional;
 
 @RestController
@@ -32,18 +33,29 @@
     }
 
+    @GetMapping({"parkingZone/parkingZoneNames"})
+    public List<String> getParkingZoneNames(){
+        return this.parkingZoneService.getAllParkingZoneNames();
+    }
+
     @PostMapping({"/parkingZone"})
-    public void addParkingZone(@RequestBody ParkingZone parkingZone) {
-        //System.out.println("???????");
-        parkingZoneService.addParkingZone(parkingZone);
+    public Optional<ParkingZone> addParkingZone(@RequestBody ParkingZone parkingZone) {
+        return this.parkingZoneService.addParkingZone(parkingZone);
+    }
+
+    @PostMapping("/parkingZoneName")
+    public ParkingZone addParkingZoneName(@RequestBody String name){
+        return this.parkingZoneService.addParkingZoneNameOnly(name);
     }
 
     @PutMapping({"/parkingZone/{parkingZoneId}"})
-    public void updateParkingZone(@PathVariable int parkingZoneId, @RequestBody ParkingZone parkingZone) {
-        parkingZoneService.updateParkingZone(parkingZoneId, parkingZone.getPzName(), parkingZone.getPrice(), parkingZone.getCapacity(), parkingZone.getWorkHours(),parkingZone.getLocation());
+    public ParkingZone updateParkingZone(@PathVariable int parkingZoneId, @RequestBody ParkingZone parkingZone) {
+        return this.parkingZoneService.updateParkingZone(parkingZoneId, parkingZone.getPzName(), parkingZone.getPrice(), parkingZone.getCapacity(),
+                parkingZone.getLocation(), parkingZone.getFrom(), parkingZone.getTo(), parkingZone.getColor(),
+                parkingZone.getParkingSpaces(), parkingZone.getParkingZoneLocation());
     }
 
     @DeleteMapping({"/parkingZone/{parkingZoneId}"})
-    public void deleteParkingZone(@PathVariable int parkingZoneId) {
-        parkingZoneService.deleteParkingZone(parkingZoneId);
+    public Optional<ParkingZone> deleteParkingZone(@PathVariable int parkingZoneId) {
+        return this.parkingZoneService.deleteParkingZone(parkingZoneId);
     }
 }
Index: sources/app/src/main/java/parkup/controllers/RegistriranParkiracController.java
===================================================================
--- sources/app/src/main/java/parkup/controllers/RegistriranParkiracController.java	(revision ce6ad22249e902dea17e6ba473846ccebdd4330c)
+++ sources/app/src/main/java/parkup/controllers/RegistriranParkiracController.java	(revision f6bc52d991e03ece15d64dc62eaeb0f2aed0805b)
@@ -2,12 +2,10 @@
 
 import java.util.List;
+import java.util.Optional;
+
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
+import parkup.configs.RegistrationRequest;
+import parkup.configs.RegistrationServiceRP;
 import parkup.entities.RegistriranParkirac;
 import parkup.services.RegistriranParkiracService;
@@ -16,8 +14,10 @@
 public class RegistriranParkiracController {
     private final RegistriranParkiracService registriranParkiracService;
+    private final RegistrationServiceRP registrationServiceRP;
 
     @Autowired
-    public RegistriranParkiracController(RegistriranParkiracService registriranParkiracService) {
+    public RegistriranParkiracController(RegistriranParkiracService registriranParkiracService, RegistrationServiceRP registrationServiceRP) {
         this.registriranParkiracService = registriranParkiracService;
+        this.registrationServiceRP = registrationServiceRP;
     }
 
@@ -38,16 +38,26 @@
 
     @PostMapping({"/registriranParkirac"})
-    public void addRegistriranParkirac(@RequestBody RegistriranParkirac regPark) {
-        this.registriranParkiracService.addRegPark(regPark);
+    public Optional<RegistriranParkirac> addRegistriranParkirac(@RequestBody RegistriranParkirac regPark) {
+        return this.registriranParkiracService.addRegPark(regPark);
     }
 
     @PutMapping({"/registriranParkirac/{regParkId}"})
-    public void updateRegistriranParkirac(@PathVariable int regParkId, @RequestBody RegistriranParkirac regPark) {
-        this.registriranParkiracService.updateRegPark(regParkId, regPark.getName(), regPark.getSurname(), regPark.getMobile(), regPark.getEmail());
+    public RegistriranParkirac updateRegistriranParkirac(@PathVariable int regParkId, @RequestBody RegistriranParkirac regPark) {
+        return this.registriranParkiracService.updateRegPark(regParkId, regPark.getName(), regPark.getSurname(), regPark.getMobile(), regPark.getEmail(),regPark.getRegTablicki());
     }
 
     @DeleteMapping({"/registriranParkirac/{regParkId}"})
-    public void deleteRegistriranParkirac(@PathVariable int regParkId) {
-        this.registriranParkiracService.deleteRegPark(regParkId);
+    public Optional<RegistriranParkirac> deleteRegistriranParkirac(@PathVariable int regParkId) {
+        return this.registriranParkiracService.deleteRegPark(regParkId);
+    }
+
+    @PostMapping({"/registriranParkirac/registration"})
+    public String register(@RequestBody RegistrationRequest request){
+        return registrationServiceRP.register(request);
+    }
+
+    @GetMapping(path = "/registriranParkirac/registration/confirm")
+    public String confirm(@RequestParam("token") String token) {
+        return registrationServiceRP.confirmToken(token);
     }
 }
Index: sources/app/src/main/java/parkup/controllers/VrabotenController.java
===================================================================
--- sources/app/src/main/java/parkup/controllers/VrabotenController.java	(revision ce6ad22249e902dea17e6ba473846ccebdd4330c)
+++ sources/app/src/main/java/parkup/controllers/VrabotenController.java	(revision f6bc52d991e03ece15d64dc62eaeb0f2aed0805b)
@@ -2,22 +2,23 @@
 
 import java.util.List;
+import java.util.Optional;
+
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
+import parkup.configs.RegistrationRequest;
+import parkup.configs.RegistrationServiceW;
 import parkup.entities.Vraboten;
 import parkup.services.VrabotenService;
+import parkup.data.VrabotenDemo;
 
 @RestController
 public class VrabotenController {
     private final VrabotenService vrabotenService;
+    private final RegistrationServiceW registrationServiceW;
 
     @Autowired
-    public VrabotenController(VrabotenService vrabotenService) {
+    public VrabotenController(VrabotenService vrabotenService, RegistrationServiceW registrationServiceW) {
         this.vrabotenService = vrabotenService;
+        this.registrationServiceW = registrationServiceW;
     }
 
@@ -37,17 +38,38 @@
     }
 
+    @GetMapping({"/vraboten/vrabotenDemo"})
+    public List<VrabotenDemo> getVraboteniDemos(){
+        return this.vrabotenService.getAllVraboteniDemos();
+    }
+
     @PostMapping({"/vraboten"})
-    public void addVraboten(@RequestBody Vraboten vraboten) {
-        this.vrabotenService.addVraboten(vraboten);
+    public Optional<Vraboten> addVraboten(@RequestBody Vraboten vraboten) {
+        return this.vrabotenService.addVraboten(vraboten);
+    }
+
+    @PostMapping({"/vraboten/{vrabotenId}"})
+    public void lockVraboten(@PathVariable int vrabotenId) {
+        this.vrabotenService.lockVrabotenAcc(vrabotenId);
     }
 
     @PutMapping({"/vraboten/{vrabotenId}"})
-    public void updateVraboten(@PathVariable int vrabotenId, @RequestBody Vraboten vraboten) {
-        this.vrabotenService.updateVraboten(vrabotenId, vraboten.getFirstName(), vraboten.getLastName(), vraboten.getMobile(), vraboten.getEmail());
+    public Vraboten updateVraboten(@PathVariable int vrabotenId, @RequestBody Vraboten vraboten) {
+        return this.vrabotenService.updateVraboten(vrabotenId, vraboten.getFirstName(), vraboten.getLastName(),
+                vraboten.getMobile(), vraboten.getEmail(), vraboten.getStatus());
     }
 
     @DeleteMapping({"/vraboten/{vrabotenId}"})
-    public void deleteVraboten(@PathVariable int vrabotenId) {
-        this.vrabotenService.deleteVraboten(vrabotenId);
+    public Optional<Vraboten> deleteVraboten(@PathVariable int vrabotenId) {
+        return this.vrabotenService.deleteVraboten(vrabotenId);
+    }
+
+    @PostMapping({"/vraboten/registration"})
+    public String register(@RequestBody RegistrationRequest request){
+        return registrationServiceW.register(request);
+    }
+
+    @GetMapping(path = "/vraboten/registration/confirm")
+    public String confirm(@RequestParam("token") String token) {
+        return registrationServiceW.confirmToken(token);
     }
 }
Index: sources/app/src/main/java/parkup/data/Location.java
===================================================================
--- sources/app/src/main/java/parkup/data/Location.java	(revision f6bc52d991e03ece15d64dc62eaeb0f2aed0805b)
+++ sources/app/src/main/java/parkup/data/Location.java	(revision f6bc52d991e03ece15d64dc62eaeb0f2aed0805b)
@@ -0,0 +1,47 @@
+package parkup.data;
+
+import javax.persistence.*;
+
+@Entity
+public class Location {
+    @Id
+    @Column(name = "location_id")
+    @SequenceGenerator(
+            name="location_sequence_generator",
+            sequenceName = "location_sequence",
+            allocationSize = 1,
+            initialValue = 1300
+    )
+    @GeneratedValue(    //za postgres treba sequence da se namesti i ime na generator mi ga davamo kako od gore sto e
+            strategy = GenerationType.SEQUENCE,
+            generator = "location_sequence_generator"
+    )
+    private int locationId;
+
+    private float longitude;
+
+    private float latitude;
+
+    public Location(){}
+
+    public Location(float longtitude, float latitude) {
+        this.longitude = longtitude;
+        this.latitude = latitude;
+    }
+
+    public float getLongitude() {
+        return longitude;
+    }
+
+    public void setLongitude(float longitude) {
+        this.longitude = longitude;
+    }
+
+    public float getLatitude() {
+        return latitude;
+    }
+
+    public void setLatitude(float latitude) {
+        this.latitude = latitude;
+    }
+}
Index: sources/app/src/main/java/parkup/data/ParkingZoneLocation.java
===================================================================
--- sources/app/src/main/java/parkup/data/ParkingZoneLocation.java	(revision f6bc52d991e03ece15d64dc62eaeb0f2aed0805b)
+++ sources/app/src/main/java/parkup/data/ParkingZoneLocation.java	(revision f6bc52d991e03ece15d64dc62eaeb0f2aed0805b)
@@ -0,0 +1,56 @@
+package parkup.data;
+
+import javax.persistence.*;
+import java.util.List;
+
+@Entity
+public class ParkingZoneLocation {
+    @Id
+    @Column(name = "parkingZoneLocation_id")
+    @SequenceGenerator(
+            name="parkingZoneLocation_sequence_generator",
+            sequenceName = "parkingZoneLocation_sequence",
+            allocationSize = 1,
+            initialValue = 1400
+    )
+    @GeneratedValue(    //za postgres treba sequence da se namesti i ime na generator mi ga davamo kako od gore sto e
+            strategy = GenerationType.SEQUENCE,
+            generator = "parkingZoneLocation_sequence_generator"
+    )
+    private int parkingZoneLocationId;
+
+    @OneToOne
+    private Location centre;
+
+    @OneToMany
+    private List<Location> teminja;
+
+    public ParkingZoneLocation(int parkingZoneLocationId, Location centre, List<Location> teminja) {
+        this.parkingZoneLocationId = parkingZoneLocationId;
+        this.centre = centre;
+        this.teminja = teminja;
+    }
+
+    public ParkingZoneLocation(Location centre, List<Location> teminja) {
+        this.centre = centre;
+        this.teminja = teminja;
+    }
+
+    public ParkingZoneLocation() {}
+
+    public Location getCentre() {
+        return centre;
+    }
+
+    public void setCentre(Location centre) {
+        this.centre = centre;
+    }
+
+    public List<Location> getTeminja() {
+        return teminja;
+    }
+
+    public void setTeminja(List<Location> teminja) {
+        this.teminja = teminja;
+    }
+}
Index: sources/app/src/main/java/parkup/data/Tablicka.java
===================================================================
--- sources/app/src/main/java/parkup/data/Tablicka.java	(revision ce6ad22249e902dea17e6ba473846ccebdd4330c)
+++ sources/app/src/main/java/parkup/data/Tablicka.java	(revision f6bc52d991e03ece15d64dc62eaeb0f2aed0805b)
@@ -1,11 +1,21 @@
 package parkup.data;
 
-import javax.persistence.Entity;
-import javax.persistence.Id;
+import javax.persistence.*;
 
 @Entity
 public class Tablicka {
     @Id
+    @SequenceGenerator(
+            name="tablicka_sequence_generator",
+            sequenceName = "tablicka_sequence",
+            allocationSize = 1,
+            initialValue = 1000
+    )
+    @GeneratedValue(    //za postgres treba sequence da se namesti i ime na generator mi ga davamo kako od gore sto e
+            strategy = GenerationType.SEQUENCE,
+            generator = "tablicka_sequence_generator"
+    )
     private int tablicaId;
+
     private String tablica;
 
Index: sources/app/src/main/java/parkup/data/VrabotenDemo.java
===================================================================
--- sources/app/src/main/java/parkup/data/VrabotenDemo.java	(revision f6bc52d991e03ece15d64dc62eaeb0f2aed0805b)
+++ sources/app/src/main/java/parkup/data/VrabotenDemo.java	(revision f6bc52d991e03ece15d64dc62eaeb0f2aed0805b)
@@ -0,0 +1,41 @@
+package parkup.data;
+
+public class VrabotenDemo {
+
+    private String firstName;
+    private String lastName;
+    private String email;
+
+    public VrabotenDemo() {}
+
+    public VrabotenDemo(String firstName, String lastName, String email) {
+        this.firstName = firstName;
+        this.lastName = lastName;
+        this.email = email;
+    }
+
+    public String getFirstName() {
+        return firstName;
+    }
+
+    public void setFirstName(String firstName) {
+        this.firstName = firstName;
+    }
+
+    public String getLastName() {
+        return lastName;
+    }
+
+    public void setLastName(String lastName) {
+        this.lastName = lastName;
+    }
+
+    public String getEmail() {
+        return email;
+    }
+
+    public void setEmail(String email) {
+        this.email = email;
+    }
+}
+
Index: sources/app/src/main/java/parkup/entities/ParkingSession.java
===================================================================
--- sources/app/src/main/java/parkup/entities/ParkingSession.java	(revision ce6ad22249e902dea17e6ba473846ccebdd4330c)
+++ sources/app/src/main/java/parkup/entities/ParkingSession.java	(revision f6bc52d991e03ece15d64dc62eaeb0f2aed0805b)
@@ -1,3 +1,5 @@
 package parkup.entities;
+
+import parkup.data.Tablicka;
 
 import javax.persistence.*;
@@ -9,8 +11,8 @@
     @Column(name = "parking_session_id")
     @SequenceGenerator(
-            name="parking_session_generator",
+            name="parking_session_sequence_generator",
             sequenceName = "parking_session_sequence",
             allocationSize = 1,
-            initialValue = 700
+            initialValue = 800
     )
     @GeneratedValue(    //za postgres treba sequence da se namesti i ime na generator mi ga davamo kako od gore sto e
@@ -26,15 +28,21 @@
     private String timeEnd;
 
+    @OneToOne(cascade = {CascadeType.ALL})
+    @JoinColumn(name = "reg_tablicka", nullable = false)
+    private Tablicka tablica;
+
     public ParkingSession() {}
 
-    public ParkingSession(int pssId, String timeStart, String timeEnd) {
+    public ParkingSession(int pssId, String timeStart, String timeEnd, Tablicka tablica) {
         this.pssId = pssId;
         this.timeStart = timeStart;
         this.timeEnd = timeEnd;
+        this.tablica = tablica;
     }
 
-    public ParkingSession(String timeStart, String timeEnd) {
+    public ParkingSession(String timeStart, String timeEnd, Tablicka tablica) {
         this.timeStart = timeStart;
         this.timeEnd = timeEnd;
+        this.tablica = tablica;
     }
 
@@ -62,3 +70,11 @@
         this.timeEnd = timeEnd;
     }
+
+    public Tablicka getTablica() {
+        return tablica;
+    }
+
+    public void setTablica(Tablicka tablica) {
+        this.tablica = tablica;
+    }
 }
Index: sources/app/src/main/java/parkup/entities/ParkingSpace.java
===================================================================
--- sources/app/src/main/java/parkup/entities/ParkingSpace.java	(revision ce6ad22249e902dea17e6ba473846ccebdd4330c)
+++ sources/app/src/main/java/parkup/entities/ParkingSpace.java	(revision f6bc52d991e03ece15d64dc62eaeb0f2aed0805b)
@@ -9,8 +9,8 @@
     @Column(name = "parking_space_id")
     @SequenceGenerator(
-            name="parking_space_generator",
+            name="parking_space_sequence_generator",
             sequenceName = "parking_space_sequence",
             allocationSize = 1,
-            initialValue = 600
+            initialValue = 700
     )
     @GeneratedValue(    //za postgres treba sequence da se namesti i ime na generator mi ga davamo kako od gore sto e
@@ -29,17 +29,31 @@
     private boolean isHandicaped;
 
+    @Column(name = "latitude")
+    private float lat;
+
+    @Column(name = "longitude")
+    private float lng;
+
+    @OneToOne(cascade = {CascadeType.ALL})
+    @JoinColumn(name = "parking_zona")
+    private ParkingZone parkingZone;
+
     public ParkingSpace() {}
 
-    public ParkingSpace(int psId, String psName, boolean isTaken, boolean isHandicaped) {
+    public ParkingSpace(int psId, String psName, boolean isTaken, boolean isHandicaped, float lat, float lng) {
         this.psId = psId;
         this.psName = psName;
         this.isTaken = isTaken;
         this.isHandicaped = isHandicaped;
+        this.lat = lat;
+        this.lng = lng;
     }
 
-    public ParkingSpace(String psName, boolean isTaken, boolean isHandicaped) {
+    public ParkingSpace(String psName, boolean isTaken, boolean isHandicaped, float lat, float lng) {
         this.psName = psName;
         this.isTaken = isTaken;
         this.isHandicaped = isHandicaped;
+        this.lat = lat;
+        this.lng = lng;
     }
 
@@ -75,4 +89,20 @@
         this.isHandicaped = isHandicaped;
     }
+
+    public float getLat() {
+        return lat;
+    }
+
+    public void setLat(float lat) {
+        this.lat = lat;
+    }
+
+    public float getLng() {
+        return lng;
+    }
+
+    public void setLng(float lng) {
+        this.lng = lng;
+    }
 }
 
Index: sources/app/src/main/java/parkup/entities/ParkingZone.java
===================================================================
--- sources/app/src/main/java/parkup/entities/ParkingZone.java	(revision ce6ad22249e902dea17e6ba473846ccebdd4330c)
+++ sources/app/src/main/java/parkup/entities/ParkingZone.java	(revision f6bc52d991e03ece15d64dc62eaeb0f2aed0805b)
@@ -1,3 +1,5 @@
 package parkup.entities;
+
+import parkup.data.ParkingZoneLocation;
 
 import javax.persistence.*;
@@ -10,8 +12,8 @@
     @Id
     @SequenceGenerator(
-            name="parking_zone_generator",
+            name="parking_zone_sequence_generator",
             sequenceName = "parking_zone_sequence",
             allocationSize = 1,
-            initialValue = 500
+            initialValue = 600
     )
     @GeneratedValue(    //za postgres treba sequence da se namesti i ime na generator mi ga davamo kako od gore sto e
@@ -31,8 +33,11 @@
     private int capacity;
 
-    @Column(name = "work_hours")
-    private String workHours;
+    @Column(name = "vreme_od")  //za rabotni casovi od:
+    private int from;
 
-    @Column(name = "location")
+    @Column(name = "vreme_do")    //za rabotni casovi do:
+    private int to;
+
+    @Column(name = "lokacija")
     private String location;
 
@@ -40,32 +45,51 @@
     private int zafateniMesta;
 
+    @Column(name = "color")
+    private String color;
+
+    @ManyToMany(cascade = {CascadeType.ALL})
+    @JoinColumn(name="odgovorniLica",nullable = true)
+    private List<Vraboten> odgovorniLica;
+
     @OneToMany(cascade = {CascadeType.ALL})
-    @JoinColumn(name = "parkingSpaces", nullable = false)
     private List<ParkingSpace> parkingSpaces;
 
-    public ParkingZone() {
+    @OneToOne(cascade = {CascadeType.ALL})
+    private ParkingZoneLocation parkingZoneLocation;
+
+   public ParkingZone() {
+       this.zafateniMesta = 0;
+       this.parkingSpaces = new ArrayList<ParkingSpace>();
+   }
+
+    public ParkingZone(String pzName) {
+        this.pzName = pzName;
         this.zafateniMesta = 0;
         this.parkingSpaces = new ArrayList<ParkingSpace>();
     }
 
-    public ParkingZone(int pzId, String pzName, int price, int capacity, String workHours, String location, List<ParkingSpace> parkingSpaces) {
+    public ParkingZone(int pzId, String pzName, int price, int capacity, String location, List<ParkingSpace> parkingSpaces, String color, int from, int to) {
         this.pzId = pzId;
         this.pzName = pzName;
         this.price = price;
         this.capacity = capacity;
-        this.workHours = workHours;
         this.location = location;
         this.zafateniMesta = 0;
         this.parkingSpaces = parkingSpaces;
+        this.color = color;
+        this.from = from;
+        this.to = to;
     }
 
-    public ParkingZone(String pzName, int price, int capacity, String workHours, String location, List<ParkingSpace> parkingSpaces) {
+    public ParkingZone(String pzName, int price, int capacity, String location, List<ParkingSpace> parkingSpaces, String color, int from, int to) {
         this.pzName = pzName;
         this.price = price;
         this.capacity = capacity;
-        this.workHours = workHours;
         this.location = location;
         this.zafateniMesta = 0;
         this.parkingSpaces = parkingSpaces;
+        this.color = color;
+        this.from = from;
+        this.to = to;
     }
 
@@ -102,12 +126,4 @@
     }
 
-    public String getWorkHours() {
-        return this.workHours;
-    }
-
-    public void setWorkHours(String workHours) {
-        this.workHours = workHours;
-    }
-
     public String getLocation() {
         return this.location;
@@ -125,3 +141,43 @@
 
     public void setParkingSpaces(List<ParkingSpace> parkingSpaces) {this.parkingSpaces = parkingSpaces;}
+
+    public String getColor() {
+        return color;
+    }
+
+    public void setColor(String color) {
+        this.color = color;
+    }
+
+    public int getFrom() {
+        return from;
+    }
+
+    public void setFrom(int from) {
+        this.from = from;
+    }
+
+    public int getTo() {
+        return to;
+    }
+
+    public void setTo(int to) {
+        this.to = to;
+    }
+
+    public ParkingZoneLocation getParkingZoneLocation() {
+        return parkingZoneLocation;
+    }
+
+    public void setParkingZoneLocation(ParkingZoneLocation parkingZoneLocation) {
+        this.parkingZoneLocation = parkingZoneLocation;
+    }
+
+    public List<Vraboten> getOdgovorniLica() {
+        return odgovorniLica;
+    }
+
+    public void setOdgovorniLica(List<Vraboten> odgovorniLica) {
+        this.odgovorniLica = odgovorniLica;
+    }
 }
Index: sources/app/src/main/java/parkup/entities/RegistriranParkirac.java
===================================================================
--- sources/app/src/main/java/parkup/entities/RegistriranParkirac.java	(revision ce6ad22249e902dea17e6ba473846ccebdd4330c)
+++ sources/app/src/main/java/parkup/entities/RegistriranParkirac.java	(revision f6bc52d991e03ece15d64dc62eaeb0f2aed0805b)
@@ -2,12 +2,17 @@
 
 import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
 import java.util.List;
 import javax.persistence.*;
 
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.security.core.authority.SimpleGrantedAuthority;
+import org.springframework.security.core.userdetails.UserDetails;
 import parkup.data.Tablicka;
 
 @Entity
 @Table(name = "registriranParkirac")
-public class RegistriranParkirac {
+public class RegistriranParkirac implements UserDetails {
     @Id
     @SequenceGenerator(
@@ -33,5 +38,5 @@
     private String password;
 
-    @OneToMany
+    @OneToMany(cascade ={CascadeType.ALL})
     @Column(name = "regTablicki")
     private List<Tablicka> regTablicki;
@@ -46,8 +51,11 @@
     private String role;
 
+    private boolean locked;
+
+    private boolean enabled;
+
     public RegistriranParkirac() {
-
         this.regTablicki = new ArrayList<Tablicka>();
-        this.role = "ROLE_REGISTIRAN_PARKIRAC";
+        this.role = "ROLE_REGISTRIRAN_PARKIRAC";
     }
 
@@ -60,5 +68,5 @@
         this.email = email;
         this.mobile = mobile;
-        this.role = "ROLE_REGISTIRAN_PARKIRAC";
+        this.role = "ROLE_REGISTRIRAN_PARKIRAC";
     }
 
@@ -70,5 +78,14 @@
         this.email = email;
         this.mobile = mobile;
-        this.role = "ROLE_REGISTIRAN_PARKIRAC";
+        this.role = "ROLE_REGISTRIRAN_PARKIRAC";
+    }
+
+    public RegistriranParkirac(String name, String surname, String email, String password, String mobile) {
+        this.name = name;
+        this.surname = surname;
+        this.password = password;
+        this.email = email;
+        this.mobile = mobile;
+        this.role = "ROLE_REGISTRIRAN_PARKIRAC";
     }
 
@@ -95,12 +112,4 @@
     public void setSurname(String surname) {
         this.surname = surname;
-    }
-
-    public String getPassword() {
-        return password;
-    }
-
-    public void setPassword(String password) {
-        this.password = password;
     }
 
@@ -132,4 +141,43 @@
 
     public void setRole(String role) {this.role = role;}
+
+    @Override
+    public Collection<? extends GrantedAuthority> getAuthorities() {
+        SimpleGrantedAuthority authority = new SimpleGrantedAuthority(role);
+        return Collections.singleton(authority);
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    @Override
+    public String getUsername() {
+        return email;
+    }
+
+    @Override
+    public boolean isAccountNonExpired() {
+        return true;
+    }
+
+    @Override
+    public boolean isAccountNonLocked() {
+        return !locked;
+    }
+
+    @Override
+    public boolean isCredentialsNonExpired() {
+        return true;
+    }
+
+    @Override
+    public boolean isEnabled() {
+        return enabled;
+    }
 }
 
Index: sources/app/src/main/java/parkup/entities/Vraboten.java
===================================================================
--- sources/app/src/main/java/parkup/entities/Vraboten.java	(revision ce6ad22249e902dea17e6ba473846ccebdd4330c)
+++ sources/app/src/main/java/parkup/entities/Vraboten.java	(revision f6bc52d991e03ece15d64dc62eaeb0f2aed0805b)
@@ -1,13 +1,16 @@
 package parkup.entities;
 
-import parkup.data.Tablicka;
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.security.core.userdetails.UserDetails;
+import parkup.data.VrabotenDemo;
 
 import javax.persistence.*;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 
 @Entity
 @Table(name = "vraboten")
-public class Vraboten {
+public class Vraboten implements UserDetails {
     @Id
     @SequenceGenerator(
@@ -49,11 +52,15 @@
     private String status;
 
-    @Column(name = "account")
-    private boolean account;
+    @Column(name="locked")
+    private boolean locked;
+
+    @Column(name = "enabled")
+    private boolean enabled;
+
 
     public Vraboten() {
         this.role = "ROLE_VRABOTEN";
         this.parkingZones = new ArrayList<ParkingZone>();
-        this.account = true;
+        this.enabled = false;
         this.status = "neRaboti";
     }
@@ -68,5 +75,5 @@
         this.parkingZones = parkingZones;
         this.role = "ROLE_VRABOTEN";
-        this.account = true;
+        this.enabled = false;
         this.status = "neRaboti";
     }
@@ -80,6 +87,18 @@
         this.parkingZones = parkingZones;
         this.role = "ROLE_VRABOTEN";
-        this.account = true;
+        this.enabled = false;
         this.status = "neRaboti";
+    }
+
+    public Vraboten(String firstName, String lastName, String email, String password, String mobile) {
+        this.firstName=firstName;
+        this.lastName=lastName;
+        this.email=email;
+        this.password=password;
+        this.mobile=mobile;
+        this.parkingZones=new ArrayList<>();
+        this.enabled=false;
+        this.status="neRaboti";
+        this.role="ROLE_VRABOTEN";
     }
 
@@ -116,8 +135,42 @@
     }
 
+    @Override
+    public Collection<? extends GrantedAuthority> getAuthorities() {
+        return null;
+    }
+
     public String getPassword() {
         return password;
     }
 
+    @Override
+    public String getUsername() {
+        return email;
+    }
+
+    @Override
+    public boolean isAccountNonExpired() {
+        return true;
+    }
+
+    @Override
+    public boolean isAccountNonLocked() {
+        return !locked;
+    }
+
+    public void lockVraboten(){
+        this.locked = !locked;
+    }
+
+    @Override
+    public boolean isCredentialsNonExpired() {
+        return true;
+    }
+
+    @Override
+    public boolean isEnabled() {
+        return enabled;
+    }
+
     public void setPassword(String password) {
         this.password = password;
@@ -144,6 +197,6 @@
     public void setStatus(String status) {this.status = status;}
 
-    public boolean isAccount() {return account;}
-
-    public void setAccount(boolean account) {this.account = account;}
+    public boolean isAccount() {return enabled;}
+
+    public void setAccount(boolean account) {this.enabled = account;}
 }
Index: sources/app/src/main/java/parkup/repositories/GuestRepository.java
===================================================================
--- sources/app/src/main/java/parkup/repositories/GuestRepository.java	(revision ce6ad22249e902dea17e6ba473846ccebdd4330c)
+++ sources/app/src/main/java/parkup/repositories/GuestRepository.java	(revision f6bc52d991e03ece15d64dc62eaeb0f2aed0805b)
@@ -3,6 +3,8 @@
 import java.util.Optional;
 import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
 import parkup.entities.Guest;
 
+@Repository
 public interface GuestRepository extends JpaRepository<Guest, Integer> {
     Guest findByGuestId(int id);
Index: sources/app/src/main/java/parkup/repositories/ParkingZoneRepository.java
===================================================================
--- sources/app/src/main/java/parkup/repositories/ParkingZoneRepository.java	(revision ce6ad22249e902dea17e6ba473846ccebdd4330c)
+++ sources/app/src/main/java/parkup/repositories/ParkingZoneRepository.java	(revision f6bc52d991e03ece15d64dc62eaeb0f2aed0805b)
@@ -2,6 +2,8 @@
 
 import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
 import parkup.entities.ParkingZone;
 
+@Repository
 public interface ParkingZoneRepository extends JpaRepository<ParkingZone, Integer> {
     ParkingZone findByPzId(int id);
Index: sources/app/src/main/java/parkup/repositories/RegistriranParkiracRepository.java
===================================================================
--- sources/app/src/main/java/parkup/repositories/RegistriranParkiracRepository.java	(revision ce6ad22249e902dea17e6ba473846ccebdd4330c)
+++ sources/app/src/main/java/parkup/repositories/RegistriranParkiracRepository.java	(revision f6bc52d991e03ece15d64dc62eaeb0f2aed0805b)
@@ -3,6 +3,12 @@
 import java.util.Optional;
 import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
 import parkup.entities.RegistriranParkirac;
 
+import javax.transaction.Transactional;
+
+@Repository
 public interface RegistriranParkiracRepository extends JpaRepository<RegistriranParkirac, Integer> {
     RegistriranParkirac findByRegParkId(int regParkId);
@@ -11,3 +17,9 @@
 
     Optional<RegistriranParkirac> findRegistriranParkiracByEmail(String email);
+
+    @Transactional
+    @Modifying
+    @Query("UPDATE RegistriranParkirac rp " +
+            "SET rp.enabled = TRUE WHERE rp.email = ?1")
+    int enableRegistriranParkirac(String email);
 }
Index: sources/app/src/main/java/parkup/repositories/VrabotenRepository.java
===================================================================
--- sources/app/src/main/java/parkup/repositories/VrabotenRepository.java	(revision ce6ad22249e902dea17e6ba473846ccebdd4330c)
+++ sources/app/src/main/java/parkup/repositories/VrabotenRepository.java	(revision f6bc52d991e03ece15d64dc62eaeb0f2aed0805b)
@@ -3,6 +3,12 @@
 import java.util.Optional;
 import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
 import parkup.entities.Vraboten;
 
+import javax.transaction.Transactional;
+
+@Repository
 public interface VrabotenRepository extends JpaRepository<Vraboten, Integer> {
     Vraboten findByVrabotenId(int id);
@@ -11,3 +17,9 @@
 
     Optional<Vraboten> findVrabotenByEmail(String email);
+
+    @Transactional
+    @Modifying
+    @Query("UPDATE Vraboten v " +
+            "SET v.enabled = TRUE WHERE v.email = ?1")
+    int enableVraboten(String email);
 }
Index: sources/app/src/main/java/parkup/services/AdministratorService.java
===================================================================
--- sources/app/src/main/java/parkup/services/AdministratorService.java	(revision ce6ad22249e902dea17e6ba473846ccebdd4330c)
+++ sources/app/src/main/java/parkup/services/AdministratorService.java	(revision f6bc52d991e03ece15d64dc62eaeb0f2aed0805b)
@@ -1,5 +1,4 @@
 package parkup.services;
 
-import java.time.LocalDateTime;
 import java.util.List;
 import java.util.Objects;
@@ -14,5 +13,4 @@
 import org.springframework.stereotype.Service;
 import parkup.configs.email.EmailValidator;
-import parkup.configs.token.ConfirmationToken;
 import parkup.configs.token.ConfirmationTokenService;
 import parkup.entities.Administrator;
@@ -42,16 +40,22 @@
     }
 
-    public void addAdministrator(Administrator administrator) {
+    public Optional<Administrator> addAdministrator(Administrator administrator) {
         Optional<Administrator> administratorOpt = this.administratorRepository.findAdministratorByEmail(administrator.getEmail());
         if (administratorOpt.isPresent()) {
             throw new IllegalStateException("Email already taken, try adding an administrator with a different valid email address");
         } else {
-            System.out.println(administrator);
-            this.administratorRepository.save(administrator);
+            if (administrator.getEmail() != null && administrator.getEmail().length() > 1 && administrator.getEmail().contains("@")) {
+                //System.out.println(regPark);
+                this.administratorRepository.save(administrator);
+            }
+            else {
+                throw new IllegalStateException("email not valid");
+            }
         }
+        return administratorOpt;
     }
 
     @Transactional
-    public void updateAdministrator(int administratorId, String firstName, String lastName, String mobile, String email) {
+    public Administrator updateAdministrator(int administratorId, String firstName, String lastName, String mobile, String email) {
         Optional<Administrator> administratorOpt = Optional.ofNullable(this.administratorRepository.findByAdministratorId(administratorId));
         if (administratorOpt.isPresent()) {
@@ -62,6 +66,7 @@
                     throw new IllegalStateException("email taken");
                 }
-
                 administratorNov.setEmail(email);
+            }else{
+                throw new IllegalStateException("email not valid");
             }
 
@@ -77,8 +82,13 @@
                 administratorNov.setMobile(mobile);
             }
+            return administratorNov;
         }
+        else {
+            throw new IllegalStateException("Administrator doesn't exist, therefore can't be updated");
+        }
+
     }
 
-    public void deleteAdministrator(int administratorId) {
+    public Optional<Administrator> deleteAdministrator(int administratorId) {
         Optional<Administrator> administratorOpt = Optional.ofNullable(this.administratorRepository.findByAdministratorId(administratorId));
         if (administratorOpt.isPresent()) {
@@ -87,4 +97,5 @@
             throw new IllegalStateException("Administrator doesn't exist, therefore can't be deleted");
         }
+        return administratorOpt;
     }
 
@@ -126,12 +137,12 @@
 
         String token = UUID.randomUUID().toString();
-        ConfirmationToken confirmationToken = new ConfirmationToken(
-                token,
-                LocalDateTime.now(),
-                LocalDateTime.now().plusMinutes(15),
-                administrator
-        );
+        //ConfirmationTokenRP confirmationToken = new ConfirmationTokenRP(
+        //        token,
+        //        LocalDateTime.now(),
+        //        LocalDateTime.now().plusMinutes(15),
+        //        administrator
+        //);
 
-        confirmationTokenService.saveConfirmationToken(confirmationToken);
+        //confirmationTokenService.saveConfirmationToken(confirmationToken);
 
         // TODO: SEND EMAIL
Index: sources/app/src/main/java/parkup/services/ParkingSessionService.java
===================================================================
--- sources/app/src/main/java/parkup/services/ParkingSessionService.java	(revision ce6ad22249e902dea17e6ba473846ccebdd4330c)
+++ sources/app/src/main/java/parkup/services/ParkingSessionService.java	(revision f6bc52d991e03ece15d64dc62eaeb0f2aed0805b)
@@ -3,7 +3,9 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import parkup.data.Tablicka;
 import parkup.entities.ParkingSession;
 import parkup.repositories.ParkingSessionRepository;
 
+import javax.transaction.Transactional;
 import java.util.List;
 import java.util.Objects;
@@ -28,8 +30,10 @@
     }
 
-    public void updateParkingSession(int parkingSessionId, String timeStart, String timeEnd) {
+    @Transactional
+    public void updateParkingSession(int parkingSessionId, String timeStart, String timeEnd, Tablicka tablicka) {
         Optional<ParkingSession> parkingSessionOpt = Optional.ofNullable(parkingSessionRepository.findByPssId(parkingSessionId));
         if (parkingSessionOpt.isPresent()) {
             ParkingSession parkingSessionNov = parkingSessionRepository.findByPssId(parkingSessionId);
+
             if(!parkingSessionNov.getTimeStart().equals(timeStart) && !parkingSessionNov.getTimeStart().equals(timeEnd))
                 parkingSessionNov.setTimeStart(timeStart);
@@ -37,11 +41,18 @@
             if(!parkingSessionNov.getTimeEnd().equals(timeEnd) && !parkingSessionNov.getTimeEnd().equals(timeStart))
                 parkingSessionNov.setTimeEnd(timeEnd);
+
+            if(tablicka!=null && !Objects.equals(parkingSessionNov.getTablica(),tablicka)){
+                parkingSessionNov.setTablica(tablicka);
+            }
+        }else{
+            throw new IllegalStateException("The ParkingSession does not exist");
         }
     }
 
-    public void deleteParkingSession(int parkingSessionId) {
+    public Optional<ParkingSession> deleteParkingSession(int parkingSessionId) {
         Optional<ParkingSession> parkingSessionOpt = Optional.ofNullable(parkingSessionRepository.findByPssId(parkingSessionId));
         if (parkingSessionOpt.isPresent()) {
             parkingSessionRepository.deleteByPssId(parkingSessionId);
+            return parkingSessionOpt;
         } else {
             throw new IllegalStateException("ParkingSpace doesn't exist, therefore can't be deleted");
@@ -49,6 +60,6 @@
     }
 
-    public void addParkingSession(ParkingSession parkingSession) {
-        Optional <ParkingSession> parkingSessionOpt = Optional.ofNullable(parkingSessionRepository.findByPssId(parkingSession.getPssId()));
+    public Optional<ParkingSession> addParkingSession(ParkingSession parkingSession) {
+        Optional<ParkingSession> parkingSessionOpt = Optional.ofNullable(parkingSessionRepository.findByPssId(parkingSession.getPssId()));
         if (parkingSessionOpt.isPresent()) {
             throw new IllegalStateException("ID already taken, ParkingSession cannot be added");
@@ -56,4 +67,5 @@
             System.out.println(parkingSession);
             parkingSessionRepository.save(parkingSession);
+            return parkingSessionOpt;
         }
     }
Index: sources/app/src/main/java/parkup/services/ParkingSpaceService.java
===================================================================
--- sources/app/src/main/java/parkup/services/ParkingSpaceService.java	(revision ce6ad22249e902dea17e6ba473846ccebdd4330c)
+++ sources/app/src/main/java/parkup/services/ParkingSpaceService.java	(revision f6bc52d991e03ece15d64dc62eaeb0f2aed0805b)
@@ -6,4 +6,5 @@
 import parkup.repositories.ParkingSpaceRepository;
 
+import javax.transaction.Transactional;
 import java.util.List;
 import java.util.Objects;
@@ -28,6 +29,6 @@
     }
 
-    public void addParkingSpace(ParkingSpace parkingSpace) {
-        Optional <ParkingSpace> parkingSpaceOpt = Optional.ofNullable(parkingSpaceRepository.findByPsName(parkingSpace.getPsName()));
+    public Optional<ParkingSpace> addParkingSpace(ParkingSpace parkingSpace) {
+        Optional<ParkingSpace> parkingSpaceOpt = Optional.ofNullable(parkingSpaceRepository.findByPsName(parkingSpace.getPsName()));
         if (parkingSpaceOpt.isPresent()) {
             throw new IllegalStateException("Name already taken, try adding a ParkingZone with a different name");
@@ -36,7 +37,9 @@
             parkingSpaceRepository.save(parkingSpace);
         }
+        return parkingSpaceOpt;
     }
 
-    public void updateParkingSpace(int parkingSpaceId, String psName, boolean taken, boolean handicaped) {
+    @Transactional
+    public ParkingSpace updateParkingSpace(int parkingSpaceId, String psName, boolean taken, boolean handicaped, float lat, float lng) {
         Optional<ParkingSpace> ParkingSpaceOpt = Optional.ofNullable(parkingSpaceRepository.findByPsId(parkingSpaceId));
         if (ParkingSpaceOpt.isPresent()) {
@@ -58,8 +61,20 @@
                 ParkingSpaceNov.setHandicaped(handicaped);
             }
+
+            if(lat!=0 && !Objects.equals(ParkingSpaceNov.getLat(), lat)){
+                ParkingSpaceNov.setLat(lat);
+            }
+
+            if(lng!=0 && !Objects.equals(ParkingSpaceNov.getLng(), lng)){
+                ParkingSpaceNov.setLng(lng);
+            }
+            return ParkingSpaceNov;
+        }else{
+            throw new IllegalStateException("ParkingSpace does not exist");
         }
     }
 
-    public void deleteParkingSpace(int parkingSpaceId) {
+    @Transactional
+    public Optional<ParkingSpace> deleteParkingSpace(int parkingSpaceId) {
         Optional<ParkingSpace> parkingSpaceOpt = Optional.ofNullable(parkingSpaceRepository.findByPsId(parkingSpaceId));
         if (parkingSpaceOpt.isPresent()) {
@@ -68,4 +83,5 @@
             throw new IllegalStateException("ParkingSpace doesn't exist, therefore can't be deleted");
         }
+        return parkingSpaceOpt;
     }
 }
Index: sources/app/src/main/java/parkup/services/ParkingZoneService.java
===================================================================
--- sources/app/src/main/java/parkup/services/ParkingZoneService.java	(revision ce6ad22249e902dea17e6ba473846ccebdd4330c)
+++ sources/app/src/main/java/parkup/services/ParkingZoneService.java	(revision f6bc52d991e03ece15d64dc62eaeb0f2aed0805b)
@@ -2,10 +2,13 @@
 
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.jpa.repository.Modifying;
 import org.springframework.stereotype.Service;
-import parkup.entities.Administrator;
+import parkup.data.ParkingZoneLocation;
+import parkup.entities.ParkingSpace;
 import parkup.entities.ParkingZone;
 import parkup.repositories.ParkingZoneRepository;
 
 import javax.transaction.Transactional;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Objects;
@@ -30,5 +33,14 @@
     }
 
-    public void addParkingZone(ParkingZone parkingZone) {   //zavisno vo koj grad ili opstina i napravi proverki pred dodavanje, implementiraj u naredna faza
+    public List<String> getAllParkingZoneNames() {
+        List<ParkingZone> parkingZones = this.parkingZoneRepository.findAll();
+        List<String> parkingZonesNames = new ArrayList<>();
+        for (ParkingZone pz : parkingZones){
+            parkingZonesNames.add(pz.getPzName());
+        }
+        return parkingZonesNames;
+    }
+
+    public Optional<ParkingZone> addParkingZone(ParkingZone parkingZone) {   //zavisno vo koj grad ili opstina i napravi proverki pred dodavanje, implementiraj u naredna faza
         Optional<ParkingZone> parkingZoneOpt = Optional.ofNullable(parkingZoneRepository.findByPzName(parkingZone.getPzName()));
         if (parkingZoneOpt.isPresent()) {
@@ -38,8 +50,23 @@
             parkingZoneRepository.save(parkingZone);
         }
+        return parkingZoneOpt;
     }
 
+    public ParkingZone addParkingZoneNameOnly(String name) {
+        Optional<ParkingZone> parkingZoneOpt = Optional.ofNullable(parkingZoneRepository.findByPzName(name));
+        if (parkingZoneOpt.isPresent()) {
+            throw new IllegalStateException("Name already taken, try adding a ParkingZone with a different name");
+        } else {
+            ParkingZone parkingZone = new ParkingZone(name.trim());
+            parkingZoneRepository.save(parkingZone);
+            return parkingZone;
+        }
+    }
+
+    //TODO prati niza od objekti ParkingSpaces i prati objekt ParkingZoneLocation
     @Transactional
-    public void updateParkingZone(int parkingZoneId, String pzName, int price, int capacity, String workHours, String location) {
+    public ParkingZone updateParkingZone(int parkingZoneId, String pzName, int price, int capacity,
+                                         String location, int from, int to, String color,
+                                         List<ParkingSpace> parkingSpaces, ParkingZoneLocation parkingZoneLocation) {
         Optional<ParkingZone> parkingZoneOpt = Optional.ofNullable(parkingZoneRepository.findByPzId(parkingZoneId));
         if (parkingZoneOpt.isPresent()) {
@@ -62,15 +89,37 @@
             }
 
-            if (workHours != null && workHours.length() > 0 && !Objects.equals(parkingZoneNov.getWorkHours(), workHours)) {
-                parkingZoneNov.setWorkHours(workHours);
-            }
-
             if (location != null && location.length() > 0 && !Objects.equals(parkingZoneNov.getLocation(), location)) {
                 parkingZoneNov.setLocation(location);
             }
+
+            if (from != 0 && !Objects.equals(parkingZoneNov.getFrom(), from)) {
+                parkingZoneNov.setFrom(from);
+            }
+
+            if (to != 0 && !Objects.equals(parkingZoneNov.getTo(), to)) {
+                parkingZoneNov.setTo(to);
+            }
+
+            if (color != null && color.length() > 0 && !Objects.equals(parkingZoneNov.getColor(), color)) {
+                parkingZoneNov.setColor(color);
+            }
+
+            if(parkingZoneLocation!=null){
+                parkingZoneNov.setParkingZoneLocation(parkingZoneLocation);
+            }
+
+            if(!parkingSpaces.isEmpty()){
+                //TODO kreiraj lista od parkingSpaces, ni gi prakja false isHandicaped i isTaken
+                parkingZoneNov.setParkingSpaces(parkingSpaces);
+            }
+
+            return parkingZoneNov;
+        } else {
+            throw new IllegalStateException("There ParkingZone does not exist");
         }
     }
 
-    public void deleteParkingZone(int parkingZoneId) {
+    @Transactional
+    public Optional<ParkingZone> deleteParkingZone(int parkingZoneId) {
         Optional<ParkingZone> parkingZoneOpt = Optional.ofNullable(parkingZoneRepository.findByPzId(parkingZoneId));
         if (parkingZoneOpt.isPresent()) {
@@ -79,4 +128,5 @@
             throw new IllegalStateException("ParkingZone doesn't exist, therefore can't be deleted");
         }
+        return parkingZoneOpt;
     }
 }
Index: sources/app/src/main/java/parkup/services/RegistriranParkiracService.java
===================================================================
--- sources/app/src/main/java/parkup/services/RegistriranParkiracService.java	(revision ce6ad22249e902dea17e6ba473846ccebdd4330c)
+++ sources/app/src/main/java/parkup/services/RegistriranParkiracService.java	(revision f6bc52d991e03ece15d64dc62eaeb0f2aed0805b)
@@ -1,20 +1,36 @@
 package parkup.services;
 
+import java.time.LocalDateTime;
 import java.util.List;
 import java.util.Objects;
 import java.util.Optional;
+import java.util.UUID;
 import javax.transaction.Transactional;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.security.core.userdetails.UserDetailsService;
+import org.springframework.security.core.userdetails.UsernameNotFoundException;
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
 import org.springframework.stereotype.Service;
+import parkup.configs.email.EmailValidator;
+import parkup.configs.token.ConfirmationTokenRP;
+import parkup.configs.token.ConfirmationTokenService;
+import parkup.data.Tablicka;
 import parkup.entities.RegistriranParkirac;
 import parkup.repositories.RegistriranParkiracRepository;
 
 @Service
-public class RegistriranParkiracService {
+public class RegistriranParkiracService implements UserDetailsService {
     private final RegistriranParkiracRepository registriranParkiracRepository;
+    private final BCryptPasswordEncoder bCryptPasswordEncoder;
+    private final ConfirmationTokenService confirmationTokenService;
+    private EmailValidator emailValidator;
 
     @Autowired
-    public RegistriranParkiracService(RegistriranParkiracRepository registriranParkiracRepository) {
+    public RegistriranParkiracService(RegistriranParkiracRepository registriranParkiracRepository, BCryptPasswordEncoder bCryptPasswordEncoder, ConfirmationTokenService confirmationTokenService) {
         this.registriranParkiracRepository = registriranParkiracRepository;
+        this.bCryptPasswordEncoder = bCryptPasswordEncoder;
+        this.confirmationTokenService = confirmationTokenService;
     }
 
@@ -23,16 +39,22 @@
     }
 
-    public void addRegPark(RegistriranParkirac regPark) {
+    public Optional<RegistriranParkirac> addRegPark(RegistriranParkirac regPark) {
         Optional<RegistriranParkirac> regParkOpt = this.registriranParkiracRepository.findRegistriranParkiracByEmail(regPark.getEmail());
         if (regParkOpt.isPresent()) {
             throw new IllegalStateException("Email already taken, try adding a registriranParkirac with a different valid email address");
         } else {
-            System.out.println(regPark);
-            this.registriranParkiracRepository.save(regPark);
+            if (regPark.getEmail() != null && regPark.getEmail().length() > 1 && regPark.getEmail().contains("@")) {
+                //System.out.println(regPark);
+                this.registriranParkiracRepository.save(regPark);
+            }
+            else {
+                throw new IllegalStateException("email not valid");
+            }
         }
+        return regParkOpt;
     }
 
     @Transactional
-    public void updateRegPark(int regParkId, String name, String surname, String mobile, String email) {
+    public RegistriranParkirac updateRegPark(int regParkId, String name, String surname, String mobile, String email,List<Tablicka> regTablicki) {
         Optional<RegistriranParkirac> regParkOpt = Optional.ofNullable(this.registriranParkiracRepository.findByRegParkId(regParkId));
         if (regParkOpt.isPresent()) {
@@ -58,14 +80,24 @@
                 regParkNov.setMobile(mobile);
             }
+            regParkNov.setRegTablicki(regTablicki);
+            return regParkNov;
+        }else{
+            throw new IllegalStateException("RegistriranParkirac doesn't exist, therefore can't be updated");
         }
     }
 
-    public void deleteRegPark(int regParkId) {
+    @Transactional
+    @Modifying
+    public Optional<RegistriranParkirac> deleteRegPark(int regParkId) {
         Optional<RegistriranParkirac> regPark = Optional.ofNullable(this.registriranParkiracRepository.findByRegParkId(regParkId));
         if (regPark.isPresent()) {
+            //TODO da povikamo metod od ConfirmationTokenService za brisenje na ConfirmationTokenRP *DONE
+            //TODO da se izbrisat tablicki i da ne se dupliraat istite tablicki pri update ili add na nov registriranParkirac
+            this.confirmationTokenService.deleteByRegistriranParkirac_RegParkId(regParkId);
             this.registriranParkiracRepository.deleteByRegParkId(regParkId);
         } else {
             throw new IllegalStateException("RegistriranParkirac doesn't exist, therefore can't be deleted");
         }
+        return regPark;
     }
 
@@ -74,3 +106,50 @@
         return regPark.orElse(null);
     }
+
+    @Override
+    public UserDetails loadUserByUsername(String email) throws UsernameNotFoundException {
+        return registriranParkiracRepository.findRegistriranParkiracByEmail(email)
+                .orElseThrow(() ->
+                        new UsernameNotFoundException("Email not found"));
+
+    }
+
+    public String signUpRegistriranParkirac(RegistriranParkirac registriranParkirac){
+        boolean registriranParkiracExists = registriranParkiracRepository
+                .findRegistriranParkiracByEmail(registriranParkirac.getEmail())
+                .isPresent();
+        if(registriranParkiracExists){
+            // TODO check if attributes are the same and
+            // TODO if email not confirmed send confirmation email
+
+            throw new IllegalStateException("Email already taken");
+        }
+
+        String encodedPassword = bCryptPasswordEncoder
+                .encode(registriranParkirac.getPassword());
+
+        registriranParkirac.setPassword(encodedPassword);
+
+        registriranParkiracRepository.save(registriranParkirac);
+
+        // TODO: Send confirmation token
+
+        String token = UUID.randomUUID().toString();
+        ConfirmationTokenRP confirmationTokenRP = new ConfirmationTokenRP(
+                token,
+                LocalDateTime.now(),
+                LocalDateTime.now().plusMinutes(15),
+                registriranParkirac
+        );
+
+        confirmationTokenService.saveConfirmationTokenRP(confirmationTokenRP);
+
+        // TODO: SEND EMAIL
+
+        return token;
+    }
+
+    public int enableRegistriranParkirac(String email) {
+        return registriranParkiracRepository.enableRegistriranParkirac(email);
+    }
 }
Index: sources/app/src/main/java/parkup/services/VrabotenService.java
===================================================================
--- sources/app/src/main/java/parkup/services/VrabotenService.java	(revision ce6ad22249e902dea17e6ba473846ccebdd4330c)
+++ sources/app/src/main/java/parkup/services/VrabotenService.java	(revision f6bc52d991e03ece15d64dc62eaeb0f2aed0805b)
@@ -1,21 +1,31 @@
 package parkup.services;
 
-import java.util.List;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.UUID;
+import java.time.LocalDateTime;
+import java.util.*;
 import javax.transaction.Transactional;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.security.core.userdetails.UserDetailsService;
+import org.springframework.security.core.userdetails.UsernameNotFoundException;
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
 import org.springframework.stereotype.Service;
+import parkup.configs.token.ConfirmationTokenW;
+import parkup.configs.token.ConfirmationTokenService;
 import parkup.entities.Vraboten;
 import parkup.repositories.VrabotenRepository;
+import parkup.data.VrabotenDemo;
 
 @Service
-public class VrabotenService {
+public class VrabotenService implements UserDetailsService {
     private final VrabotenRepository vrabotenRepository;
+    private final BCryptPasswordEncoder bCryptPasswordEncoder;
+    private final ConfirmationTokenService confirmationTokenService;
 
     @Autowired
-    public VrabotenService(VrabotenRepository vrabotenRepository) {
+    public VrabotenService(VrabotenRepository vrabotenRepository, BCryptPasswordEncoder bCryptPasswordEncoder, ConfirmationTokenService confirmationTokenService) {
         this.vrabotenRepository = vrabotenRepository;
+        this.bCryptPasswordEncoder = bCryptPasswordEncoder;
+        this.confirmationTokenService = confirmationTokenService;
     }
 
@@ -29,16 +39,32 @@
     }
 
-    public void addVraboten(Vraboten vraboten) {
+    public List<VrabotenDemo> getAllVraboteniDemos() {
+        List<Vraboten> vraboteni = this.vrabotenRepository.findAll();
+        List<VrabotenDemo> vrabotenDemos = new ArrayList<>();
+        for (Vraboten v : vraboteni){
+            VrabotenDemo vd = new VrabotenDemo(v.getFirstName(), v.getLastName(), v.getEmail());
+            vrabotenDemos.add(vd);
+        }
+        return vrabotenDemos;
+    }
+
+    public Optional<Vraboten> addVraboten(Vraboten vraboten) {
         Optional<Vraboten> vrabotenOpt = this.vrabotenRepository.findVrabotenByEmail(vraboten.getEmail());
         if (vrabotenOpt.isPresent()) {
             throw new IllegalStateException("Email already taken, try adding a vraboten with a different valid email address");
         } else {
-            System.out.println(vraboten);
-            this.vrabotenRepository.save(vraboten);
+            if (vraboten.getEmail() != null && vraboten.getEmail().length() > 1 && vraboten.getEmail().contains("@")) {
+                //System.out.println(vraboten);
+                this.vrabotenRepository.save(vraboten);
+            }
+            else{
+                throw new IllegalStateException("email not valid");
+            }
         }
+        return vrabotenOpt;
     }
 
     @Transactional
-    public void updateVraboten(int vrabotenId, String firstName, String lastName, String mobile, String email) {
+    public Vraboten updateVraboten(int vrabotenId, String firstName, String lastName, String mobile, String email, String status) {
         Optional<Vraboten> vrabotenOpt = Optional.ofNullable(this.vrabotenRepository.findByVrabotenId(vrabotenId));
         if (vrabotenOpt.isPresent()) {
@@ -49,6 +75,7 @@
                     throw new IllegalStateException("email taken");
                 }
-
                 vrabotenNov.setEmail(email);
+            } else {
+                throw new IllegalStateException("email not valid");
             }
 
@@ -64,14 +91,88 @@
                 vrabotenNov.setMobile(mobile);
             }
+
+            if (mobile != null && status.length() > 0 && !Objects.equals(vrabotenNov.getStatus(), status)) {
+                if(status.equals("raboti") || status.equals("ne raboti") || status.equals("na odmor") || status.equals("na boleduvanje")){
+                    vrabotenNov.setStatus(status);
+                }else{
+                    throw new IllegalStateException("Please enter one of the following statuses: 'raboti', 'ne raboti', 'na odmor', 'na boleduvanje'");
+                }
+            }
+
+            return vrabotenNov;
         }
-    }
+        else{
+            throw new IllegalStateException("Vraboten doesn't exist, therefore can't be updated");
+        }
+    }//za menjanje password da se implementira
 
-    public void deleteVraboten(int vrabotenId) {
+    @Modifying
+    @Transactional
+    public Optional<Vraboten> deleteVraboten(int vrabotenId) {
         Optional<Vraboten> vrabotenOpt = Optional.ofNullable(this.vrabotenRepository.findByVrabotenId(vrabotenId));
         if (vrabotenOpt.isPresent()) {
+            //TODO da povikamo metod od ConfirmationTokenService za brisenje na ConfirmationTokenW
+            this.confirmationTokenService.deleteByVraboten_VrabotenId(vrabotenId);
             this.vrabotenRepository.deleteByVrabotenId(vrabotenId);
         } else {
             throw new IllegalStateException("Vraboten doesn't exist, therefore can't be deleted");
         }
+        return vrabotenOpt;
     }
+
+    @Transactional
+    public void lockVrabotenAcc(int vrabotenId) {
+        Vraboten vrabotenOpt = this.vrabotenRepository.findByVrabotenId(vrabotenId);
+        if (vrabotenOpt!=null) {
+            vrabotenOpt.lockVraboten();
+        } else {
+            throw new IllegalStateException("Vraboten doesn't exist, therefore his account can't be locked/unlocked");
+        }
+    }//dali treba da stoi @Transactional gore nad funkcijata?
+
+    @Override
+    public UserDetails loadUserByUsername(String email) throws UsernameNotFoundException {
+        return vrabotenRepository.findVrabotenByEmail(email)
+                .orElseThrow(() ->
+                        new UsernameNotFoundException("Email not found"));
+    }
+    public String signUpVraboten(Vraboten vraboten){
+        boolean vrabotenExists = vrabotenRepository
+                .findVrabotenByEmail(vraboten.getEmail())
+                .isPresent();
+        if(vrabotenExists){
+            // TODO check if attributes are the same and
+            // TODO if email not confirmed send confirmation email
+
+            throw new IllegalStateException("Email already taken");
+        }
+
+        String encodedPassword = bCryptPasswordEncoder
+                .encode(vraboten.getPassword());
+
+        vraboten.setPassword(encodedPassword);
+
+        vrabotenRepository.save(vraboten);
+
+        // TODO: Send confirmation token
+
+        String token = UUID.randomUUID().toString();
+        ConfirmationTokenW confirmationTokenW = new ConfirmationTokenW(
+                token,
+                LocalDateTime.now(),
+                LocalDateTime.now().plusMinutes(15),
+                vraboten
+        );
+
+        confirmationTokenService.saveConfirmationTokenW(confirmationTokenW);
+
+        // TODO: SEND EMAIL
+
+        return token;
+    }
+
+    public int enableVraboten(String email) {
+        return vrabotenRepository.enableVraboten(email);
+    }
+
 }
