Index: sources/app/.idea/codeStyles/codeStyleConfig.xml
===================================================================
--- sources/app/.idea/codeStyles/codeStyleConfig.xml	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
+++ sources/app/.idea/codeStyles/codeStyleConfig.xml	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -0,0 +1,5 @@
+<component name="ProjectCodeStyleConfiguration">
+  <state>
+    <option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
+  </state>
+</component>
Index: sources/app/.idea/libraries/Maven__com_auth0_java_jwt_3_18_3.xml
===================================================================
--- sources/app/.idea/libraries/Maven__com_auth0_java_jwt_3_18_3.xml	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
+++ sources/app/.idea/libraries/Maven__com_auth0_java_jwt_3_18_3.xml	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -0,0 +1,13 @@
+<component name="libraryTable">
+  <library name="Maven: com.auth0:java-jwt:3.18.3">
+    <CLASSES>
+      <root url="jar://$MAVEN_REPOSITORY$/com/auth0/java-jwt/3.18.3/java-jwt-3.18.3.jar!/" />
+    </CLASSES>
+    <JAVADOC>
+      <root url="jar://$MAVEN_REPOSITORY$/com/auth0/java-jwt/3.18.3/java-jwt-3.18.3-javadoc.jar!/" />
+    </JAVADOC>
+    <SOURCES>
+      <root url="jar://$MAVEN_REPOSITORY$/com/auth0/java-jwt/3.18.3/java-jwt-3.18.3-sources.jar!/" />
+    </SOURCES>
+  </library>
+</component>
Index: sources/app/.idea/runConfigurations.xml
===================================================================
--- sources/app/.idea/runConfigurations.xml	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ 	(revision )
@@ -1,10 +1,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="RunConfigurationProducerService">
-    <option name="ignoredProducers">
-      <set>
-        <option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
-      </set>
-    </option>
-  </component>
-</project>
Index: sources/app/ParkUp.iml
===================================================================
--- sources/app/ParkUp.iml	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ sources/app/ParkUp.iml	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -77,7 +77,4 @@
     <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.4.5" level="project" />
     <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.4.5" level="project" />
-    <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.11.4" level="project" />
-    <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.11.4" level="project" />
-    <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.11.4" level="project" />
     <orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.11.4" level="project" />
     <orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.11.4" level="project" />
@@ -153,4 +150,8 @@
     <orderEntry type="library" scope="TEST" name="Maven: org.assertj:assertj-core:3.11.1" level="project" />
     <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-mail:2.4.5" level="project" />
+    <orderEntry type="library" name="Maven: com.auth0:java-jwt:3.18.3" level="project" />
+    <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.11.4" level="project" />
+    <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.11.4" level="project" />
+    <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.11.4" level="project" />
     <orderEntry type="library" name="Maven: org.springframework:spring-context-support:5.2.8.RELEASE" level="project" />
     <orderEntry type="library" name="Maven: org.springframework:spring-beans:5.3.6" level="project" />
Index: sources/app/pom.xml
===================================================================
--- sources/app/pom.xml	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ sources/app/pom.xml	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -97,12 +97,14 @@
         </dependency>
 
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-security</artifactId>
-        </dependency>
 
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-mail</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.auth0</groupId>
+            <artifactId>java-jwt</artifactId>
+            <version>3.18.3</version>
         </dependency>
 
Index: sources/app/src/main/java/parkup/configs/CustomAuthenticationFilter.java
===================================================================
--- sources/app/src/main/java/parkup/configs/CustomAuthenticationFilter.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
+++ sources/app/src/main/java/parkup/configs/CustomAuthenticationFilter.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -0,0 +1,93 @@
+package parkup.configs;
+
+import com.auth0.jwt.JWT;
+import com.auth0.jwt.algorithms.Algorithm;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+
+import org.springframework.boot.autoconfigure.kafka.KafkaProperties;
+import org.springframework.security.authentication.AuthenticationManager;
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.AuthenticationException;
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.security.core.userdetails.User;
+import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import parkup.entities.Administrator;
+import parkup.entities.RegisteredUser;
+import parkup.entities.Worker;
+
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.*;
+import java.util.stream.Collectors;
+
+import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
+
+@CrossOrigin
+public class CustomAuthenticationFilter extends UsernamePasswordAuthenticationFilter {
+    private final AuthenticationManager authenticationManager;
+
+    public CustomAuthenticationFilter(AuthenticationManager authenticationManager) {
+        this.authenticationManager = authenticationManager;
+    }
+
+    @Override
+    public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException {
+        String username = request.getParameter("username");
+        String password = request.getParameter("password");
+        UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(username, password);
+        return authenticationManager.authenticate(authenticationToken);
+    }
+
+    @Override
+    protected void successfulAuthentication(HttpServletRequest request, HttpServletResponse response, FilterChain chain, Authentication authentication) throws IOException, ServletException {
+        Object principal = authentication.getPrincipal();
+        String className = principal.getClass().getName().split("\\.")[2];
+        String email=null;
+        Collection<? extends GrantedAuthority> roles= new ArrayList<>();
+        switch (className) {
+            case "RegisteredUser": {
+                RegisteredUser user = (RegisteredUser) authentication.getPrincipal();
+                email = user.getEmail();
+                roles = user.getAuthorities();
+                break;
+            }
+            case "Worker": {
+                Worker user = (Worker) authentication.getPrincipal();
+                email = user.getEmail();
+                roles = user.getAuthorities();
+                break;
+            }
+            case "Administrator": {
+                Administrator user = (Administrator) authentication.getPrincipal();
+                email = user.getEmail();
+                roles = user.getAuthorities();
+                break;
+            }
+        }
+        //TODO see if guest needs to go through authentication
+        Algorithm algorithm = Algorithm.HMAC256("secret".getBytes());
+        String access_token = JWT.create()
+                .withSubject(email)
+                .withExpiresAt(new Date(System.currentTimeMillis() + 60 * 60 * 1000))
+                .withIssuer(request.getRequestURL().toString())
+                .withClaim("roles", roles.stream().map(GrantedAuthority::getAuthority).collect(Collectors.toList()))
+                .sign(algorithm);
+//        String refresh_token = JWT.create()
+//                .withSubject(user.getUsername())
+//                .withExpiresAt(new Date(System.currentTimeMillis() + 30 * 60 * 1000))
+//                .withIssuer(request.getRequestURL().toString())
+//                .sign(algorithm);
+        Map<String, String> tokens = new HashMap<>();
+        tokens.put("access_token", access_token);
+//        tokens.put("refresh_token", refresh_token);
+        response.setContentType(APPLICATION_JSON_VALUE);
+        new ObjectMapper().writeValue(response.getOutputStream(), tokens);
+    }
+}
Index: sources/app/src/main/java/parkup/configs/CustomAuthorizationFilter.java
===================================================================
--- sources/app/src/main/java/parkup/configs/CustomAuthorizationFilter.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
+++ sources/app/src/main/java/parkup/configs/CustomAuthorizationFilter.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -0,0 +1,68 @@
+package parkup.configs;
+
+import com.auth0.jwt.JWT;
+import com.auth0.jwt.JWTVerifier;
+import com.auth0.jwt.algorithms.Algorithm;
+import com.auth0.jwt.interfaces.DecodedJWT;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
+import org.springframework.security.core.authority.SimpleGrantedAuthority;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.util.MimeTypeUtils;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.filter.OncePerRequestFilter;
+
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import static java.util.Arrays.stream;
+import static org.springframework.http.HttpHeaders.AUTHORIZATION;
+import static org.springframework.http.HttpStatus.FORBIDDEN;
+
+
+@CrossOrigin
+public class CustomAuthorizationFilter extends OncePerRequestFilter {
+    @Override
+    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
+        if(request.getServletPath().equals("/api/login") || request.getServletPath().equals("/api/token/refresh")) {
+            filterChain.doFilter(request, response);
+        } else {
+            String authorizationHeader = request.getHeader(AUTHORIZATION);
+            if(authorizationHeader != null && authorizationHeader.startsWith("Bearer ")) {
+                try {
+                    String token = authorizationHeader.substring("Bearer ".length());
+                    Algorithm algorithm = Algorithm.HMAC256("secret".getBytes());
+                    JWTVerifier verifier = JWT.require(algorithm).build();
+                    DecodedJWT decodedJWT = verifier.verify(token);
+                    String username = decodedJWT.getSubject();
+                    String[] roles = decodedJWT.getClaim("roles").asArray(String.class);
+                    Collection<SimpleGrantedAuthority> authorities = new ArrayList<>();
+                    stream(roles).forEach(role -> {
+                        authorities.add(new SimpleGrantedAuthority(role));
+                    });
+                    UsernamePasswordAuthenticationToken authenticationToken =
+                            new UsernamePasswordAuthenticationToken(username, null, authorities);
+                    SecurityContextHolder.getContext().setAuthentication(authenticationToken);
+                    filterChain.doFilter(request, response);
+                }catch (Exception exception) {
+                    response.setHeader("error", exception.getMessage());
+                    response.setStatus(FORBIDDEN.value());
+                    //response.sendError(FORBIDDEN.value());
+                    Map<String, String> error = new HashMap<>();
+                    error.put("error_message", exception.getMessage());
+                    response.setContentType(MimeTypeUtils.APPLICATION_JSON_VALUE);
+                    new ObjectMapper().writeValue(response.getOutputStream(), error);
+                }
+            } else {
+                filterChain.doFilter(request, response);
+            }
+        }
+    }
+}
Index: sources/app/src/main/java/parkup/configs/RegistrationServiceRP.java
===================================================================
--- sources/app/src/main/java/parkup/configs/RegistrationServiceRP.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ sources/app/src/main/java/parkup/configs/RegistrationServiceRP.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -3,10 +3,11 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import parkup.configs.email.EmailSender;
+import parkup.configs.email.EmailService;
 import parkup.configs.email.EmailValidator;
+import parkup.configs.email.Mail;
 import parkup.configs.token.ConfirmationTokenRP;
 import parkup.configs.token.ConfirmationTokenService;
-import parkup.entities.RegistriranParkirac;
-import parkup.services.RegistriranParkiracService;
+import parkup.entities.RegisteredUser;
+import parkup.services.RegisteredUserService;
 
 import javax.transaction.Transactional;
@@ -15,19 +16,21 @@
 @Service
 public class RegistrationServiceRP {
-    private final RegistriranParkiracService registriranParkiracService;
+    private final RegisteredUserService registeredUserService;
     private final EmailValidator emailValidator;
     private final ConfirmationTokenService confirmationTokenService;
-    private final EmailSender emailSender;
+    private final EmailService emailService;
 
     @Autowired
-    public RegistrationServiceRP(RegistriranParkiracService registriranParkiracService, EmailValidator emailValidator,
-                                 ConfirmationTokenService confirmationTokenService, EmailSender emailSender) {
-        this.registriranParkiracService = registriranParkiracService;
+    public RegistrationServiceRP(RegisteredUserService registeredUserService, EmailValidator emailValidator,
+                                 ConfirmationTokenService confirmationTokenService, EmailService emailService) {
+        this.registeredUserService = registeredUserService;
         this.emailValidator = emailValidator;
         this.confirmationTokenService = confirmationTokenService;
-        this.emailSender = emailSender;
+        this.emailService = emailService;
     }
 
     public String register(RegistrationRequest request) {
+        if (request.getEmail() == null || request.getEmail().isEmpty())
+            throw new IllegalArgumentException("Missing email");
         boolean isValidEmail = emailValidator.
                 test(request.getEmail());
@@ -37,6 +40,6 @@
         }
 
-        String token = registriranParkiracService.signUpRegistriranParkirac(
-                new RegistriranParkirac(
+        String token = registeredUserService.signUpRegistriranParkirac(
+                new RegisteredUser(
                         request.getFirstName(),
                         request.getLastName(),
@@ -48,8 +51,10 @@
 
         String link = "http://localhost:8080/registriranParkirac/registration/confirm?token=" + token;
-        emailSender.send(
-                request.getEmail(),
-                buildEmail(request.getFirstName(), link));
-
+        Mail mail = new Mail();
+        mail.setMailTo(request.getEmail());
+        mail.setMailFrom("noreply_explore_buddy@gmail.com");
+        mail.setMailSubject("Account confirmation");
+        mail.setMailContent(buildEmail(request.getEmail(), link));
+        emailService.sendEmail(mail);
         return token;
     }
@@ -74,5 +79,5 @@
         confirmationTokenService.setConfirmedAtRP(token);
 
-        registriranParkiracService.enableRegistriranParkirac(confirmationTokenRP.getRegistriranParkirac().getEmail());
+        registeredUserService.enableRegistriranParkirac(confirmationTokenRP.getRegistriranParkirac().getEmail());
         return "confirmed";
     }
Index: sources/app/src/main/java/parkup/configs/RegistrationServiceW.java
===================================================================
--- sources/app/src/main/java/parkup/configs/RegistrationServiceW.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ 	(revision )
@@ -1,148 +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.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/email/EmailSender.java
===================================================================
--- sources/app/src/main/java/parkup/configs/email/EmailSender.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ 	(revision )
@@ -1,5 +1,0 @@
-package parkup.configs.email;
-
-public interface EmailSender {
-    void send(String to, String email);
-}
Index: sources/app/src/main/java/parkup/configs/email/EmailService.java
===================================================================
--- sources/app/src/main/java/parkup/configs/email/EmailService.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ sources/app/src/main/java/parkup/configs/email/EmailService.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -1,41 +1,38 @@
 package parkup.configs.email;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.mail.javamail.JavaMailSender;
 import org.springframework.mail.javamail.MimeMessageHelper;
-import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 
 import javax.mail.MessagingException;
+import javax.mail.internet.InternetAddress;
 import javax.mail.internet.MimeMessage;
+import java.io.UnsupportedEncodingException;
 
-@Service
-public class EmailService implements EmailSender{
+@Service("mailService")
+public class EmailService implements MailService {
 
-    private final static Logger LOGGER = LoggerFactory.getLogger(EmailService.class);
-    private final JavaMailSender mailSender;
+    @Autowired
+    JavaMailSender mailSender;
 
-    public EmailService(JavaMailSender mailSender) {
-        this.mailSender = mailSender;
+    public void sendEmail(Mail mail) {
+        MimeMessage mimeMessage = mailSender.createMimeMessage();
+
+        try {
+
+            MimeMessageHelper mimeMessageHelper = new MimeMessageHelper(mimeMessage, true);
+
+            mimeMessageHelper.setSubject(mail.getMailSubject());
+            mimeMessageHelper.setFrom(new InternetAddress(mail.getMailFrom(), "parkUp.com"));
+            mimeMessageHelper.setTo(mail.getMailTo());
+            mimeMessageHelper.setText(mail.getMailContent(), true);
+
+            mailSender.send(mimeMessageHelper.getMimeMessage());
+
+        } catch (MessagingException | UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
     }
 
-    @Override
-    @Async
-    public void send(String to, String email) {
-        try {
-            MimeMessage mimeMessage = mailSender.createMimeMessage();
-            MimeMessageHelper helper =
-                    new MimeMessageHelper(mimeMessage, "utf-8");
-            helper.setText(email, true);
-            helper.setTo(to);
-            helper.setSubject("Confirm your email");
-            helper.setFrom("parkup@gmail.com");
-            mailSender.send(mimeMessage);
-        } catch (MessagingException e) {
-            LOGGER.error("failed to send email", e);
-            throw new IllegalStateException("failed to send email");
-        }
-    }
 }
-
Index: sources/app/src/main/java/parkup/configs/email/EmailValidator.java
===================================================================
--- sources/app/src/main/java/parkup/configs/email/EmailValidator.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ sources/app/src/main/java/parkup/configs/email/EmailValidator.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -1,7 +1,9 @@
 package parkup.configs.email;
+
 
 import org.springframework.stereotype.Service;
 
 import java.util.function.Predicate;
+import java.util.regex.Pattern;
 
 @Service
@@ -9,6 +11,6 @@
     @Override
     public boolean test(String s) {
-        //todo
-        return true;
+        String regexPattern = "^[a-zA-Z0-9_!#$%&'*+/=?`{|}~^.-]+@[a-zA-Z0-9.-]+$";
+        return Pattern.compile(regexPattern).matcher(s).matches();
     }
 }
Index: sources/app/src/main/java/parkup/configs/email/Mail.java
===================================================================
--- sources/app/src/main/java/parkup/configs/email/Mail.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
+++ sources/app/src/main/java/parkup/configs/email/Mail.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -0,0 +1,96 @@
+package parkup.configs.email;
+
+import java.util.Date;
+import java.util.List;
+
+public class Mail {
+
+    private String mailFrom;
+
+    private String mailTo;
+
+    private String mailCc;
+
+    private String mailBcc;
+
+    private String mailSubject;
+
+    private String mailContent;
+
+    private String contentType;
+
+    private List < Object > attachments;
+
+    public Mail() {
+        contentType = "text/plain";
+    }
+
+    public String getContentType() {
+        return contentType;
+    }
+
+    public void setContentType(String contentType) {
+        this.contentType = contentType;
+    }
+
+    public String getMailBcc() {
+        return mailBcc;
+    }
+
+    public void setMailBcc(String mailBcc) {
+        this.mailBcc = mailBcc;
+    }
+
+    public String getMailCc() {
+        return mailCc;
+    }
+
+    public void setMailCc(String mailCc) {
+        this.mailCc = mailCc;
+    }
+
+    public String getMailFrom() {
+        return mailFrom;
+    }
+
+    public void setMailFrom(String mailFrom) {
+        this.mailFrom = mailFrom;
+    }
+
+    public String getMailSubject() {
+        return mailSubject;
+    }
+
+    public void setMailSubject(String mailSubject) {
+        this.mailSubject = mailSubject;
+    }
+
+    public String getMailTo() {
+        return mailTo;
+    }
+
+    public void setMailTo(String mailTo) {
+        this.mailTo = mailTo;
+    }
+
+    public Date getMailSendDate() {
+        return new Date();
+    }
+
+    public String getMailContent() {
+        return mailContent;
+    }
+
+    public void setMailContent(String mailContent) {
+        this.mailContent = mailContent;
+    }
+
+    public List < Object > getAttachments() {
+        return attachments;
+    }
+
+    public void setAttachments(List < Object > attachments) {
+        this.attachments = attachments;
+    }
+
+}
Index: sources/app/src/main/java/parkup/configs/email/MailConfig.java
===================================================================
--- sources/app/src/main/java/parkup/configs/email/MailConfig.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
+++ sources/app/src/main/java/parkup/configs/email/MailConfig.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -0,0 +1,36 @@
+package parkup.configs.email;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.env.Environment;
+import org.springframework.mail.javamail.JavaMailSender;
+import org.springframework.mail.javamail.JavaMailSenderImpl;
+
+import java.util.Properties;
+
+@Configuration
+public class MailConfig {
+
+    @Autowired
+    private Environment env;
+
+    @Bean
+    public JavaMailSender getMailSender() {
+        JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
+
+        mailSender.setHost(env.getProperty("spring.mail.host"));
+        mailSender.setPort(Integer.valueOf(env.getProperty("spring.mail.port")));
+        mailSender.setUsername(env.getProperty("spring.mail.username"));
+        mailSender.setPassword(env.getProperty("spring.mail.password"));
+
+        Properties javaMailProperties = new Properties();
+        javaMailProperties.put("mail.smtp.starttls.enable", "true");
+        javaMailProperties.put("mail.smtp.auth", "true");
+        javaMailProperties.put("mail.transport.protocol", "smtp");
+        javaMailProperties.put("mail.debug", "true");
+
+        mailSender.setJavaMailProperties(javaMailProperties);
+        return mailSender;
+    }
+}
Index: sources/app/src/main/java/parkup/configs/email/MailService.java
===================================================================
--- sources/app/src/main/java/parkup/configs/email/MailService.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
+++ sources/app/src/main/java/parkup/configs/email/MailService.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -0,0 +1,5 @@
+package parkup.configs.email;
+
+public interface MailService {
+        public void sendEmail(Mail mail);
+}
Index: sources/app/src/main/java/parkup/configs/token/ConfirmationTokenRP.java
===================================================================
--- sources/app/src/main/java/parkup/configs/token/ConfirmationTokenRP.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ sources/app/src/main/java/parkup/configs/token/ConfirmationTokenRP.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -1,5 +1,5 @@
 package parkup.configs.token;
 
-import parkup.entities.RegistriranParkirac;
+import parkup.entities.RegisteredUser;
 
 import javax.persistence.*;
@@ -37,21 +37,21 @@
     @JoinColumn(nullable = false, name = "registriranParkirac_id")
     //many confirmation tokens to one registriranParkirac
-    private RegistriranParkirac registriranParkirac;
+    private RegisteredUser registeredUser;
 
     public ConfirmationTokenRP() {}
 
-    public ConfirmationTokenRP(int id, String token, LocalDateTime createdAt, LocalDateTime expiresAt, RegistriranParkirac registriranParkirac) {
+    public ConfirmationTokenRP(int id, String token, LocalDateTime createdAt, LocalDateTime expiresAt, RegisteredUser registeredUser) {
         this.id = id;
         this.token = token;
         this.createdAt = createdAt;
         this.expiresAt = expiresAt;
-        this.registriranParkirac = registriranParkirac;
+        this.registeredUser = registeredUser;
     }
 
-    public ConfirmationTokenRP(String token, LocalDateTime createdAt, LocalDateTime expiresAt, RegistriranParkirac registriranParkirac) {
+    public ConfirmationTokenRP(String token, LocalDateTime createdAt, LocalDateTime expiresAt, RegisteredUser registeredUser) {
         this.token = token;
         this.createdAt = createdAt;
         this.expiresAt = expiresAt;
-        this.registriranParkirac = registriranParkirac;
+        this.registeredUser = registeredUser;
     }
 
@@ -96,10 +96,10 @@
     }
 
-    public RegistriranParkirac getRegistriranParkirac() {
-        return registriranParkirac;
+    public RegisteredUser getRegistriranParkirac() {
+        return registeredUser;
     }
 
-    public void setRegistriranParkirac(RegistriranParkirac registriranParkirac) {
-        this.registriranParkirac = registriranParkirac;
+    public void setRegistriranParkirac(RegisteredUser registeredUser) {
+        this.registeredUser = registeredUser;
     }
 }
Index: sources/app/src/main/java/parkup/configs/token/ConfirmationTokenRepositoryRP.java
===================================================================
--- sources/app/src/main/java/parkup/configs/token/ConfirmationTokenRepositoryRP.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ sources/app/src/main/java/parkup/configs/token/ConfirmationTokenRepositoryRP.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -15,5 +15,5 @@
     Optional<ConfirmationTokenRP> findByToken(String token);
 
-    void deleteByRegistriranParkirac_RegParkId(int regParkId);
+    void deleteByRegisteredUser_RegParkId(int regParkId);
 
     @Transactional
Index: sources/app/src/main/java/parkup/configs/token/ConfirmationTokenRepositoryW.java
===================================================================
--- sources/app/src/main/java/parkup/configs/token/ConfirmationTokenRepositoryW.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ 	(revision )
@@ -1,25 +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 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 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ sources/app/src/main/java/parkup/configs/token/ConfirmationTokenService.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -10,10 +10,8 @@
 
     private final ConfirmationTokenRepositoryRP confirmationTokenRepositoryRP;
-    private final ConfirmationTokenRepositoryW confirmationTokenRepositoryW;
 
 
-    public ConfirmationTokenService(ConfirmationTokenRepositoryRP confirmationTokenRepositoryRP, ConfirmationTokenRepositoryW confirmationTokenRepositoryW, parkup.configs.token.ConfirmationTokenRepositoryW confirmationTokenRepositoryW1) {
+    public ConfirmationTokenService(ConfirmationTokenRepositoryRP confirmationTokenRepositoryRP) {
         this.confirmationTokenRepositoryRP = confirmationTokenRepositoryRP;
-        this.confirmationTokenRepositoryW = confirmationTokenRepositoryW1;
     }
     public void saveConfirmationTokenRP(ConfirmationTokenRP token){
@@ -21,20 +19,11 @@
     }
 
-    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 void deleteByVraboten_VrabotenId(int vraboten_id){
-        confirmationTokenRepositoryW.deleteByVraboten_VrabotenId(vraboten_id);
-    }
-
-    public void deleteByRegistriranParkirac_RegParkId(int regParkId){
-        confirmationTokenRepositoryRP.deleteByRegistriranParkirac_RegParkId(regParkId);
+    public void deleteByRegisteredUser_RegParkId(int regParkId){
+        confirmationTokenRepositoryRP.deleteByRegisteredUser_RegParkId(regParkId);
     }
 
@@ -42,6 +31,3 @@
         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 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ 	(revision )
@@ -1,105 +1,0 @@
-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/configs/webConfigs/WebSecurityConfig.java
===================================================================
--- sources/app/src/main/java/parkup/configs/webConfigs/WebSecurityConfig.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ sources/app/src/main/java/parkup/configs/webConfigs/WebSecurityConfig.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -3,5 +3,5 @@
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
+import org.springframework.security.authentication.AuthenticationManager;
 import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
 import org.springframework.security.config.annotation.web.builders.HttpSecurity;
@@ -9,52 +9,58 @@
 import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
-import parkup.services.RegistriranParkiracService;
-import parkup.services.VrabotenService;
+import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
+import org.springframework.web.cors.CorsConfiguration;
+import parkup.configs.CustomAuthenticationFilter;
+import parkup.configs.CustomAuthorizationFilter;
+import parkup.services.AdministratorService;
+import parkup.services.RegisteredUserService;
+import parkup.services.WorkerService;
+
+import static org.springframework.security.config.http.SessionCreationPolicy.STATELESS;
 
 @EnableWebSecurity
 @Configuration
 public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
-        private final VrabotenService vrabotenService;
+        private final WorkerService workerService;
         private final BCryptPasswordEncoder bCryptPasswordEncoder;
-        private final RegistriranParkiracService registriranParkiracService;
+        private final RegisteredUserService registeredUserService;
+        private final AdministratorService administratorService;
 
-        public WebSecurityConfig(VrabotenService vrabotenService, BCryptPasswordEncoder bCryptPasswordEncoder, RegistriranParkiracService registriranParkiracService) {
-            this.vrabotenService = vrabotenService;
+        public WebSecurityConfig(WorkerService workerService, BCryptPasswordEncoder bCryptPasswordEncoder, RegisteredUserService registeredUserService, AdministratorService administratorService) {
+            this.workerService = workerService;
             this.bCryptPasswordEncoder = bCryptPasswordEncoder;
-            this.registriranParkiracService = registriranParkiracService;
+            this.registeredUserService = registeredUserService;
+            this.administratorService = administratorService;
+        }
+
+        @Override
+        protected void configure(AuthenticationManagerBuilder auth) throws Exception {
+            auth.userDetailsService(registeredUserService).passwordEncoder(bCryptPasswordEncoder);
+            auth.userDetailsService(workerService).passwordEncoder(bCryptPasswordEncoder);
+            auth.userDetailsService(administratorService).passwordEncoder(bCryptPasswordEncoder);
         }
 
         @Override
         protected void configure(HttpSecurity http) throws Exception {
-            http
-                    .csrf().disable()
-                    .authorizeRequests()
-                        .antMatchers("/registriranParkirac/registration/**")
-                        .permitAll()
-                    .anyRequest()
-                    .authenticated().and().formLogin();//ruta na viktor
-        }
-
-        @Override
-        protected void configure(AuthenticationManagerBuilder auth) throws Exception {
-            auth.authenticationProvider(daoAuthenticationProviderW());
-            auth.authenticationProvider(daoAuthenticationProviderRP());
+            CustomAuthenticationFilter customAuthenticationFilter = new CustomAuthenticationFilter(authenticationManagerBean());
+            customAuthenticationFilter.setFilterProcessesUrl("/api/login");
+            http.csrf().disable();
+            http.cors().configurationSource(request -> new CorsConfiguration().applyPermitDefaultValues());
+            http.sessionManagement().sessionCreationPolicy(STATELESS);
+            http.authorizeRequests().antMatchers("/**").permitAll();
+//            http.authorizeRequests().antMatchers("/user/registration/**", "/home/markers","/home/getLocation/**","/api/login/**","/home").permitAll();
+//            http.authorizeRequests().antMatchers( "/user/setFavourite/**","user/favourites").hasAuthority("ROLE_USER");
+//            http.authorizeRequests().antMatchers( "/home/**").hasAuthority("ROLE_ADMIN");
+//            http.authorizeRequests().anyRequest().authenticated();
+            http.addFilter(customAuthenticationFilter);
+            http.addFilterBefore(new CustomAuthorizationFilter(), UsernamePasswordAuthenticationFilter.class);
         }
 
         @Bean
-        public DaoAuthenticationProvider daoAuthenticationProviderW() {
-            DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
-            provider.setPasswordEncoder(bCryptPasswordEncoder);
-            provider.setUserDetailsService(vrabotenService);
-            return provider;
+        @Override
+        public AuthenticationManager authenticationManagerBean() throws Exception {
+            return super.authenticationManagerBean();
         }
 
-        @Bean
-        public DaoAuthenticationProvider daoAuthenticationProviderRP(){
-            DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
-            provider.setPasswordEncoder(bCryptPasswordEncoder);
-            provider.setUserDetailsService(registriranParkiracService);
-            return provider;
-        }
 
     }
Index: sources/app/src/main/java/parkup/controllers/ParkingSessionController.java
===================================================================
--- sources/app/src/main/java/parkup/controllers/ParkingSessionController.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ sources/app/src/main/java/parkup/controllers/ParkingSessionController.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -3,5 +3,4 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import parkup.data.Tablicka;
 import parkup.entities.ParkingSession;
 import parkup.services.ParkingSessionService;
Index: sources/app/src/main/java/parkup/controllers/ParkingZoneController.java
===================================================================
--- sources/app/src/main/java/parkup/controllers/ParkingZoneController.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ sources/app/src/main/java/parkup/controllers/ParkingZoneController.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -53,5 +53,5 @@
         return this.parkingZoneService.updateParkingZone(parkingZoneId, parkingZone.getPzName(), parkingZone.getPrice(),
                 parkingZone.getAddress(), parkingZone.getTime_from(), parkingZone.getTime_to(), parkingZone.getColor(),
-                parkingZone.getParkingSpaces(), parkingZone.getParkingZoneLocation(),parkingZone.getOdgovorniLica());
+                parkingZone.getParkingSpaces(), parkingZone.getParkingZoneLocation(),parkingZone.getResponsibleWorkers());
 
     }
Index: sources/app/src/main/java/parkup/controllers/RegistriranParkiracController.java
===================================================================
--- sources/app/src/main/java/parkup/controllers/RegistriranParkiracController.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ sources/app/src/main/java/parkup/controllers/RegistriranParkiracController.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -8,26 +8,26 @@
 import parkup.configs.RegistrationRequest;
 import parkup.configs.RegistrationServiceRP;
-import parkup.entities.RegistriranParkirac;
-import parkup.services.RegistriranParkiracService;
+import parkup.entities.RegisteredUser;
+import parkup.services.RegisteredUserService;
 
 @RestController
 public class RegistriranParkiracController {
-    private final RegistriranParkiracService registriranParkiracService;
+    private final RegisteredUserService registeredUserService;
     private final RegistrationServiceRP registrationServiceRP;
 
     @Autowired
-    public RegistriranParkiracController(RegistriranParkiracService registriranParkiracService, RegistrationServiceRP registrationServiceRP) {
-        this.registriranParkiracService = registriranParkiracService;
+    public RegistriranParkiracController(RegisteredUserService registeredUserService, RegistrationServiceRP registrationServiceRP) {
+        this.registeredUserService = registeredUserService;
         this.registrationServiceRP = registrationServiceRP;
     }
 
     @GetMapping({"/registriranParkirac"})
-    public List<RegistriranParkirac> getAllRegistriraniParkiraci() {
-        return this.registriranParkiracService.getRegPark();
+    public List<RegisteredUser> getAllRegistriraniParkiraci() {
+        return this.registeredUserService.getRegPark();
     }
 
     @GetMapping({"/registriranParkirac/{regParkId}"})
-    public RegistriranParkirac getRegistriranParkirac(@PathVariable int regParkId) {
-        RegistriranParkirac regPark = this.registriranParkiracService.findById(regParkId);
+    public RegisteredUser getRegistriranParkirac(@PathVariable int regParkId) {
+        RegisteredUser regPark = this.registeredUserService.findById(regParkId);
         if (regPark != null) {
             return regPark;
@@ -38,16 +38,16 @@
 
     @PostMapping({"/registriranParkirac"})
-    public Optional<RegistriranParkirac> addRegistriranParkirac(@RequestBody RegistriranParkirac regPark) {
-        return this.registriranParkiracService.addRegPark(regPark);
+    public Optional<RegisteredUser> addRegistriranParkirac(@RequestBody RegisteredUser regPark) {
+        return this.registeredUserService.addRegPark(regPark);
     }
 
     @PutMapping({"/registriranParkirac/{regParkId}"})
-    public RegistriranParkirac updateRegistriranParkirac(@PathVariable int regParkId, @RequestBody RegistriranParkirac regPark) {
-        return this.registriranParkiracService.updateRegPark(regParkId, regPark.getName(), regPark.getSurname(), regPark.getMobile(), regPark.getEmail(),regPark.getRegTablicki());
+    public RegisteredUser updateRegistriranParkirac(@PathVariable int regParkId, @RequestBody RegisteredUser regPark) {
+        return this.registeredUserService.updateRegPark(regParkId, regPark.getName(), regPark.getSurname(), regPark.getMobile(), regPark.getEmail(),regPark.getPlates());
     }
 
     @DeleteMapping({"/registriranParkirac/{regParkId}"})
-    public Optional<RegistriranParkirac> deleteRegistriranParkirac(@PathVariable int regParkId) {
-        return this.registriranParkiracService.deleteRegPark(regParkId);
+    public Optional<RegisteredUser> deleteRegistriranParkirac(@PathVariable int regParkId) {
+        return this.registeredUserService.deleteRegPark(regParkId);
     }
 
Index: sources/app/src/main/java/parkup/controllers/VrabotenController.java
===================================================================
--- sources/app/src/main/java/parkup/controllers/VrabotenController.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ sources/app/src/main/java/parkup/controllers/VrabotenController.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -3,34 +3,32 @@
 import java.util.List;
 import java.util.Optional;
-import java.util.stream.Collectors;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import parkup.configs.RegistrationRequest;
 //import parkup.configs.RegistrationServiceW;
-import parkup.data.AddUpdateVraboten;
-import parkup.data.enumarations.EmployeeStatus;
-import parkup.entities.Vraboten;
-import parkup.services.VrabotenService;
-import parkup.data.VrabotenDemo;
+import parkup.data.AddUpdateWorker;
+import parkup.data.WorkerDemoParkingZones;
+import parkup.entities.Worker;
+import parkup.services.WorkerService;
+import parkup.data.WorkerDemo;
 
 @RestController
 public class VrabotenController {
-    private final VrabotenService vrabotenService;
+    private final WorkerService workerService;
 //    private final RegistrationServiceW registrationServiceW;
 
     @Autowired
-    public VrabotenController(VrabotenService vrabotenService) {
-        this.vrabotenService = vrabotenService;
+    public VrabotenController(WorkerService workerService) {
+        this.workerService = workerService;
     }
 
     @GetMapping({"/vraboten"})
-    public List<Vraboten> getAllVraboten() {
-        return this.vrabotenService.getVraboteni();
+    public List<Worker> getAllVraboten() {
+        return this.workerService.getWorkers();
     }
 
     @GetMapping({"/vraboten/{vrabotenId}"})
-    public Vraboten getVraboten(@PathVariable int vrabotenId) {
-        Vraboten vraboten = this.vrabotenService.findById(vrabotenId);
+    public WorkerDemoParkingZones getVraboten(@PathVariable int vrabotenId) {
+        WorkerDemoParkingZones vraboten = this.workerService.findById(vrabotenId);
         if (vraboten != null) {
             return vraboten;
@@ -41,11 +39,11 @@
 
     @GetMapping({"/vraboten/vrabotenDemo"})
-    public List<VrabotenDemo> getVraboteniDemos(){
-        return this.vrabotenService.getAllVraboteniDemos();
+    public List<WorkerDemo> getVraboteniDemos(){
+        return this.workerService.getAllVraboteniDemos();
     }
 
     @PostMapping({"/vraboten"})
-    public Optional<Vraboten> addVraboten(@RequestBody AddUpdateVraboten vraboten) {
-        return this.vrabotenService.addVraboten(vraboten.getPassword(), vraboten.getConfirmPass(), vraboten.isLocked(),vraboten.getFirstName(), vraboten.getLastName(),
+    public Optional<Worker> addVraboten(@RequestBody AddUpdateWorker vraboten) {
+        return this.workerService.addWorker(vraboten.getPassword(), vraboten.getConfirmPass(), vraboten.isLocked(),vraboten.getFirstName(), vraboten.getLastName(),
                 vraboten.getMobileNumber(), vraboten.getEmail(), vraboten.getStatus(),vraboten.getParkingZones());
     }
@@ -53,5 +51,5 @@
     @PutMapping({"/vraboten/lock/{vrabotenId}"})
     public void lockVraboten(@PathVariable int vrabotenId) {
-        this.vrabotenService.lockVrabotenAcc(vrabotenId);
+        this.workerService.lockWorkerAcc(vrabotenId);
     }
 
@@ -62,12 +60,12 @@
 
     @PutMapping({"/vraboten/{vrabotenId}"})
-    public Vraboten updateVraboten(@PathVariable int vrabotenId, @RequestBody AddUpdateVraboten vraboten) {
-        return this.vrabotenService.updateVraboten(vrabotenId,vraboten.getPassword(), vraboten.getConfirmPass(), vraboten.isLocked(),vraboten.getFirstName(), vraboten.getLastName(),
+    public WorkerDemoParkingZones updateVraboten(@PathVariable int vrabotenId, @RequestBody AddUpdateWorker vraboten) {
+        return this.workerService.updateWorker(vrabotenId,vraboten.getPassword(), vraboten.getConfirmPass(), vraboten.isLocked(),vraboten.getFirstName(), vraboten.getLastName(),
                 vraboten.getMobileNumber(), vraboten.getEmail(), vraboten.getStatus(),vraboten.getParkingZones());
     }
 
     @DeleteMapping({"/vraboten/{vrabotenId}"})
-    public Optional<Vraboten> deleteVraboten(@PathVariable int vrabotenId) {
-        return this.vrabotenService.deleteVraboten(vrabotenId);
+    public Optional<Worker> deleteVraboten(@PathVariable int vrabotenId) {
+        return this.workerService.deleteWorker(vrabotenId);
     }
 
Index: sources/app/src/main/java/parkup/data/AddUpdateVraboten.java
===================================================================
--- sources/app/src/main/java/parkup/data/AddUpdateVraboten.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ 	(revision )
@@ -1,102 +1,0 @@
-package parkup.data;
-
-import parkup.data.enumarations.EmployeeStatus;
-
-import java.util.List;
-
-public class AddUpdateVraboten {
-    String firstName;
-    String lastName;
-    String email;
-    String password;
-    String confirmPass;
-    List<String> parkingZones;
-    EmployeeStatus status;
-    String mobileNumber;
-    boolean locked;
-
-    public AddUpdateVraboten(String firstName, String lastName, String email, String password, String confirmPass, List<String> parkingZones, EmployeeStatus status, String mobileNumber, boolean locked) {
-        this.firstName = firstName;
-        this.lastName = lastName;
-        this.email = email;
-        this.password = password;
-        this.confirmPass = confirmPass;
-        this.parkingZones = parkingZones;
-        this.status = status;
-        this.mobileNumber = mobileNumber;
-        this.locked = locked;
-    }
-
-    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;
-    }
-
-    public String getPassword() {
-        return password;
-    }
-
-    public void setPassword(String password) {
-        this.password = password;
-    }
-
-    public String getConfirmPass() {
-        return confirmPass;
-    }
-
-    public void setConfirmPass(String confirmPass) {
-        this.confirmPass = confirmPass;
-    }
-
-    public List<String> getParkingZones() {
-        return parkingZones;
-    }
-
-    public void setParkingZones(List<String> parkingZones) {
-        this.parkingZones = parkingZones;
-    }
-
-    public EmployeeStatus getStatus() {
-        return status;
-    }
-
-    public void setStatus(EmployeeStatus status) {
-        this.status = status;
-    }
-
-    public String getMobileNumber() {
-        return mobileNumber;
-    }
-
-    public void setMobileNumber(String mobileNumber) {
-        this.mobileNumber = mobileNumber;
-    }
-
-    public boolean isLocked() {
-        return locked;
-    }
-
-    public void setLocked(boolean locked) {
-        this.locked = locked;
-    }
-}
-
Index: sources/app/src/main/java/parkup/data/AddUpdateWorker.java
===================================================================
--- sources/app/src/main/java/parkup/data/AddUpdateWorker.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
+++ sources/app/src/main/java/parkup/data/AddUpdateWorker.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -0,0 +1,102 @@
+package parkup.data;
+
+import parkup.data.enumarations.EmployeeStatus;
+
+import java.util.List;
+
+public class AddUpdateWorker {
+    String firstName;
+    String lastName;
+    String email;
+    String password;
+    String confirmPass;
+    List<String> parkingZones;
+    EmployeeStatus status;
+    String mobileNumber;
+    boolean locked;
+
+    public AddUpdateWorker(String firstName, String lastName, String email, String password, String confirmPass, List<String> parkingZones, EmployeeStatus status, String mobileNumber, boolean locked) {
+        this.firstName = firstName;
+        this.lastName = lastName;
+        this.email = email;
+        this.password = password;
+        this.confirmPass = confirmPass;
+        this.parkingZones = parkingZones;
+        this.status = status;
+        this.mobileNumber = mobileNumber;
+        this.locked = locked;
+    }
+
+    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;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public String getConfirmPass() {
+        return confirmPass;
+    }
+
+    public void setConfirmPass(String confirmPass) {
+        this.confirmPass = confirmPass;
+    }
+
+    public List<String> getParkingZones() {
+        return parkingZones;
+    }
+
+    public void setParkingZones(List<String> parkingZones) {
+        this.parkingZones = parkingZones;
+    }
+
+    public EmployeeStatus getStatus() {
+        return status;
+    }
+
+    public void setStatus(EmployeeStatus status) {
+        this.status = status;
+    }
+
+    public String getMobileNumber() {
+        return mobileNumber;
+    }
+
+    public void setMobileNumber(String mobileNumber) {
+        this.mobileNumber = mobileNumber;
+    }
+
+    public boolean isLocked() {
+        return locked;
+    }
+
+    public void setLocked(boolean locked) {
+        this.locked = locked;
+    }
+}
+
Index: sources/app/src/main/java/parkup/data/Location.java
===================================================================
--- sources/app/src/main/java/parkup/data/Location.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ sources/app/src/main/java/parkup/data/Location.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -19,29 +19,29 @@
     private int locationId;
 
-    private float longitude;
+    private float lng;
 
-    private float latitude;
+    private float lat;
 
     public Location(){}
 
-    public Location(float longtitude, float latitude) {
-        this.longitude = longtitude;
-        this.latitude = latitude;
+    public Location(float lng, float lat) {
+        this.lng = lng;
+        this.lat = lat;
     }
 
-    public float getLongitude() {
-        return longitude;
+    public float getLng() {
+        return lng;
     }
 
-    public void setLongitude(float longitude) {
-        this.longitude = longitude;
+    public void setLng(float lng) {
+        this.lng = lng;
     }
 
-    public float getLatitude() {
-        return latitude;
+    public float getLat() {
+        return lat;
     }
 
-    public void setLatitude(float latitude) {
-        this.latitude = latitude;
+    public void setLat(float lat) {
+        this.lat = lat;
     }
 }
Index: sources/app/src/main/java/parkup/data/ParkingZoneAdminView.java
===================================================================
--- sources/app/src/main/java/parkup/data/ParkingZoneAdminView.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ sources/app/src/main/java/parkup/data/ParkingZoneAdminView.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -15,7 +15,7 @@
     private List<ParkingSpace> parkingSpaces;
     private ParkingZoneLocation parkingZoneLocation;
-    private List<Integer> odgovorniLica;
+    private List<Integer> responsibleWorkers;
 
-    public ParkingZoneAdminView(int pzId, String pzName, int price, int time_from, int time_to, String address, String color, List<ParkingSpace> parkingSpaces, ParkingZoneLocation parkingZoneLocation, List<Integer> odgovorniLica) {
+    public ParkingZoneAdminView(int pzId, String pzName, int price, int time_from, int time_to, String address, String color, List<ParkingSpace> parkingSpaces, ParkingZoneLocation parkingZoneLocation, List<Integer> responsibleWorkers) {
         this.pzId = pzId;
         this.pzName = pzName;
@@ -27,5 +27,5 @@
         this.parkingSpaces = parkingSpaces;
         this.parkingZoneLocation = parkingZoneLocation;
-        this.odgovorniLica = odgovorniLica;
+        this.responsibleWorkers = responsibleWorkers;
     }
 
@@ -104,10 +104,10 @@
     }
 
-    public List<Integer> getOdgovorniLica() {
-        return odgovorniLica;
+    public List<Integer> getResponsibleWorkers() {
+        return responsibleWorkers;
     }
 
-    public void setOdgovorniLica(List<Integer> odgovorniLica) {
-        this.odgovorniLica = odgovorniLica;
+    public void setResponsibleWorkers(List<Integer> responsibleWorkers) {
+        this.responsibleWorkers = responsibleWorkers;
     }
 }
Index: sources/app/src/main/java/parkup/data/ParkingZoneLocation.java
===================================================================
--- sources/app/src/main/java/parkup/data/ParkingZoneLocation.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ sources/app/src/main/java/parkup/data/ParkingZoneLocation.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -24,15 +24,15 @@
 
     @OneToMany(cascade = {CascadeType.ALL})
-    private List<Location> teminja;
+    private List<Location> coords;
 
-    public ParkingZoneLocation(int parkingZoneLocationId, Location centre, List<Location> teminja) {
+    public ParkingZoneLocation(int parkingZoneLocationId, Location centre, List<Location> coords) {
         this.parkingZoneLocationId = parkingZoneLocationId;
         this.centre = centre;
-        this.teminja = teminja;
+        this.coords = coords;
     }
 
-    public ParkingZoneLocation(Location centre, List<Location> teminja) {
+    public ParkingZoneLocation(Location centre, List<Location> coords) {
         this.centre = centre;
-        this.teminja = teminja;
+        this.coords = coords;
     }
 
@@ -47,10 +47,10 @@
     }
 
-    public List<Location> getTeminja() {
-        return teminja;
+    public List<Location> getCoords() {
+        return coords;
     }
 
-    public void setTeminja(List<Location> teminja) {
-        this.teminja = teminja;
+    public void setCoords(List<Location> teminja) {
+        this.coords = teminja;
     }
 }
Index: sources/app/src/main/java/parkup/data/Plate.java
===================================================================
--- sources/app/src/main/java/parkup/data/Plate.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
+++ sources/app/src/main/java/parkup/data/Plate.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -0,0 +1,35 @@
+package parkup.data;
+
+import javax.persistence.*;
+
+@Entity
+public class Plate {
+    @Id
+    @SequenceGenerator(
+            name="plate_sequence_generator",
+            sequenceName = "plate_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 = "plate_sequence_generator"
+    )
+    private int plateId;
+
+    private String plate;
+
+    public Plate() {}
+
+    public Plate(String plate) {
+        this.plate = plate;
+    }
+
+    public String getPlate() {
+        return this.plate;
+    }
+
+    public void setPlate(String plate) {
+        this.plate = plate;
+    }
+}
Index: sources/app/src/main/java/parkup/data/Tablicka.java
===================================================================
--- sources/app/src/main/java/parkup/data/Tablicka.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ 	(revision )
@@ -1,35 +1,0 @@
-package parkup.data;
-
-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;
-
-    public Tablicka() {}
-
-    public Tablicka(String tablica) {
-        this.tablica = tablica;
-    }
-
-    public String getTablica() {
-        return this.tablica;
-    }
-
-    public void setTablica(String tablica) {
-        this.tablica = tablica;
-    }
-}
Index: sources/app/src/main/java/parkup/data/VrabotenDemo.java
===================================================================
--- sources/app/src/main/java/parkup/data/VrabotenDemo.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ 	(revision )
@@ -1,50 +1,0 @@
-package parkup.data;
-
-public class VrabotenDemo {
-    private int vrabotenId;
-    private String firstName;
-    private String lastName;
-    private String email;
-
-    public VrabotenDemo() {}
-
-    public VrabotenDemo(int id,String firstName, String lastName, String email) {
-        this.vrabotenId=id;
-        this.firstName = firstName;
-        this.lastName = lastName;
-        this.email = email;
-    }
-
-    public int getVrabotenId() {
-        return vrabotenId;
-    }
-
-    public void setVrabotenId(int vrabotenId) {
-        this.vrabotenId = vrabotenId;
-    }
-
-    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/data/WorkerDemo.java
===================================================================
--- sources/app/src/main/java/parkup/data/WorkerDemo.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
+++ sources/app/src/main/java/parkup/data/WorkerDemo.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -0,0 +1,50 @@
+package parkup.data;
+
+public class WorkerDemo {
+    private int workerId;
+    private String firstName;
+    private String lastName;
+    private String email;
+
+    public WorkerDemo() {}
+
+    public WorkerDemo(int id, String firstName, String lastName, String email) {
+        this.workerId =id;
+        this.firstName = firstName;
+        this.lastName = lastName;
+        this.email = email;
+    }
+
+    public int getWorkerId() {
+        return workerId;
+    }
+
+    public void setWorkerId(int workerId) {
+        this.workerId = workerId;
+    }
+
+    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/data/WorkerDemoParkingZones.java
===================================================================
--- sources/app/src/main/java/parkup/data/WorkerDemoParkingZones.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
+++ sources/app/src/main/java/parkup/data/WorkerDemoParkingZones.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -0,0 +1,107 @@
+package parkup.data;
+
+import parkup.configs.PasswordEncoder;
+import parkup.data.enumarations.EmployeeStatus;
+import parkup.data.enumarations.UserRole;
+import parkup.entities.ParkingZone;
+import parkup.entities.Worker;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+public class WorkerDemoParkingZones {
+    private int workerId;
+    private String firstName;
+    private String lastName;
+    private String email;
+    private String password;
+    private String mobile;
+    private UserRole role;
+    private EmployeeStatus status;
+    private List<String> pzNames;
+    private PasswordEncoder passwordEncoder;
+
+    public WorkerDemoParkingZones(Worker v){
+        this.workerId = v.getWorkerId();
+        this.firstName = v.getFirstName();
+        this.lastName = v.getLastName();
+        this.email = v.getEmail();
+        this.password = v.getPassword();
+        this.mobile = v.getMobile();
+        this.role = v.getRole();
+        this.status = v.getStatus();
+        this.pzNames = v.getParkingZones().stream().map(ParkingZone::getPzName).collect(Collectors.toList());
+    }
+
+    public int getWorkerId() {
+        return workerId;
+    }
+
+    public void setWorkerId(int workerId) {
+        this.workerId = workerId;
+    }
+
+    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;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public String getMobile() {
+        return mobile;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+
+    public UserRole getRole() {
+        return role;
+    }
+
+    public void setRole(UserRole role) {
+        this.role = role;
+    }
+
+    public EmployeeStatus getStatus() {
+        return status;
+    }
+
+    public void setStatus(EmployeeStatus status) {
+        this.status = status;
+    }
+
+    public List<String> getPzNames() {
+        return pzNames;
+    }
+
+    public void setPzNames(List<String> pzNames) {
+        this.pzNames = pzNames;
+    }
+}
Index: sources/app/src/main/java/parkup/data/enumarations/UserRole.java
===================================================================
--- sources/app/src/main/java/parkup/data/enumarations/UserRole.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
+++ sources/app/src/main/java/parkup/data/enumarations/UserRole.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -0,0 +1,15 @@
+package parkup.data.enumarations;
+
+import org.springframework.security.core.GrantedAuthority;
+
+public enum UserRole implements GrantedAuthority {
+    GUEST,
+    REG_USER,
+    WORKER,
+    ADMIN;
+
+    @Override
+    public String getAuthority() {
+        return name();
+    }
+}
Index: sources/app/src/main/java/parkup/entities/Administrator.java
===================================================================
--- sources/app/src/main/java/parkup/entities/Administrator.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ sources/app/src/main/java/parkup/entities/Administrator.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -4,4 +4,5 @@
 import org.springframework.security.core.authority.SimpleGrantedAuthority;
 import org.springframework.security.core.userdetails.UserDetails;
+import parkup.data.enumarations.UserRole;
 
 import javax.persistence.*;
@@ -41,6 +42,7 @@
     private String mobile;
 
+    @Enumerated
     @Column(name = "role")
-    private String role;
+    private UserRole role;
 
     private boolean locked;
@@ -49,5 +51,6 @@
 
     public Administrator(){
-        this.role = "ROLE_ADMINISTRATOR";
+        this.role = UserRole.ADMIN;
+        this.enabled=true;
     }
 
@@ -59,5 +62,6 @@
         this.password = password;
         this.mobile = mobile;
-        this.role = "ROLE_ADMINISTRATOR";
+        this.enabled=true;
+        this.role = UserRole.ADMIN;
     }
 
@@ -68,5 +72,6 @@
         this.password = password;
         this.mobile = mobile;
-        this.role = "ROLE_ADMINISTRATOR";
+        this.role = UserRole.ADMIN;
+        this.enabled=true;
     }
 
@@ -77,5 +82,6 @@
         this.password = password;
         this.mobile = mobile;
-        this.role = "ROLE_ADMINISTRATOR";
+        this.role = UserRole.ADMIN;
+        this.enabled=true;
     }
 
@@ -124,11 +130,11 @@
     }
 
-    public String getRole() {return role;}
+    public UserRole getRole() {return role;}
 
-    public void setRole(String role) {this.role = role;}
+    public void setRole(UserRole role) {this.role = role;}
 
     @Override
     public Collection<? extends GrantedAuthority> getAuthorities() {
-        SimpleGrantedAuthority authority = new SimpleGrantedAuthority(role);
+        SimpleGrantedAuthority authority = new SimpleGrantedAuthority(role.getAuthority());
         return Collections.singleton(authority);
     }
Index: sources/app/src/main/java/parkup/entities/Guest.java
===================================================================
--- sources/app/src/main/java/parkup/entities/Guest.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ sources/app/src/main/java/parkup/entities/Guest.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -3,9 +3,16 @@
 import javax.persistence.*;
 
-import parkup.data.Tablicka;
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.security.core.authority.SimpleGrantedAuthority;
+import org.springframework.security.core.userdetails.UserDetails;
+import parkup.data.Plate;
+import parkup.data.enumarations.UserRole;
+
+import java.util.Collection;
+import java.util.Collections;
 
 @Entity
 @Table(name = "guest")
-public class Guest {
+public class Guest implements UserDetails {
     @Id
     @SequenceGenerator(
@@ -25,5 +32,5 @@
     @OneToOne
     @JoinColumn(name = "tablickaId", nullable = false)
-    private Tablicka tablicka;
+    private Plate plate;
 
     @Column(name = "email")
@@ -36,17 +43,23 @@
     private ParkingSession session;
 
-    public Guest() {}
+    @Enumerated
+    private UserRole role;
 
-    public Guest(int guestId, Tablicka tablicka, String email, String mobile) {
+
+    public Guest() {this.role=UserRole.GUEST;}
+
+    public Guest(int guestId, Plate plate, String email, String mobile) {
         this.guestId = guestId;
-        this.tablicka = tablicka;
+        this.plate = plate;
         this.email = email;
         this.mobile = mobile;
+        this.role=UserRole.GUEST;
     }
 
-    public Guest(Tablicka tablicka, String email, String mobile) {
-        this.tablicka = tablicka;
+    public Guest(Plate plate, String email, String mobile) {
+        this.plate = plate;
         this.email = email;
         this.mobile = mobile;
+        this.role=UserRole.GUEST;
     }
 
@@ -59,10 +72,10 @@
     }
 
-    public Tablicka getTablicka() {
-        return tablicka;
+    public Plate getTablicka() {
+        return plate;
     }
 
-    public void setTablicka(Tablicka tablicka) {
-        this.tablicka = tablicka;
+    public void setTablicka(Plate plate) {
+        this.plate = plate;
     }
 
@@ -75,4 +88,20 @@
     }
 
+    public ParkingSession getSession() {
+        return session;
+    }
+
+    public void setSession(ParkingSession session) {
+        this.session = session;
+    }
+
+    public UserRole getRole() {
+        return role;
+    }
+
+    public void setRole(UserRole role) {
+        this.role = role;
+    }
+
     public String getMobile() {
         return mobile;
@@ -82,3 +111,39 @@
         this.mobile = mobile;
     }
+
+    @Override
+    public Collection<? extends GrantedAuthority> getAuthorities() {
+        SimpleGrantedAuthority authority = new SimpleGrantedAuthority(role.name());
+        return Collections.singleton(authority);
+    }
+
+    @Override
+    public String getPassword() {
+        return null;
+    }
+
+    @Override
+    public String getUsername() {
+        return Integer.toString(guestId);
+    }
+
+    @Override
+    public boolean isAccountNonExpired() {
+        return false;
+    }
+
+    @Override
+    public boolean isAccountNonLocked() {
+        return false;
+    }
+
+    @Override
+    public boolean isCredentialsNonExpired() {
+        return false;
+    }
+
+    @Override
+    public boolean isEnabled() {
+        return false;
+    }
 }
Index: sources/app/src/main/java/parkup/entities/ParkingSession.java
===================================================================
--- sources/app/src/main/java/parkup/entities/ParkingSession.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ sources/app/src/main/java/parkup/entities/ParkingSession.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -2,5 +2,5 @@
 
 import org.springframework.format.annotation.DateTimeFormat;
-import parkup.data.Tablicka;
+import parkup.data.Plate;
 import parkup.data.enumarations.SessionStatus;
 
@@ -34,6 +34,6 @@
 
     @OneToOne(cascade = {CascadeType.ALL})
-    @JoinColumn(name = "reg_tablicka", nullable = false)
-    private Tablicka tablica;
+    @JoinColumn(name = "plate", nullable = false)
+    private Plate plate;
 
     @Column(name="session_status")
@@ -60,8 +60,8 @@
     }
 
-    public ParkingSession(Tablicka tablica){
+    public ParkingSession(Plate plate){
         this.timeStart= LocalDateTime.now();
         this.timeEnd=null;
-        this.tablica=tablica;
+        this.plate=plate;
         this.status=SessionStatus.STARTED_UNVERIFIED;
     }
@@ -92,10 +92,10 @@
     }
 
-    public Tablicka getTablica() {
-        return tablica;
+    public Plate getPlate() {
+        return plate;
     }
 
-    public void setTablica(Tablicka tablica) {
-        this.tablica = tablica;
+    public void setPlate(Plate plate) {
+        this.plate = plate;
     }
 
Index: sources/app/src/main/java/parkup/entities/ParkingZone.java
===================================================================
--- sources/app/src/main/java/parkup/entities/ParkingZone.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ sources/app/src/main/java/parkup/entities/ParkingZone.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -43,5 +43,5 @@
 
     @Transient
-    @Column(name = "zafateniMesta")
+    @Column(name = "takenSpaces")
     private int takenSpaces;
 
@@ -52,5 +52,5 @@
 //    private List<Vraboten> odgovorniLica;
 
-    @OneToMany(cascade = {CascadeType.MERGE})
+    @OneToMany(cascade = {CascadeType.ALL})
     private List<ParkingSpace> parkingSpaces;
 
Index: sources/app/src/main/java/parkup/entities/RegisteredUser.java
===================================================================
--- sources/app/src/main/java/parkup/entities/RegisteredUser.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
+++ sources/app/src/main/java/parkup/entities/RegisteredUser.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -0,0 +1,213 @@
+package parkup.entities;
+
+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.Plate;
+import parkup.data.enumarations.UserRole;
+
+@Entity
+@Table(name = "registeredUser")
+public class RegisteredUser implements UserDetails {
+    @Id
+    @SequenceGenerator(
+            name="registeredUser_sequence_generator",
+            sequenceName = "registeredUser_sequence",
+            allocationSize = 1,
+            initialValue = 300
+    )
+    @GeneratedValue(    //za postgres treba sequence da se namesti i ime na generator mi ga davamo kako od gore sto e
+            strategy = GenerationType.SEQUENCE,
+            generator = "registeredUser_sequence_generator"
+    )
+    @Column(name = "regParkId")
+    private int regParkId;
+
+    @Column(name = "name")
+    private String name;
+
+    @Column(name = "surname")
+    private String surname;
+
+    @Column(name = "password")
+    private String password;
+
+    @OneToMany(cascade ={CascadeType.ALL})
+    @Column(name = "regPlates")
+    private List<Plate> plates;
+
+    @Column(name = "email")
+    private String email;
+
+    @Column(name = "mobile")
+    private String mobile;
+
+    @Enumerated
+    @Column(name = "role")
+    private UserRole role;
+
+    @OneToOne
+    private ParkingSession session;
+
+    private boolean locked;
+
+    private boolean enabled;
+
+    public RegisteredUser() {
+        this.plates = new ArrayList<Plate>();
+        this.role = UserRole.REG_USER;
+        session=null;
+    }
+
+    public RegisteredUser(int regParkId, String name, String surname, String password, List<Plate> plates, String email, String mobile) {
+        this.regParkId = regParkId;
+        this.name = name;
+        this.surname = surname;
+        this.password = password;
+        this.plates = plates;
+        this.email = email;
+        this.mobile = mobile;
+        this.role = UserRole.REG_USER;
+        session=null;
+    }
+
+    public RegisteredUser(String name, String surname, String password, List<Plate> plates, String email, String mobile) {
+        this.name = name;
+        this.surname = surname;
+        this.password = password;
+        this.plates = plates;
+        this.email = email;
+        this.mobile = mobile;
+        this.role = UserRole.REG_USER;
+        session=null;
+    }
+
+    public RegisteredUser(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 = UserRole.REG_USER;
+        session=null;
+    }
+
+    public ParkingSession getSession() {
+        return session;
+    }
+
+    public void setSession(ParkingSession session) {
+        this.session = session;
+    }
+
+    public boolean isLocked() {
+        return locked;
+    }
+
+    public void setLocked(boolean locked) {
+        this.locked = locked;
+    }
+
+    public void setEnabled(boolean enabled) {
+        this.enabled = enabled;
+    }
+
+
+    public int getRegParkId() {
+        return regParkId;
+    }
+
+    public void setRegParkId(int regParkId) {
+        this.regParkId = regParkId;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getSurname() {
+        return surname;
+    }
+
+    public void setSurname(String surname) {
+        this.surname = surname;
+    }
+
+    public List<Plate> getPlates() {
+        return plates;
+    }
+
+    public void setPlates(List<Plate> plates) {
+        this.plates = plates;
+    }
+
+    public String getEmail() {
+        return email;
+    }
+
+    public void setEmail(String email) {
+        this.email = email;
+    }
+
+    public String getMobile() {
+        return mobile;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+
+    public UserRole getRole() {return role;}
+
+    public void setRole(UserRole role) {this.role = role;}
+
+    @Override
+    public Collection<? extends GrantedAuthority> getAuthorities() {
+        SimpleGrantedAuthority authority = new SimpleGrantedAuthority(role.getAuthority());
+        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/RegistriranParkirac.java
===================================================================
--- sources/app/src/main/java/parkup/entities/RegistriranParkirac.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ 	(revision )
@@ -1,211 +1,0 @@
-package parkup.entities;
-
-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 implements UserDetails {
-    @Id
-    @SequenceGenerator(
-            name="registriranParkirac_sequence_generator",
-            sequenceName = "registriranParkirac_sequence",
-            allocationSize = 1,
-            initialValue = 300
-    )
-    @GeneratedValue(    //za postgres treba sequence da se namesti i ime na generator mi ga davamo kako od gore sto e
-            strategy = GenerationType.SEQUENCE,
-            generator = "registriranParkirac_sequence_generator"
-    )
-    @Column(name = "regParkId")
-    private int regParkId;
-
-    @Column(name = "name")
-    private String name;
-
-    @Column(name = "surname")
-    private String surname;
-
-    @Column(name = "password")
-    private String password;
-
-    @OneToMany(cascade ={CascadeType.ALL})
-    @Column(name = "regTablicki")
-    private List<Tablicka> regTablicki;
-
-    @Column(name = "email")
-    private String email;
-
-    @Column(name = "mobile")
-    private String mobile;
-
-    @Column(name = "role")
-    private String role;
-
-    @OneToOne
-    private ParkingSession session;
-
-    private boolean locked;
-
-    private boolean enabled;
-
-    public RegistriranParkirac() {
-        this.regTablicki = new ArrayList<Tablicka>();
-        this.role = "ROLE_REGISTRIRAN_PARKIRAC";
-        session=null;
-    }
-
-    public RegistriranParkirac(int regParkId, String name, String surname, String password, List<Tablicka> regTablicki, String email, String mobile) {
-        this.regParkId = regParkId;
-        this.name = name;
-        this.surname = surname;
-        this.password = password;
-        this.regTablicki = regTablicki;
-        this.email = email;
-        this.mobile = mobile;
-        this.role = "ROLE_REGISTRIRAN_PARKIRAC";
-        session=null;
-    }
-
-    public RegistriranParkirac(String name, String surname, String password, List<Tablicka> regTablicki, String email, String mobile) {
-        this.name = name;
-        this.surname = surname;
-        this.password = password;
-        this.regTablicki = regTablicki;
-        this.email = email;
-        this.mobile = mobile;
-        this.role = "ROLE_REGISTRIRAN_PARKIRAC";
-        session=null;
-    }
-
-    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";
-        session=null;
-    }
-
-    public ParkingSession getSession() {
-        return session;
-    }
-
-    public void setSession(ParkingSession session) {
-        this.session = session;
-    }
-
-    public boolean isLocked() {
-        return locked;
-    }
-
-    public void setLocked(boolean locked) {
-        this.locked = locked;
-    }
-
-    public void setEnabled(boolean enabled) {
-        this.enabled = enabled;
-    }
-
-
-    public int getRegParkId() {
-        return regParkId;
-    }
-
-    public void setRegParkId(int regParkId) {
-        this.regParkId = regParkId;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public String getSurname() {
-        return surname;
-    }
-
-    public void setSurname(String surname) {
-        this.surname = surname;
-    }
-
-    public List<Tablicka> getRegTablicki() {
-        return regTablicki;
-    }
-
-    public void setRegTablicki(List<Tablicka> regTablicki) {
-        this.regTablicki = regTablicki;
-    }
-
-    public String getEmail() {
-        return email;
-    }
-
-    public void setEmail(String email) {
-        this.email = email;
-    }
-
-    public String getMobile() {
-        return mobile;
-    }
-
-    public void setMobile(String mobile) {
-        this.mobile = mobile;
-    }
-
-    public String getRole() {return role;}
-
-    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 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ 	(revision )
@@ -1,217 +1,0 @@
-package parkup.entities;
-
-import org.springframework.security.core.GrantedAuthority;
-import org.springframework.security.core.userdetails.UserDetails;
-import parkup.data.VrabotenDemo;
-import parkup.data.enumarations.EmployeeStatus;
-
-import javax.persistence.*;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-@Entity
-@Table(name = "vraboten")
-public class Vraboten implements UserDetails {
-    @Id
-    @SequenceGenerator(
-            name="vraboten_sequence_generator",
-            sequenceName = "vraboten_sequence",
-            allocationSize = 1,
-            initialValue = 200
-    )
-    @GeneratedValue(    //za postgres treba sequence da se namesti i ime na generator mi ga davamo kako od gore sto e
-            strategy = GenerationType.SEQUENCE,
-            generator = "vraboten_sequence_generator"
-    )
-    @Column(name = "vrabotenId")
-    private int vrabotenId;
-
-    @Override
-    public String toString() {
-        return "Vraboten{" +
-                "firstName='" + firstName + '\'' +
-                ", lastName='" + lastName + '\'' +
-                ", parkingZones=" + parkingZones +
-                ", locked=" + locked +
-                ", enabled=" + enabled +
-                '}';
-    }
-
-    @Column(name = "firstName")
-    private String firstName;
-
-    @Column(name = "lastName")
-    private String lastName;
-
-    @Column(name = "email")
-    private String email;
-
-    @Column(name = "password")
-    private String password;
-
-    @Column(name = "mobile")
-    private String mobile;
-
-    @Column(name = "role")
-    private String role;
-
-    @ManyToMany(cascade = {CascadeType.ALL})
-    private List<ParkingZone> parkingZones;
-
-    @Column(name = "status")
-    private EmployeeStatus status;
-
-    public void setLocked(boolean locked) {
-        this.locked = locked;
-    }
-
-    @Column(name="locked")
-    private boolean locked;
-
-    @Column(name = "enabled")
-    private boolean enabled;
-
-
-    public Vraboten() {
-        this.role = "ROLE_VRABOTEN";
-        this.parkingZones = new ArrayList<ParkingZone>();
-        this.enabled = true;
-        this.status = EmployeeStatus.NOT_WORKING;
-    }
-
-    public Vraboten(int vrabotenId, String firstName, String lastName, String email, String password, String mobile, List<ParkingZone> parkingZones) {
-        this.vrabotenId = vrabotenId;
-        this.firstName = firstName;
-        this.lastName = lastName;
-        this.email = email;
-        this.password = password;
-        this.mobile = mobile;
-        this.parkingZones = parkingZones;
-        this.role = "ROLE_VRABOTEN";
-        this.enabled = true;
-        this.status = EmployeeStatus.NOT_WORKING;
-    }
-
-    public Vraboten(String firstName, String lastName, String email, String password, String mobile, List<ParkingZone> parkingZones) {
-        this.firstName = firstName;
-        this.lastName = lastName;
-        this.email = email;
-        this.password = password;
-        this.mobile = mobile;
-        this.parkingZones = parkingZones;
-        this.role = "ROLE_VRABOTEN";
-        this.enabled = true;
-        this.status = EmployeeStatus.NOT_WORKING;
-    }
-
-    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.role="ROLE_VRABOTEN";
-        this.enabled=true;
-        this.status = EmployeeStatus.NOT_WORKING;
-    }
-
-    public int getVrabotenId() {
-        return vrabotenId;
-    }
-
-    public void setVrabotenId(int vrabotenId) {
-        this.vrabotenId = vrabotenId;
-    }
-
-    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;
-    }
-
-    @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;
-    }
-
-    public String getMobile() {
-        return mobile;
-    }
-
-    public void setMobile(String mobile) {
-        this.mobile = mobile;
-    }
-
-    public String getRole() {return role;}
-
-    public void setRole(String role) {this.role = role;}
-
-    public List<ParkingZone> getParkingZones() {return parkingZones;}
-
-    public void setParkingZones(List<ParkingZone> parkingZones) {this.parkingZones = parkingZones;}
-
-    public EmployeeStatus getStatus() {return status;}
-
-    public void setStatus(EmployeeStatus status) {this.status = status;}
-
-    public boolean isAccount() {return enabled;}
-
-    public void setAccount(boolean account) {this.enabled = account;}
-}
Index: sources/app/src/main/java/parkup/entities/Worker.java
===================================================================
--- sources/app/src/main/java/parkup/entities/Worker.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
+++ sources/app/src/main/java/parkup/entities/Worker.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -0,0 +1,221 @@
+package parkup.entities;
+
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.security.core.authority.SimpleGrantedAuthority;
+import org.springframework.security.core.userdetails.UserDetails;
+import parkup.data.enumarations.EmployeeStatus;
+import parkup.data.enumarations.UserRole;
+
+import javax.persistence.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+@Entity
+@Table(name = "worker")
+public class Worker implements UserDetails {
+    @Id
+    @SequenceGenerator(
+            name="worker_sequence_generator",
+            sequenceName = "worker_sequence",
+            allocationSize = 1,
+            initialValue = 200
+    )
+    @GeneratedValue(    //za postgres treba sequence da se namesti i ime na generator mi ga davamo kako od gore sto e
+            strategy = GenerationType.SEQUENCE,
+            generator = "worker_sequence_generator"
+    )
+    @Column(name = "workerId")
+    private int workerId;
+
+    @Override
+    public String toString() {
+        return "Vraboten{" +
+                "firstName='" + firstName + '\'' +
+                ", lastName='" + lastName + '\'' +
+                ", parkingZones=" + parkingZones +
+                ", locked=" + locked +
+                ", enabled=" + enabled +
+                '}';
+    }
+
+    @Column(name = "firstName")
+    private String firstName;
+
+    @Column(name = "lastName")
+    private String lastName;
+
+    @Column(name = "email")
+    private String email;
+
+    @Column(name = "password")
+    private String password;
+
+    @Column(name = "mobile")
+    private String mobile;
+
+    @Enumerated
+    @Column(name = "role")
+    private UserRole role;
+
+    @ManyToMany(cascade = {CascadeType.ALL})
+    private List<ParkingZone> parkingZones;
+
+    @Column(name = "status")
+    private EmployeeStatus status;
+
+    public void setLocked(boolean locked) {
+        this.locked = locked;
+    }
+
+    @Column(name="locked")
+    private boolean locked;
+
+    @Column(name = "enabled")
+    private boolean enabled;
+
+
+    public Worker() {
+        this.role = UserRole.WORKER;
+        this.parkingZones = new ArrayList<ParkingZone>();
+        this.enabled = true;
+        this.status = EmployeeStatus.NOT_WORKING;
+    }
+
+    public Worker(int workerId, String firstName, String lastName, String email, String password, String mobile, List<ParkingZone> parkingZones) {
+        this.workerId = workerId;
+        this.firstName = firstName;
+        this.lastName = lastName;
+        this.email = email;
+        this.password = password;
+        this.mobile = mobile;
+        this.parkingZones = parkingZones;
+        this.role = UserRole.WORKER;
+        this.enabled = true;
+        this.status = EmployeeStatus.NOT_WORKING;
+    }
+
+    public Worker(String firstName, String lastName, String email, String password, String mobile, List<ParkingZone> parkingZones) {
+        this.firstName = firstName;
+        this.lastName = lastName;
+        this.email = email;
+        this.password = password;
+        this.mobile = mobile;
+        this.parkingZones = parkingZones;
+        this.role = UserRole.WORKER;
+        this.enabled = true;
+        this.status = EmployeeStatus.NOT_WORKING;
+    }
+
+    public Worker(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.role = UserRole.WORKER;
+        this.enabled=true;
+        this.status = EmployeeStatus.NOT_WORKING;
+    }
+
+    public int getWorkerId() {
+        return workerId;
+    }
+
+    public void setWorkerId(int workerId) {
+        this.workerId = workerId;
+    }
+
+    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;
+    }
+
+    @Override
+    public Collection<? extends GrantedAuthority> getAuthorities() {
+        SimpleGrantedAuthority authority = new SimpleGrantedAuthority(role.getAuthority());
+        return Collections.singleton(authority);
+    }
+
+    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;
+    }
+
+    public String getMobile() {
+        return mobile;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+
+    public UserRole getRole() {return role;}
+
+    public void setRole(UserRole role) {this.role = role;}
+
+    public List<ParkingZone> getParkingZones() {return parkingZones;}
+
+    public void setParkingZones(List<ParkingZone> parkingZones) {this.parkingZones = parkingZones;}
+
+    public EmployeeStatus getStatus() {return status;}
+
+    public void setStatus(EmployeeStatus status) {this.status = status;}
+
+    public boolean isAccount() {return enabled;}
+
+    public void setAccount(boolean account) {this.enabled = account;}
+}
Index: sources/app/src/main/java/parkup/repositories/PlateRepository.java
===================================================================
--- sources/app/src/main/java/parkup/repositories/PlateRepository.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
+++ sources/app/src/main/java/parkup/repositories/PlateRepository.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -0,0 +1,8 @@
+package parkup.repositories;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import parkup.data.Plate;
+
+public interface PlateRepository extends JpaRepository<Plate,Integer> {
+    Plate findByPlate(String plate);
+}
Index: sources/app/src/main/java/parkup/repositories/RegisteredUserRepository.java
===================================================================
--- sources/app/src/main/java/parkup/repositories/RegisteredUserRepository.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
+++ sources/app/src/main/java/parkup/repositories/RegisteredUserRepository.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -0,0 +1,25 @@
+package parkup.repositories;
+
+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.RegisteredUser;
+
+import javax.transaction.Transactional;
+
+@Repository
+public interface RegisteredUserRepository extends JpaRepository<RegisteredUser, Integer> {
+    RegisteredUser findByRegParkId(int regParkId);
+
+    void deleteByRegParkId(int regParkId);
+
+    Optional<RegisteredUser> findRegisteredUserByEmail(String email);
+
+    @Transactional
+    @Modifying
+    @Query("UPDATE RegisteredUser rp " +
+            "SET rp.enabled = TRUE WHERE rp.email = ?1")
+    int enableRegisteredUser(String email);
+}
Index: sources/app/src/main/java/parkup/repositories/RegistriranParkiracRepository.java
===================================================================
--- sources/app/src/main/java/parkup/repositories/RegistriranParkiracRepository.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ 	(revision )
@@ -1,25 +1,0 @@
-package parkup.repositories;
-
-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);
-
-    void deleteByRegParkId(int regParkId);
-
-    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/TablickaRepository.java
===================================================================
--- sources/app/src/main/java/parkup/repositories/TablickaRepository.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ 	(revision )
@@ -1,8 +1,0 @@
-package parkup.repositories;
-
-import org.springframework.data.jpa.repository.JpaRepository;
-import parkup.data.Tablicka;
-
-public interface TablickaRepository extends JpaRepository<Tablicka,Integer> {
-    Tablicka findByTablica(String tablica);
-}
Index: sources/app/src/main/java/parkup/repositories/VrabotenRepository.java
===================================================================
--- sources/app/src/main/java/parkup/repositories/VrabotenRepository.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ 	(revision )
@@ -1,25 +1,0 @@
-package parkup.repositories;
-
-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);
-
-    void deleteByVrabotenId(int id);
-
-    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/repositories/WorkerRepository.java
===================================================================
--- sources/app/src/main/java/parkup/repositories/WorkerRepository.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
+++ sources/app/src/main/java/parkup/repositories/WorkerRepository.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -0,0 +1,25 @@
+package parkup.repositories;
+
+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.Worker;
+
+import javax.transaction.Transactional;
+
+@Repository
+public interface WorkerRepository extends JpaRepository<Worker, Integer> {
+    Worker findByWorkerId(int id);
+
+    void deleteByWorkerId(int id);
+
+    Optional<Worker> findWorkerByEmail(String email);
+
+    @Transactional
+    @Modifying
+    @Query("UPDATE Worker a " +
+            "SET a.enabled = TRUE WHERE a.email = ?1")
+    int enableWorker(String email);
+}
Index: sources/app/src/main/java/parkup/services/AdministratorService.java
===================================================================
--- sources/app/src/main/java/parkup/services/AdministratorService.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ sources/app/src/main/java/parkup/services/AdministratorService.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -21,12 +21,10 @@
     private final AdministratorRepository administratorRepository;
     private final BCryptPasswordEncoder bCryptPasswordEncoder;
-    private final ConfirmationTokenService confirmationTokenService;
-    private EmailValidator emailValidator;
+
 
     @Autowired
-    public AdministratorService(AdministratorRepository administratorRepository, BCryptPasswordEncoder bCryptPasswordEncoder, ConfirmationTokenService confirmationTokenService) {
+    public AdministratorService(AdministratorRepository administratorRepository, BCryptPasswordEncoder bCryptPasswordEncoder) {
         this.administratorRepository = administratorRepository;
         this.bCryptPasswordEncoder = bCryptPasswordEncoder;
-        this.confirmationTokenService = confirmationTokenService;
     }
 
@@ -46,5 +44,5 @@
         } else {
             if (administrator.getEmail() != null && administrator.getEmail().length() > 1 && administrator.getEmail().contains("@")) {
-                //System.out.println(regPark);
+                administrator.setPassword(bCryptPasswordEncoder.encode(administrator.getPassword()));
                 this.administratorRepository.save(administrator);
             }
@@ -108,40 +106,4 @@
     }
 
-   //public String register(RegistrationRequest request) {
-   //    boolean isValidEmail = emailValidator.test(request.getEmail());
-   //    if (!isValidEmail){
-   //        throw new IllegalStateException("Email not valid");
-   //    }
-   //    return "it works";
-   //}
-
-    public String signUpAdministrator(Administrator administrator){
-        boolean administratorExists = administratorRepository
-                .findAdministratorByEmail(administrator.getEmail())
-                .isPresent();
-        if(administratorExists){
-            // 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(administrator.getPassword());
-
-        administrator.setPassword(encodedPassword);
-
-        administratorRepository.save(administrator);
-
-        // TODO: Send confirmation token
-
-        String token = UUID.randomUUID().toString();
-
-
-        // TODO: SEND EMAIL
-
-        return token;
-    }
-
     public int enableAdministrator(String email) {
         return administratorRepository.enableAdministrator(email);
Index: sources/app/src/main/java/parkup/services/ParkingSessionService.java
===================================================================
--- sources/app/src/main/java/parkup/services/ParkingSessionService.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ sources/app/src/main/java/parkup/services/ParkingSessionService.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -3,5 +3,5 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import parkup.data.Tablicka;
+import parkup.data.Plate;
 import parkup.data.enumarations.SessionStatus;
 import parkup.entities.ParkingSession;
@@ -11,5 +11,5 @@
 import parkup.repositories.ParkingSpaceRepository;
 import parkup.repositories.ParkingZoneRepository;
-import parkup.repositories.TablickaRepository;
+import parkup.repositories.PlateRepository;
 
 import javax.transaction.Transactional;
@@ -25,12 +25,12 @@
     private final ParkingZoneRepository parkingZoneRepository;
     private final ParkingSpaceRepository parkingSpaceRepository;
-    private final TablickaRepository tablickaRepository;
+    private final PlateRepository plateRepository;
 
     @Autowired
-    public ParkingSessionService(ParkingSessionRepository parkingSessionRepository, ParkingZoneRepository parkingZoneRepository, ParkingSpaceRepository parkingSpaceRepository, TablickaRepository tablickaRepository) {
+    public ParkingSessionService(ParkingSessionRepository parkingSessionRepository, ParkingZoneRepository parkingZoneRepository, ParkingSpaceRepository parkingSpaceRepository, PlateRepository plateRepository) {
         this.parkingSessionRepository = parkingSessionRepository;
         this.parkingZoneRepository = parkingZoneRepository;
         this.parkingSpaceRepository = parkingSpaceRepository;
-        this.tablickaRepository = tablickaRepository;
+        this.plateRepository = plateRepository;
     }
 
@@ -83,10 +83,10 @@
     public Optional<ParkingSession> startParkingSession(String tablica, int parkingZoneId) {
         ParkingZone parkingZone = parkingZoneRepository.findByPzId(parkingZoneId);
-        Tablicka tablicka = tablickaRepository.findByTablica(tablica);
-        if(tablicka==null) {
-            tablickaRepository.save(new Tablicka(tablica));
+        Plate plate = plateRepository.findByPlate(tablica);
+        if(plate ==null) {
+            plateRepository.save(new Plate(tablica));
         }
-        tablicka=tablickaRepository.findByTablica(tablica);
-        ParkingSession sessionToAdd = new ParkingSession(tablicka);
+        plate = plateRepository.findByPlate(tablica);
+        ParkingSession sessionToAdd = new ParkingSession(plate);
         sessionToAdd.setParkingZone(parkingZone);
         parkingSessionRepository.save(sessionToAdd);
Index: sources/app/src/main/java/parkup/services/ParkingSpaceService.java
===================================================================
--- sources/app/src/main/java/parkup/services/ParkingSpaceService.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ sources/app/src/main/java/parkup/services/ParkingSpaceService.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -4,4 +4,5 @@
 import org.springframework.stereotype.Service;
 import parkup.entities.ParkingSpace;
+import parkup.entities.ParkingZone;
 import parkup.repositories.ParkingSpaceRepository;
 import parkup.repositories.ParkingZoneRepository;
@@ -48,6 +49,6 @@
         Optional<ParkingSpace> ParkingSpaceOpt = Optional.ofNullable(parkingSpaceRepository.findByPsId(parkingSpaceId));
         if (ParkingSpaceOpt.isPresent()) {
-            ParkingSpace ParkingSpaceNov = parkingSpaceRepository.findByPsId(parkingSpaceId);
-            if (psName != null && psName.length() > 1 && !Objects.equals(ParkingSpaceNov.getPsName(), psName)) {
+            ParkingSpace parkingSpaceNew = parkingSpaceRepository.findByPsId(parkingSpaceId);
+            if (psName != null && psName.length() > 1 && !Objects.equals(parkingSpaceNew.getPsName(), psName)) {
                 Optional<ParkingSpace> parkingSpaceOpt1 = Optional.ofNullable(parkingSpaceRepository.findByPsName(psName));
                 if (parkingSpaceOpt1.isPresent()) {
@@ -55,20 +56,20 @@
                 }
 
-                ParkingSpaceNov.setPsName(psName);
+                parkingSpaceNew.setPsName(psName);
             }
 
-            if (!Objects.equals(ParkingSpaceNov.isTaken(), taken)) {
-                ParkingSpaceNov.setTaken(taken);
+            if (!Objects.equals(parkingSpaceNew.isTaken(), taken)) {
+                parkingSpaceNew.setTaken(taken);
             }
 
 
-            if(lat!=0 && !Objects.equals(ParkingSpaceNov.getLat(), lat)){
-                ParkingSpaceNov.setLat(lat);
+            if(lat!=0 && !Objects.equals(parkingSpaceNew.getLat(), lat)){
+                parkingSpaceNew.setLat(lat);
             }
 
-            if(lng!=0 && !Objects.equals(ParkingSpaceNov.getLng(), lng)){
-                ParkingSpaceNov.setLng(lng);
+            if(lng!=0 && !Objects.equals(parkingSpaceNew.getLng(), lng)){
+                parkingSpaceNew.setLng(lng);
             }
-            return ParkingSpaceNov;
+            return parkingSpaceNew;
         }else{
             throw new IllegalStateException("ParkingSpace does not exist");
@@ -80,4 +81,8 @@
         Optional<ParkingSpace> parkingSpaceOpt = Optional.ofNullable(parkingSpaceRepository.findByPsId(parkingSpaceId));
         if (parkingSpaceOpt.isPresent()) {
+            for(ParkingZone pz: parkingZoneRepository.findAll()){
+                pz.getParkingSpaces().remove(parkingSpaceOpt.get());
+                parkingZoneRepository.save(pz);
+            }
             parkingSpaceRepository.deleteByPsId(parkingSpaceId);
         } else {
Index: sources/app/src/main/java/parkup/services/ParkingZoneService.java
===================================================================
--- sources/app/src/main/java/parkup/services/ParkingZoneService.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ sources/app/src/main/java/parkup/services/ParkingZoneService.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -4,12 +4,11 @@
 import org.springframework.stereotype.Service;
 import parkup.data.ParkingZoneLocation;
-import parkup.entities.ParkingSession;
 import parkup.entities.ParkingSpace;
 import parkup.entities.ParkingZone;
-import parkup.entities.Vraboten;
+import parkup.entities.Worker;
 import parkup.repositories.ParkingSessionRepository;
 import parkup.repositories.ParkingSpaceRepository;
 import parkup.repositories.ParkingZoneRepository;
-import parkup.repositories.VrabotenRepository;
+import parkup.repositories.WorkerRepository;
 
 import javax.transaction.Transactional;
@@ -23,22 +22,30 @@
     private final ParkingZoneRepository parkingZoneRepository;
     private final ParkingSpaceRepository parkingSpaceRepository;
-    private final VrabotenRepository vrabotenRepository;
+    private final WorkerRepository workerRepository;
     private final ParkingSessionRepository parkingSessionRepository;
 
     @Autowired
-    public ParkingZoneService(ParkingZoneRepository parkingZoneRepository, ParkingSpaceRepository parkingSpaceRepository, VrabotenRepository vrabotenRepository, ParkingSessionRepository parkingSessionRepository) {
+    public ParkingZoneService(ParkingZoneRepository parkingZoneRepository, ParkingSpaceRepository parkingSpaceRepository, WorkerRepository workerRepository, ParkingSessionRepository parkingSessionRepository) {
         this.parkingZoneRepository = parkingZoneRepository;
         this.parkingSpaceRepository = parkingSpaceRepository;
         this.parkingSessionRepository = parkingSessionRepository;
-        this.vrabotenRepository = vrabotenRepository;
+        this.workerRepository = workerRepository;
     }
 
     public List<ParkingZone> getAllParkingZones() {
-        return parkingZoneRepository.findAll();
+        List<ParkingZone> parkingZones= parkingZoneRepository.findAll();
+        for(ParkingZone pz:parkingZones){
+            setTransientVariables(pz.getId());
+        }
+        return parkingZones;
     }
 
     public ParkingZone findById(int parkingZoneId) {
         Optional<ParkingZone> parkingZone = Optional.ofNullable(this.parkingZoneRepository.findByPzId(parkingZoneId));
-        return parkingZone.orElse(null);
+        if (!parkingZone.isPresent()) {
+            throw new IllegalStateException("ParkingZone does not exist");
+        }
+        setTransientVariables(parkingZone.get().getId());
+        return parkingZone.get();
     }
 
@@ -134,7 +141,7 @@
                     ParkingZone parkingZone = parkingZoneRepository.findByPzId(parkingZoneId);
                     for (Integer vrabotenId : odgovorniLica) {
-                        Vraboten vrabotenToAdd = vrabotenRepository.findByVrabotenId(vrabotenId);
-                        if(vrabotenToAdd!=null)
-                        vrabotenToAdd.getParkingZones().add(parkingZone);
+                        Worker workerToAdd = workerRepository.findByWorkerId(vrabotenId);
+                        if(workerToAdd !=null)
+                        workerToAdd.getParkingZones().add(parkingZone);
                     }
                 }
@@ -158,4 +165,17 @@
             return parkingZoneOpt;
         }
+
+        public int calculateTakenSpaces(int pzId){
+            ParkingZone parkingZone=parkingZoneRepository.findByPzId(pzId);
+            return (int)parkingZone.getParkingSpaces().stream().filter(ParkingSpace::isTaken).count();
+        }
+        public int calculateCapacity(int pzId){
+            ParkingZone parkingZone=parkingZoneRepository.findByPzId(pzId);
+            return parkingZone.getParkingSpaces().size();
+        }
+        public void setTransientVariables(int pzId){
+            calculateCapacity(pzId);
+            calculateTakenSpaces(pzId);
+        }
     }
 
Index: sources/app/src/main/java/parkup/services/RegisteredUserService.java
===================================================================
--- sources/app/src/main/java/parkup/services/RegisteredUserService.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
+++ sources/app/src/main/java/parkup/services/RegisteredUserService.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -0,0 +1,151 @@
+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.Plate;
+import parkup.entities.RegisteredUser;
+import parkup.repositories.RegisteredUserRepository;
+
+@Service
+public class RegisteredUserService implements UserDetailsService {
+    private final RegisteredUserRepository registeredUserRepository;
+    private final BCryptPasswordEncoder bCryptPasswordEncoder;
+    private final ConfirmationTokenService confirmationTokenService;
+    private final EmailValidator emailValidator;
+    @Autowired
+    public RegisteredUserService(RegisteredUserRepository registeredUserRepository, BCryptPasswordEncoder bCryptPasswordEncoder, ConfirmationTokenService confirmationTokenService, EmailValidator emailValidator) {
+        this.registeredUserRepository = registeredUserRepository;
+        this.bCryptPasswordEncoder = bCryptPasswordEncoder;
+        this.confirmationTokenService = confirmationTokenService;
+        this.emailValidator = emailValidator;
+    }
+
+    public List<RegisteredUser> getRegPark() {
+        return this.registeredUserRepository.findAll();
+    }
+
+    public Optional<RegisteredUser> addRegPark(RegisteredUser regPark) {
+        Optional<RegisteredUser> regParkOpt = this.registeredUserRepository.findRegisteredUserByEmail(regPark.getEmail());
+        if (regParkOpt.isPresent()) {
+            throw new IllegalStateException("Email already taken, try adding a registriranParkirac with a different valid email address");
+        } else {
+            if (regPark.getEmail() != null && regPark.getEmail().length() > 1 && regPark.getEmail().contains("@")) {
+                this.registeredUserRepository.save(regPark);
+            }
+            else {
+                throw new IllegalStateException("email not valid");
+            }
+        }
+        return regParkOpt;
+    }
+
+    @Transactional
+    public RegisteredUser updateRegPark(int regParkId, String name, String surname, String mobile, String email, List<Plate> regTablicki) {
+        Optional<RegisteredUser> regParkOpt = Optional.ofNullable(this.registeredUserRepository.findByRegParkId(regParkId));
+        if (regParkOpt.isPresent()) {
+            RegisteredUser regParkNov = this.registeredUserRepository.findByRegParkId(regParkId);
+            if (email != null && email.length() > 1 && email.contains("@") && !Objects.equals(regParkNov.getEmail(), email)) {
+                Optional<RegisteredUser> userOpt1 = this.registeredUserRepository.findRegisteredUserByEmail(email);
+                if (userOpt1.isPresent()) {
+                    throw new IllegalStateException("email taken");
+                }
+
+                regParkNov.setEmail(email);
+            }
+
+            if (name != null && name.length() > 1 && !Objects.equals(regParkNov.getName(), name)) {
+                regParkNov.setName(name);
+            }
+
+            if (surname != null && surname.length() > 1 && !Objects.equals(regParkNov.getSurname(), surname)) {
+                regParkNov.setSurname(surname);
+            }
+
+            if (mobile != null && mobile.length() > 0 && !Objects.equals(regParkNov.getMobile(), mobile)) {
+                regParkNov.setMobile(mobile);
+            }
+            regParkNov.setPlates(regTablicki);
+            return regParkNov;
+        }else{
+            throw new IllegalStateException("RegistriranParkirac doesn't exist, therefore can't be updated");
+        }
+    }
+
+    @Transactional
+    @Modifying
+    public Optional<RegisteredUser> deleteRegPark(int regParkId) {
+        Optional<RegisteredUser> regPark = Optional.ofNullable(this.registeredUserRepository.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.deleteByRegisteredUser_RegParkId(regParkId);
+            this.registeredUserRepository.deleteByRegParkId(regParkId);
+        } else {
+            throw new IllegalStateException("RegistriranParkirac doesn't exist, therefore can't be deleted");
+        }
+        return regPark;
+    }
+
+    public RegisteredUser findById(int regParkId) {
+        Optional<RegisteredUser> regPark = Optional.ofNullable(this.registeredUserRepository.findByRegParkId(regParkId));
+        return regPark.orElse(null);
+    }
+
+    @Override
+    public UserDetails loadUserByUsername(String email) throws UsernameNotFoundException {
+        return registeredUserRepository.findRegisteredUserByEmail(email)
+                .orElseThrow(() ->
+                        new UsernameNotFoundException("Email not found"));
+
+    }
+
+    public String signUpRegistriranParkirac(RegisteredUser registeredUser){
+        if (registeredUser.getEmail() == null || registeredUser.getEmail().isEmpty())
+            throw new IllegalArgumentException("Empty email");
+        if (!emailValidator.test(registeredUser.getEmail()))
+            throw new IllegalArgumentException("Invalid email");
+        boolean registriranParkiracExists = registeredUserRepository
+                .findRegisteredUserByEmail(registeredUser.getEmail())
+                .isPresent();
+        if(registriranParkiracExists){
+            throw new IllegalStateException("Email already taken");
+        }
+
+        String encodedPassword = bCryptPasswordEncoder
+                .encode(registeredUser.getPassword());
+
+        registeredUser.setPassword(encodedPassword);
+
+        registeredUserRepository.save(registeredUser);
+
+        String token = UUID.randomUUID().toString();
+        ConfirmationTokenRP confirmationTokenRP = new ConfirmationTokenRP(
+                token,
+                LocalDateTime.now(),
+                LocalDateTime.now().plusMinutes(15),
+                registeredUser
+        );
+
+        confirmationTokenService.saveConfirmationTokenRP(confirmationTokenRP);
+
+        return token;
+    }
+
+    public int enableRegistriranParkirac(String email) {
+        return registeredUserRepository.enableRegisteredUser(email);
+    }
+}
Index: sources/app/src/main/java/parkup/services/RegistriranParkiracService.java
===================================================================
--- sources/app/src/main/java/parkup/services/RegistriranParkiracService.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ 	(revision )
@@ -1,155 +1,0 @@
-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 implements UserDetailsService {
-    private final RegistriranParkiracRepository registriranParkiracRepository;
-    private final BCryptPasswordEncoder bCryptPasswordEncoder;
-    private final ConfirmationTokenService confirmationTokenService;
-    private EmailValidator emailValidator;
-
-    @Autowired
-    public RegistriranParkiracService(RegistriranParkiracRepository registriranParkiracRepository, BCryptPasswordEncoder bCryptPasswordEncoder, ConfirmationTokenService confirmationTokenService) {
-        this.registriranParkiracRepository = registriranParkiracRepository;
-        this.bCryptPasswordEncoder = bCryptPasswordEncoder;
-        this.confirmationTokenService = confirmationTokenService;
-    }
-
-    public List<RegistriranParkirac> getRegPark() {
-        return this.registriranParkiracRepository.findAll();
-    }
-
-    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 {
-            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 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()) {
-            RegistriranParkirac regParkNov = this.registriranParkiracRepository.findByRegParkId(regParkId);
-            if (email != null && email.length() > 1 && email.contains("@") && !Objects.equals(regParkNov.getEmail(), email)) {
-                Optional<RegistriranParkirac> userOpt1 = this.registriranParkiracRepository.findRegistriranParkiracByEmail(email);
-                if (userOpt1.isPresent()) {
-                    throw new IllegalStateException("email taken");
-                }
-
-                regParkNov.setEmail(email);
-            }
-
-            if (name != null && name.length() > 1 && !Objects.equals(regParkNov.getName(), name)) {
-                regParkNov.setName(name);
-            }
-
-            if (surname != null && surname.length() > 1 && !Objects.equals(regParkNov.getSurname(), surname)) {
-                regParkNov.setSurname(surname);
-            }
-
-            if (mobile != null && mobile.length() > 0 && !Objects.equals(regParkNov.getMobile(), mobile)) {
-                regParkNov.setMobile(mobile);
-            }
-            regParkNov.setRegTablicki(regTablicki);
-            return regParkNov;
-        }else{
-            throw new IllegalStateException("RegistriranParkirac doesn't exist, therefore can't be updated");
-        }
-    }
-
-    @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;
-    }
-
-    public RegistriranParkirac findById(int regParkId) {
-        Optional<RegistriranParkirac> regPark = Optional.ofNullable(this.registriranParkiracRepository.findByRegParkId(regParkId));
-        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 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ 	(revision )
@@ -1,263 +1,0 @@
-package parkup.services;
-
-import java.time.LocalDateTime;
-import java.util.*;
-import java.util.stream.Collectors;
-import javax.transaction.Transactional;
-import org.springframework.beans.factory.annotation.Autowired;
-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.data.enumarations.EmployeeStatus;
-import parkup.entities.ParkingZone;
-import parkup.entities.Vraboten;
-import parkup.repositories.ParkingZoneRepository;
-import parkup.repositories.VrabotenRepository;
-import parkup.data.VrabotenDemo;
-
-@Service
-public class VrabotenService implements UserDetailsService {
-    private final VrabotenRepository vrabotenRepository;
-    private final ParkingZoneRepository parkingZoneRepository;
-    private final BCryptPasswordEncoder bCryptPasswordEncoder;
-    private final ConfirmationTokenService confirmationTokenService;
-
-    @Autowired
-    public VrabotenService(VrabotenRepository vrabotenRepository, ParkingZoneRepository parkingZoneRepository, BCryptPasswordEncoder bCryptPasswordEncoder, ConfirmationTokenService confirmationTokenService) {
-        this.vrabotenRepository = vrabotenRepository;
-        this.parkingZoneRepository = parkingZoneRepository;
-        this.bCryptPasswordEncoder = bCryptPasswordEncoder;
-        this.confirmationTokenService = confirmationTokenService;
-    }
-
-    public List<Vraboten> getVraboteni() {
-        return this.vrabotenRepository.findAll();
-    }
-
-    public Vraboten findById(int vrabotenId) {
-        Optional<Vraboten> vraboten = Optional.ofNullable(this.vrabotenRepository.findByVrabotenId(vrabotenId));
-        return vraboten.orElse(null);
-    }
-
-    public List<VrabotenDemo> getAllVraboteniDemos() {
-        List<Vraboten> vraboteni = this.vrabotenRepository.findAll();
-        List<VrabotenDemo> vrabotenDemos = new ArrayList<>();
-        for (Vraboten v : vraboteni){
-            VrabotenDemo vd = new VrabotenDemo(v.getVrabotenId(),v.getFirstName(), v.getLastName(), v.getEmail());
-            vrabotenDemos.add(vd);
-        }
-        return vrabotenDemos;
-    }
-
-    public Optional<Vraboten> addVraboten(String password,String confirmPass,boolean locked, String firstName, String lastName, String mobile, String email, EmployeeStatus status,List<String> parkingZones) {
-        Optional<Vraboten> vrabotenOpt = this.vrabotenRepository.findVrabotenByEmail(email);
-        if (vrabotenOpt.isPresent()){
-            throw new IllegalArgumentException("User with that mail already exists");
-        }
-        Vraboten vrabotenToAdd=new Vraboten();
-        if (email != null && email.length() > 1 && email.contains("@") ) {
-            vrabotenToAdd.setEmail(email);
-        } else {
-            throw new IllegalStateException("email not valid");
-        }
-        if(password.equals(confirmPass)){
-            vrabotenToAdd.setPassword(bCryptPasswordEncoder.encode(password));
-        }
-        vrabotenToAdd.setLocked(locked);
-
-        if (firstName != null && firstName.length() > 1) {
-            vrabotenToAdd.setFirstName(firstName);
-        }
-
-        if (lastName != null && lastName.length() > 1 ) {
-            vrabotenToAdd.setLastName(lastName);
-        }
-
-        if (mobile != null && mobile.length() > 0 ) {
-            vrabotenToAdd.setMobile(mobile);
-        }
-
-        vrabotenToAdd.setStatus(status);
-
-        if(parkingZones!=null){
-            List<ParkingZone> parkingZonesAvailable =parkingZoneRepository.findAll();
-            List<ParkingZone> zonesToAdd= new ArrayList<>();
-            vrabotenToAdd.setParkingZones(null);
-            for(String pzName:parkingZones){
-                for(ParkingZone pz :parkingZonesAvailable){
-                    if(pzName.equals(pz.getPzName())) {
-                        zonesToAdd.add(pz);
-//                            pz.getOdgovorniLica().add(vrabotenRepository.findByVrabotenId(vrabotenId));
-                    }
-                }
-            }
-            vrabotenToAdd.setParkingZones(zonesToAdd);
-        }
-        String token = UUID.randomUUID().toString();
-        ConfirmationTokenW confirmationTokenW = new ConfirmationTokenW(
-                token,
-                LocalDateTime.now(),
-                LocalDateTime.now().plusMinutes(15),
-                vrabotenToAdd
-        );
-
-        confirmationTokenService.saveConfirmationTokenW(confirmationTokenW);
-
-        return Optional.of(vrabotenToAdd);
-//        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 {
-//            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 Vraboten updateVraboten(int vrabotenId,String password,String confirmPass,boolean locked, String firstName, String lastName, String mobile, String email, EmployeeStatus status,List<String> parkingZones) {
-        Optional<Vraboten> vrabotenOpt = Optional.ofNullable(this.vrabotenRepository.findByVrabotenId(vrabotenId));
-        if (vrabotenOpt.isPresent()) {
-
-            if (email != null && email.length() > 1 && email.contains("@") ) {
-                List<String> emails = vrabotenRepository.findAll().stream().map(Vraboten::getEmail).collect(Collectors.toList());
-                for(String mailToCheck :emails)
-                if (email.equals(mailToCheck)&&vrabotenOpt.get().getVrabotenId()!=vrabotenId) {
-                    throw new IllegalStateException("email taken");
-                }
-                vrabotenOpt.get().setEmail(email);
-            } else {
-                throw new IllegalStateException("email not valid");
-            }
-            if(password.equals(confirmPass)){
-                vrabotenOpt.get().setPassword(bCryptPasswordEncoder.encode(password));
-            }
-            vrabotenOpt.get().setLocked(locked);
-
-            if (firstName != null && firstName.length() > 1 && !Objects.equals(vrabotenOpt.get().getFirstName(), firstName)) {
-                vrabotenOpt.get().setFirstName(firstName);
-            }
-
-            if (lastName != null && lastName.length() > 1 && !Objects.equals(vrabotenOpt.get().getLastName(), lastName)) {
-                vrabotenOpt.get().setLastName(lastName);
-            }
-
-            if (mobile != null && mobile.length() > 0 && !Objects.equals(vrabotenOpt.get().getMobile(), mobile)) {
-                vrabotenOpt.get().setMobile(mobile);
-            }
-
-//            if (status != null && status.toString().length() > 0) {
-//                if(Arrays.stream(EmployeeStatus.values()).toList().contains(EmployeeStatus.valueOf(status))){
-            vrabotenOpt.get().setStatus(status);
-//                }else{
-//                    throw new IllegalStateException("Please enter one of the following statuses: 'raboti', 'ne raboti', 'na odmor', 'na boleduvanje'");
-//                }
-//            }
-            if(parkingZones!=null){
-                List<ParkingZone> parkingZonesAvailable =parkingZoneRepository.findAll();
-                List<ParkingZone> zonesToAdd= new ArrayList<>();
-                vrabotenOpt.get().setParkingZones(null);
-                for(String pzName:parkingZones){
-                    for(ParkingZone pz :parkingZonesAvailable){
-                        if(pzName.equals(pz.getPzName())) {
-                            zonesToAdd.add(pz);
-//                            pz.getOdgovorniLica().add(vrabotenRepository.findByVrabotenId(vrabotenId));
-                        }
-                    }
-                }
-                vrabotenOpt.get().setParkingZones(zonesToAdd);
-            }
-            return vrabotenOpt.get();
-        }
-        else{
-            throw new IllegalStateException("Vraboten doesn't exist, therefore can't be updated");
-        }
-    }//za menjanje password da se implementira
-
-    @Transactional
-    public Optional<Vraboten> deleteVraboten(int vrabotenId) {
-        Optional<Vraboten> vrabotenOpt = Optional.ofNullable(this.vrabotenRepository.findByVrabotenId(vrabotenId));
-        if (vrabotenOpt.isPresent()) {
-            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");
-        }
-    }
-
-    @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);
-    }
-
-//    @Transactional
-//    public void setVrabotenStatus(int vrabotenId,String vrabotenStatus) {
-//        Vraboten vraboten = vrabotenRepository.findByVrabotenId(vrabotenId);
-//        if(vraboten!=null && value){
-//            vraboten.setStatus(valuee);
-//        }
-//        else {
-//            throw new IllegalStateException(String.format("Vraboten with id %d does not exist.",vrabotenId));
-//        }
-//    }
-}
Index: sources/app/src/main/java/parkup/services/WorkerService.java
===================================================================
--- sources/app/src/main/java/parkup/services/WorkerService.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
+++ sources/app/src/main/java/parkup/services/WorkerService.java	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -0,0 +1,200 @@
+package parkup.services;
+
+import java.util.*;
+import java.util.stream.Collectors;
+import javax.transaction.Transactional;
+import org.springframework.beans.factory.annotation.Autowired;
+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.data.WorkerDemoParkingZones;
+import parkup.data.enumarations.EmployeeStatus;
+import parkup.entities.ParkingZone;
+import parkup.entities.Worker;
+import parkup.repositories.ParkingZoneRepository;
+import parkup.repositories.WorkerRepository;
+import parkup.data.WorkerDemo;
+
+@Service
+public class WorkerService implements UserDetailsService {
+    private final WorkerRepository workerRepository;
+    private final ParkingZoneRepository parkingZoneRepository;
+    private final BCryptPasswordEncoder bCryptPasswordEncoder;
+
+    @Autowired
+    public WorkerService(WorkerRepository workerRepository, ParkingZoneRepository parkingZoneRepository, BCryptPasswordEncoder bCryptPasswordEncoder) {
+        this.workerRepository = workerRepository;
+        this.parkingZoneRepository = parkingZoneRepository;
+        this.bCryptPasswordEncoder = bCryptPasswordEncoder;
+    }
+
+    public List<Worker> getWorkers() {
+        return this.workerRepository.findAll();
+    }
+
+    public WorkerDemoParkingZones findById(int workerId) {
+        Worker worker = this.workerRepository.findByWorkerId(workerId);
+        WorkerDemoParkingZones workerToReturn = new WorkerDemoParkingZones(worker);
+        return workerToReturn;
+    }
+
+    public List<WorkerDemo> getAllVraboteniDemos() {
+        List<Worker> workers = this.workerRepository.findAll();
+        List<WorkerDemo> workerDemos = new ArrayList<>();
+        for (Worker v : workers){
+            WorkerDemo vd = new WorkerDemo(v.getWorkerId(),v.getFirstName(), v.getLastName(), v.getEmail());
+            workerDemos.add(vd);
+        }
+        return workerDemos;
+    }
+
+    public Optional<Worker> addWorker(String password, String confirmPass, boolean locked, String firstName, String lastName, String mobile, String email, EmployeeStatus status, List<String> parkingZones) {
+        Optional<Worker> workerOpt = this.workerRepository.findWorkerByEmail(email);
+        if (workerOpt.isPresent()){
+            throw new IllegalArgumentException("User with that mail already exists");
+        }
+        Worker workerToAdd =new Worker();
+        if (email != null && email.length() > 1 && email.contains("@") ) {
+            workerToAdd.setEmail(email);
+        } else {
+            throw new IllegalStateException("email not valid");
+        }
+        if(!password.isEmpty()&&password.equals(confirmPass)){
+            workerToAdd.setPassword(bCryptPasswordEncoder.encode(password));
+        }
+        workerToAdd.setLocked(locked);
+
+        if (firstName != null && firstName.length() > 1) {
+            workerToAdd.setFirstName(firstName);
+        }
+
+        if (lastName != null && lastName.length() > 1 ) {
+            workerToAdd.setLastName(lastName);
+        }
+
+        if (mobile != null && mobile.length() > 0 ) {
+            workerToAdd.setMobile(mobile);
+        }
+
+        workerToAdd.setStatus(status);
+
+        if(parkingZones!=null){
+            List<ParkingZone> parkingZonesAvailable =parkingZoneRepository.findAll();
+            List<ParkingZone> zonesToAdd= new ArrayList<>();
+            workerToAdd.setParkingZones(null);
+            for(String pzName:parkingZones){
+                for(ParkingZone pz :parkingZonesAvailable){
+                    if(pzName.equals(pz.getPzName())) {
+                        zonesToAdd.add(pz);
+//                            pz.getOdgovorniLica().add(vrabotenRepository.findByVrabotenId(vrabotenId));
+                    }
+                }
+            }
+            workerToAdd.setParkingZones(zonesToAdd);
+        }
+        workerRepository.save(workerToAdd);
+        return Optional.of(workerToAdd);
+    }
+
+    @Transactional
+    public WorkerDemoParkingZones updateWorker(int workerId, String password, String confirmPass, boolean locked, String firstName, String lastName, String mobile, String email, EmployeeStatus status, List<String> parkingZones) {
+        Optional<Worker> workerOpt = Optional.ofNullable(this.workerRepository.findByWorkerId(workerId));
+        if (workerOpt.isPresent()) {
+
+            if (email != null && email.length() > 1 && email.contains("@") ) {
+                List<String> emails = workerRepository.findAll().stream().map(Worker::getEmail).collect(Collectors.toList());
+                for(String mailToCheck :emails)
+                if (email.equals(mailToCheck)&&workerOpt.get().getWorkerId()!=workerId) {
+                    throw new IllegalStateException("email taken");
+                }
+                workerOpt.get().setEmail(email);
+            } else {
+                throw new IllegalStateException("email not valid");
+            }
+            if(!password.isEmpty()&&password.equals(confirmPass)){
+                workerOpt.get().setPassword(bCryptPasswordEncoder.encode(password));
+            }
+            workerOpt.get().setLocked(locked);
+
+            if (firstName != null && firstName.length() > 1 && !Objects.equals(workerOpt.get().getFirstName(), firstName)) {
+                workerOpt.get().setFirstName(firstName);
+            }
+
+            if (lastName != null && lastName.length() > 1 && !Objects.equals(workerOpt.get().getLastName(), lastName)) {
+                workerOpt.get().setLastName(lastName);
+            }
+
+            if (mobile != null && mobile.length() > 0 && !Objects.equals(workerOpt.get().getMobile(), mobile)) {
+                workerOpt.get().setMobile(mobile);
+            }
+
+//            if (status != null && status.toString().length() > 0) {
+//                if(Arrays.stream(EmployeeStatus.values()).toList().contains(EmployeeStatus.valueOf(status))){
+            workerOpt.get().setStatus(status);
+//                }else{
+//                    throw new IllegalStateException("Please enter one of the following statuses: 'raboti', 'ne raboti', 'na odmor', 'na boleduvanje'");
+//                }
+//            }
+            if(parkingZones!=null){
+                List<ParkingZone> parkingZonesAvailable =parkingZoneRepository.findAll();
+                List<ParkingZone> zonesToAdd= new ArrayList<>();
+                workerOpt.get().setParkingZones(null);
+                for(String pzName:parkingZones){
+                    for(ParkingZone pz :parkingZonesAvailable){
+                        if(pzName.equals(pz.getPzName())) {
+                            zonesToAdd.add(pz);
+//                            pz.getOdgovorniLica().add(vrabotenRepository.findByVrabotenId(workerId));
+                        }
+                    }
+                }
+                workerOpt.get().setParkingZones(zonesToAdd);
+            }
+//            VrabotenDemoParkingZones zoneToReturn = new VrabotenDemoParkingZones(workerOpt.get());
+            return new WorkerDemoParkingZones(workerOpt.get());
+        }
+        else{
+            throw new IllegalStateException("Worker doesn't exist, therefore can't be updated");
+        }
+    }//za menjanje password da se implementira
+
+    @Transactional
+    public Optional<Worker> deleteWorker(int workerId) {
+        Optional<Worker> workerOpt = Optional.ofNullable(this.workerRepository.findByWorkerId(workerId));
+        if (workerOpt.isPresent()) {
+            this.workerRepository.deleteByWorkerId(workerId);
+        } else {
+            throw new IllegalStateException("Worker doesn't exist, therefore can't be deleted");
+        }
+        return workerOpt;
+    }
+
+    @Transactional
+    public void lockWorkerAcc(int workerId) {
+        Worker workerOpt = this.workerRepository.findByWorkerId(workerId);
+        if (workerOpt !=null) {
+            workerOpt.lockVraboten();
+        } else {
+            throw new IllegalStateException("Worker doesn't exist, therefore his account can't be locked/unlocked");
+        }
+    }
+
+    @Override
+    public UserDetails loadUserByUsername(String email) throws UsernameNotFoundException {
+        return workerRepository.findWorkerByEmail(email)
+                .orElseThrow(() ->
+                        new UsernameNotFoundException("Email not found"));
+    }
+
+//    @Transactional
+//    public void setVrabotenStatus(int vrabotenId,String vrabotenStatus) {
+//        Vraboten vraboten = vrabotenRepository.findByVrabotenId(vrabotenId);
+//        if(vraboten!=null && value){
+//            vraboten.setStatus(valuee);
+//        }
+//        else {
+//            throw new IllegalStateException(String.format("Vraboten with id %d does not exist.",vrabotenId));
+//        }
+//    }
+}
Index: sources/app/src/main/resources/application.properties
===================================================================
--- sources/app/src/main/resources/application.properties	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ sources/app/src/main/resources/application.properties	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -7,15 +7,23 @@
 spring.jpa.properties.hibernate.format_sql=true
 
-spring.mail.host=localhost
-spring.mail.port=1025
-spring.mail.username=hello
-spring.mail.password=hello
+#spring.mail.host=localhost
+#spring.mail.port=1025
+#spring.mail.username=hello
+#spring.mail.password=hello
 
-spring.mail.properties.mail.transport.protocol=smtp
-spring.mail.properties.mail.smtp.ssl.trust="*"
-spring.mail.properties.mail.smtp.auth=false
-spring.mail.properties.mail.smtp.starttls.enable=false
-spring.mail.properties.mail.smtp.connectiontimeout=5000
-spring.mail.properties.mail.smtp.timeout=3000
-spring.mail.properties.mail.smtp.writetimeout=5000
+#spring.mail.properties.mail.transport.protocol=smtp
+#spring.mail.properties.mail.smtp.ssl.trust="*"
+#spring.mail.properties.mail.smtp.auth=false
+#spring.mail.properties.mail.smtp.starttls.enable=false
+#spring.mail.properties.mail.smtp.connectiontimeout=5000
+#spring.mail.properties.mail.smtp.timeout=3000
+#spring.mail.properties.mail.smtp.writetimeout=5000
 
+
+spring.mail.host=smtp.gmail.com
+spring.mail.port=587
+spring.mail.username=etnosfreelance@gmail.com
+spring.mail.password=gfjslyfsqkvlzoxw
+spring.mail.properties.mail.smtp.auth=true
+spring.mail.properties.mail.smtp.starttls.enable=true
+
Index: sources/app/target/classes/application.properties
===================================================================
--- sources/app/target/classes/application.properties	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ sources/app/target/classes/application.properties	(revision 9dd526f0ddf9a23ad37dd4c977f761ff959f5913)
@@ -2,20 +2,28 @@
 spring.datasource.username=postgres
 spring.datasource.password=1234
-spring.jpa.hibernate.ddl-auto=update
+spring.jpa.hibernate.ddl-auto=create-drop
 spring.jpa.show-sql=true
 spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
 spring.jpa.properties.hibernate.format_sql=true
 
-spring.mail.host=localhost
-spring.mail.port=1025
-spring.mail.username=hello
-spring.mail.password=hello
+#spring.mail.host=localhost
+#spring.mail.port=1025
+#spring.mail.username=hello
+#spring.mail.password=hello
 
-spring.mail.properties.mail.transport.protocol=smtp
-spring.mail.properties.mail.smtp.ssl.trust="*"
-spring.mail.properties.mail.smtp.auth=false
-spring.mail.properties.mail.smtp.starttls.enable=false
-spring.mail.properties.mail.smtp.connectiontimeout=5000
-spring.mail.properties.mail.smtp.timeout=3000
-spring.mail.properties.mail.smtp.writetimeout=5000
+#spring.mail.properties.mail.transport.protocol=smtp
+#spring.mail.properties.mail.smtp.ssl.trust="*"
+#spring.mail.properties.mail.smtp.auth=false
+#spring.mail.properties.mail.smtp.starttls.enable=false
+#spring.mail.properties.mail.smtp.connectiontimeout=5000
+#spring.mail.properties.mail.smtp.timeout=3000
+#spring.mail.properties.mail.smtp.writetimeout=5000
 
+
+spring.mail.host=smtp.gmail.com
+spring.mail.port=587
+spring.mail.username=etnosfreelance@gmail.com
+spring.mail.password=gfjslyfsqkvlzoxw
+spring.mail.properties.mail.smtp.auth=true
+spring.mail.properties.mail.smtp.starttls.enable=true
+
