Index: src/main/java/com/tourMate/TourMateApplication.java
===================================================================
--- src/main/java/com/tourMate/TourMateApplication.java	(revision 07f4e8b52fa18ab7781f9660c09d7982d8cd5a0b)
+++ src/main/java/com/tourMate/TourMateApplication.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -3,8 +3,17 @@
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.Bean;
+import org.springframework.mail.javamail.JavaMailSender;
+import org.springframework.mail.javamail.JavaMailSenderImpl;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
+import org.springframework.security.crypto.password.PasswordEncoder;
 import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+import java.util.Properties;
 
 @SpringBootApplication
 @EnableTransactionManagement
+@EnableScheduling
 public class TourMateApplication {
 
@@ -13,3 +22,26 @@
 	}
 
+	@Bean
+	public PasswordEncoder passwordEncoder() {
+		return new BCryptPasswordEncoder();
+	}
+
+	@Bean
+	public JavaMailSender getJavaMailSender() {
+		JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
+		mailSender.setHost("smtp.gmail.com");
+		mailSender.setPort(587);
+
+		mailSender.setUsername("trip2mk@gmail.com");
+		mailSender.setPassword("xarb ggqg mvmr zciw");
+
+		Properties props = mailSender.getJavaMailProperties();
+		props.put("mail.transport.protocol", "smtp");
+		props.put("mail.smtp.auth", "true");
+		props.put("mail.smtp.starttls.enable", "true");
+		props.put("mail.debug", "true");
+
+		return mailSender;
+	}
+
 }
Index: src/main/java/com/tourMate/config/SecurityConfig.java
===================================================================
--- src/main/java/com/tourMate/config/SecurityConfig.java	(revision 07f4e8b52fa18ab7781f9660c09d7982d8cd5a0b)
+++ src/main/java/com/tourMate/config/SecurityConfig.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -1,6 +1,8 @@
 package com.tourMate.config;
 
-import com.fasterxml.jackson.databind.ObjectMapper;
-import jakarta.servlet.http.HttpServletResponse;
+import com.tourMate.config.oauth2.CustomOAuth2FailureHandler;
+import com.tourMate.config.oauth2.CustomOAuth2SuccessHandler;
+import com.tourMate.config.oauth2.CustomOAuth2UserDetailService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
@@ -10,6 +12,4 @@
 import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
 import org.springframework.security.config.http.SessionCreationPolicy;
-import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
-import org.springframework.security.crypto.password.PasswordEncoder;
 import org.springframework.security.web.SecurityFilterChain;
 import org.springframework.security.web.authentication.logout.HttpStatusReturningLogoutSuccessHandler;
@@ -26,4 +26,10 @@
 
     private final UserSecurity userSecurity;
+    @Autowired
+    private CustomOAuth2UserDetailService customOAuth2UserDetailService;
+    @Autowired
+    private CustomOAuth2FailureHandler oAuth2FailureHandler;
+    @Autowired
+    private CustomOAuth2SuccessHandler oAuth2SuccessHandler;
 
     public SecurityConfig(UserSecurity userSecurity) {
@@ -56,8 +62,4 @@
         return bean;
     }
-    @Bean
-    public PasswordEncoder passwordEncoder() {
-        return new BCryptPasswordEncoder();
-    }
 
     @Bean
@@ -76,25 +78,24 @@
                                         .requestMatchers(new AntPathRequestMatcher("/upload")).permitAll()
                                         .requestMatchers(new AntPathRequestMatcher("/business/approve/*")).hasAnyAuthority("SUPERADMIN")
+                                        .requestMatchers(new AntPathRequestMatcher("/users/unlock/*")).hasAnyAuthority("SUPERADMIN")
+                                        .requestMatchers(new AntPathRequestMatcher("/users/approve/*")).hasAnyAuthority("SUPERADMIN")
+                                        .requestMatchers(new AntPathRequestMatcher("/business/unapproved")).hasAnyAuthority("SUPERADMIN")
                                         .requestMatchers(new AntPathRequestMatcher("/business/add/*")).authenticated()
                                         .requestMatchers(new AntPathRequestMatcher("/*/user/{userId}")).access(userSecurity)
-                                        .anyRequest().permitAll()
-//                                        .anyRequest().authenticated()
+//                                        .anyRequest().permitAll()
+                                        .anyRequest().authenticated()
+                                        .and()
+                                        .oauth2Login()
+                                        .loginPage("/login")
+                                        .permitAll()
+                                        .userInfoEndpoint(x -> x.userService(customOAuth2UserDetailService))
+//                                        .userService(customOAuth2UserDetailService)
+                                        .successHandler(oAuth2SuccessHandler)
+                                        .failureHandler(oAuth2FailureHandler)
                                         .and()
                                         .formLogin()
-                                        .loginProcessingUrl("/api/login").usernameParameter("username").passwordParameter("password")
-                                        .successHandler((request, response, authentication) -> {
-                                            response.setStatus(HttpServletResponse.SC_OK);
-                                            response.setCharacterEncoding("UTF-8");
-                                            response.setContentType("application/json");
-                                            response.getWriter().print("{\"message\": \"Login successful\",");
-                                            response.getWriter().print("\"auth\":" + new ObjectMapper().writeValueAsString(authentication) + "}");
-                                            response.getWriter().flush();
-                                        })
-                                        .failureHandler((request, response, exception) -> {
-                                            response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
-                                            response.sendRedirect("/login");
-                                            response.getWriter().print("Neuspesna najava\n" + exception.getMessage());
-                                            response.getWriter().flush();
-                                        })
+                                        .loginPage("/login")
+                                        .successHandler(oAuth2SuccessHandler)
+                                        .permitAll()
                                         .permitAll()
                                         .and()
Index: src/main/java/com/tourMate/config/UserSecurity.java
===================================================================
--- src/main/java/com/tourMate/config/UserSecurity.java	(revision 07f4e8b52fa18ab7781f9660c09d7982d8cd5a0b)
+++ src/main/java/com/tourMate/config/UserSecurity.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -1,4 +1,6 @@
 package com.tourMate.config;
 
+import com.tourMate.config.oauth2.CustomOAuth2UserDetailService;
+import com.tourMate.config.oauth2.OAuth2UserDetailsCustom;
 import com.tourMate.entities.Hotels;
 import com.tourMate.entities.User;
@@ -25,8 +27,15 @@
     public boolean hasUserId(Authentication authentication, Long userId) {
         System.out.println(userId);
-        User user = (User) authentication.getPrincipal();
-        System.out.println(user.getUserID());
-        System.out.println(authentication.getPrincipal());
-        return userId == user.getUserID();
+        Long id;
+        if(authentication.getPrincipal() instanceof OAuth2UserDetailsCustom oAuth2UserDetailsCustom)
+        {
+            id = oAuth2UserDetailsCustom.getId();
+        }
+        else
+        {
+            User user = (User) authentication.getPrincipal();
+            id = user.getUserID();
+        }
+        return userId == id;
     }
 
Index: src/main/java/com/tourMate/config/oauth2/CustomOAuth2FailureHandler.java
===================================================================
--- src/main/java/com/tourMate/config/oauth2/CustomOAuth2FailureHandler.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
+++ src/main/java/com/tourMate/config/oauth2/CustomOAuth2FailureHandler.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -0,0 +1,18 @@
+package com.tourMate.config.oauth2;
+
+import jakarta.servlet.ServletException;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+import org.springframework.security.core.AuthenticationException;
+import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler;
+import org.springframework.stereotype.Component;
+
+import java.io.IOException;
+
+@Component
+public class CustomOAuth2FailureHandler extends SimpleUrlAuthenticationFailureHandler {
+    @Override
+    public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException {
+        getRedirectStrategy().sendRedirect(request, response, "/login");
+    }
+}
Index: src/main/java/com/tourMate/config/oauth2/CustomOAuth2SuccessHandler.java
===================================================================
--- src/main/java/com/tourMate/config/oauth2/CustomOAuth2SuccessHandler.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
+++ src/main/java/com/tourMate/config/oauth2/CustomOAuth2SuccessHandler.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -0,0 +1,19 @@
+package com.tourMate.config.oauth2;
+
+import jakarta.servlet.ServletException;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.web.authentication.SimpleUrlAuthenticationSuccessHandler;
+import org.springframework.stereotype.Component;
+
+import java.io.IOException;
+
+@Component
+public class CustomOAuth2SuccessHandler extends SimpleUrlAuthenticationSuccessHandler {
+    @Override
+    public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException {
+//        OAuth2UserDetailsCustom oAuth2UserDetailsCustom = (OAuth2UserDetailsCustom) authentication.getPrincipal();
+        getRedirectStrategy().sendRedirect(request, response, "http://localhost:3000/login-callback");
+    }
+}
Index: src/main/java/com/tourMate/config/oauth2/CustomOAuth2UserDetailService.java
===================================================================
--- src/main/java/com/tourMate/config/oauth2/CustomOAuth2UserDetailService.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
+++ src/main/java/com/tourMate/config/oauth2/CustomOAuth2UserDetailService.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -0,0 +1,93 @@
+package com.tourMate.config.oauth2;
+
+import com.tourMate.dao.UsersDao;
+import com.tourMate.entities.Role;
+import com.tourMate.entities.User;
+import org.springframework.security.core.AuthenticationException;
+import org.springframework.security.core.authority.SimpleGrantedAuthority;
+import org.springframework.security.oauth2.client.userinfo.DefaultOAuth2UserService;
+import org.springframework.security.oauth2.client.userinfo.OAuth2UserRequest;
+import org.springframework.security.oauth2.core.OAuth2AuthenticationException;
+import org.springframework.security.oauth2.core.user.OAuth2User;
+import org.springframework.stereotype.Service;
+import org.springframework.util.ObjectUtils;
+
+import java.util.Collections;
+import java.util.Objects;
+
+@Service
+public class CustomOAuth2UserDetailService extends DefaultOAuth2UserService {
+
+    private final UsersDao usersDao;
+
+    public CustomOAuth2UserDetailService(UsersDao usersDao) {
+        this.usersDao = usersDao;
+    }
+
+    @Override
+    public OAuth2User loadUser(OAuth2UserRequest userRequest) throws OAuth2AuthenticationException {
+        OAuth2User oAuth2User = super.loadUser(userRequest);
+
+        try
+        {
+            return checkOAuth2User(userRequest, oAuth2User);
+        }
+        catch (AuthenticationException e)
+        {
+            throw e;
+        }
+        catch (Exception ex)
+        {
+            throw ex;
+            //throw new InternalAuthenticationServiceException(ex.getMessage(), ex.getCause());
+        }
+    }
+
+    private OAuth2User checkOAuth2User(OAuth2UserRequest oAuth2UserRequest, OAuth2User oAuth2User)
+    {
+        OAuth2UserDetails oAuth2UserDetails = OAuth2UserDetailsFactory
+                .createOAuth2UserDetails(oAuth2UserRequest.getClientRegistration().getRegistrationId(), oAuth2User.getAttributes());
+
+        if(ObjectUtils.isEmpty(oAuth2UserRequest))
+        {
+            throw new RuntimeException("Cannot identifty OAuth2 user!");
+        }
+
+        User user = usersDao.findByUsernameAndProvider(
+                oAuth2UserDetails.getEmail(),
+                oAuth2UserRequest.getClientRegistration().getRegistrationId());
+        User userDetails = null;
+        if(user != null)
+        {
+            userDetails = user;
+            userDetails = updateOAuth2UserDetail(userDetails, oAuth2UserDetails);
+        }
+        else
+        {
+            userDetails = registerOAuth2UserDetail(oAuth2UserRequest, oAuth2UserDetails);
+        }
+        return new OAuth2UserDetailsCustom(
+                userDetails.getUserID(),
+                userDetails.getUsername(),
+                userDetails.getPassword(),
+                Collections.singletonList(new SimpleGrantedAuthority(userDetails.getRole().getRoleName()))
+        );
+    }
+
+    public User registerOAuth2UserDetail(OAuth2UserRequest oAuth2UserRequest, OAuth2UserDetails oAuth2UserDetails)
+    {
+        Role r = usersDao.findById(1L);
+        User user = new User();
+        user.setName(Objects.requireNonNullElse(oAuth2UserDetails.getName(), ""));
+        user.setEmail(oAuth2UserDetails.getEmail());
+        user.setProvider(oAuth2UserRequest.getClientRegistration().getRegistrationId());
+        user.setRole(r);
+        return usersDao.updateUser(user);
+    }
+
+    public User updateOAuth2UserDetail(User user, OAuth2UserDetails oAuth2UserDetails)
+    {
+        user.setEmail(oAuth2UserDetails.getEmail());
+        return usersDao.mergeUser(user);
+    }
+}
Index: src/main/java/com/tourMate/config/oauth2/OAuth2FacebookUser.java
===================================================================
--- src/main/java/com/tourMate/config/oauth2/OAuth2FacebookUser.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
+++ src/main/java/com/tourMate/config/oauth2/OAuth2FacebookUser.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -0,0 +1,19 @@
+package com.tourMate.config.oauth2;
+
+import java.util.Map;
+
+public class OAuth2FacebookUser extends OAuth2UserDetails{
+    public OAuth2FacebookUser(Map<String, Object> attributes) {
+        super(attributes);
+    }
+
+    @Override
+    public String getName() {
+        return (String) attributes.get("name");
+    }
+
+    @Override
+    public String getEmail() {
+        return (String) attributes.get("email");
+    }
+}
Index: src/main/java/com/tourMate/config/oauth2/OAuth2GitHubUser.java
===================================================================
--- src/main/java/com/tourMate/config/oauth2/OAuth2GitHubUser.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
+++ src/main/java/com/tourMate/config/oauth2/OAuth2GitHubUser.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -0,0 +1,19 @@
+package com.tourMate.config.oauth2;
+
+import java.util.Map;
+
+public class OAuth2GitHubUser extends OAuth2UserDetails{
+    public OAuth2GitHubUser(Map<String, Object> attributes) {
+        super(attributes);
+    }
+
+    @Override
+    public String getName() {
+        return (String) attributes.get("name");
+    }
+
+    @Override
+    public String getEmail() {
+        return (String) attributes.get("login");
+    }
+}
Index: src/main/java/com/tourMate/config/oauth2/OAuth2GoogleUser.java
===================================================================
--- src/main/java/com/tourMate/config/oauth2/OAuth2GoogleUser.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
+++ src/main/java/com/tourMate/config/oauth2/OAuth2GoogleUser.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -0,0 +1,19 @@
+package com.tourMate.config.oauth2;
+
+import java.util.Map;
+
+public class OAuth2GoogleUser extends OAuth2UserDetails{
+    public OAuth2GoogleUser(Map<String, Object> attributes) {
+        super(attributes);
+    }
+
+    @Override
+    public String getName() {
+        return (String) attributes.get("name");
+    }
+
+    @Override
+    public String getEmail() {
+        return (String) attributes.get("email");
+    }
+}
Index: src/main/java/com/tourMate/config/oauth2/OAuth2UserDetails.java
===================================================================
--- src/main/java/com/tourMate/config/oauth2/OAuth2UserDetails.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
+++ src/main/java/com/tourMate/config/oauth2/OAuth2UserDetails.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -0,0 +1,14 @@
+package com.tourMate.config.oauth2;
+
+import java.util.Map;
+
+public abstract class OAuth2UserDetails {
+    protected Map<String, Object> attributes;
+
+    public OAuth2UserDetails(Map<String, Object> attributes) {
+        this.attributes = attributes;
+    }
+
+    public abstract String getName();
+    public abstract String getEmail();
+}
Index: src/main/java/com/tourMate/config/oauth2/OAuth2UserDetailsCustom.java
===================================================================
--- src/main/java/com/tourMate/config/oauth2/OAuth2UserDetailsCustom.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
+++ src/main/java/com/tourMate/config/oauth2/OAuth2UserDetailsCustom.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -0,0 +1,83 @@
+package com.tourMate.config.oauth2;
+
+import jakarta.persistence.Column;
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.security.oauth2.core.user.OAuth2User;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+public class OAuth2UserDetailsCustom implements OAuth2User, UserDetails {
+
+    Long id;
+    String username;
+    String password;
+    List<GrantedAuthority> authorities;
+    Map<String, Object> attributes;
+    Boolean locked = true;
+    Boolean enabled = true;
+    Boolean expired = false;
+
+
+    public OAuth2UserDetailsCustom(Long id, String username, String password, List<GrantedAuthority> authorities) {
+        this.id = id;
+        this.username = username;
+        this.password = password;
+        this.authorities = authorities;
+    }
+
+    @Override
+    public String getPassword() {
+        return password;
+    }
+
+    @Override
+    public String getUsername() {
+        return username;
+    }
+
+    @Override
+    public boolean isAccountNonExpired() {
+        return expired;
+    }
+
+    @Override
+    public boolean isAccountNonLocked() {
+        return locked;
+    }
+
+    @Override
+    public boolean isCredentialsNonExpired() {
+        return true;
+    }
+
+    @Override
+    public boolean isEnabled() {
+        return enabled;
+    }
+
+    @Override
+    public Map<String, Object> getAttributes() {
+        return attributes;
+    }
+
+    @Override
+    public Collection<? extends GrantedAuthority> getAuthorities() {
+        return authorities;
+    }
+
+    @Override
+    public String getName() {
+        return String.valueOf(id);
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+}
Index: src/main/java/com/tourMate/config/oauth2/OAuth2UserDetailsFactory.java
===================================================================
--- src/main/java/com/tourMate/config/oauth2/OAuth2UserDetailsFactory.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
+++ src/main/java/com/tourMate/config/oauth2/OAuth2UserDetailsFactory.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -0,0 +1,27 @@
+package com.tourMate.config.oauth2;
+
+import com.tourMate.entities.Providers;
+
+import java.util.Map;
+
+public class OAuth2UserDetailsFactory {
+    public static OAuth2UserDetails createOAuth2UserDetails (String registrationId, Map<String, Object> attributes)
+    {
+        if(registrationId.equals(Providers.google.name()))
+        {
+            return new OAuth2GoogleUser(attributes);
+        }
+        else if(registrationId.equals(Providers.facebook.name()))
+        {
+            return new OAuth2FacebookUser(attributes);
+        }
+        else if(registrationId.equals(Providers.github.name()))
+        {
+            return new OAuth2GitHubUser(attributes);
+        }
+        else
+        {
+            throw  new RuntimeException("Login with this provider is not supported!");
+        }
+    }
+}
Index: src/main/java/com/tourMate/controllers/HotelController.java
===================================================================
--- src/main/java/com/tourMate/controllers/HotelController.java	(revision 07f4e8b52fa18ab7781f9660c09d7982d8cd5a0b)
+++ src/main/java/com/tourMate/controllers/HotelController.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -35,5 +35,4 @@
             return ResponseEntity.ok(hoteli);
         } catch (Exception e) {
-            // Handle the exception, log it, and return an error response
             return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null);
         }
@@ -41,8 +40,6 @@
 
     @GetMapping(path = "/hotel/user/{id}")
-    public ResponseEntity<List<Hotels>> getHotelsForUser (@PathVariable(name = "id") long userId)
-    {
-        try {
-
+    public ResponseEntity<List<Hotels>> getHotelsForUser(@PathVariable(name = "id") long userId) {
+        try {
             List<Hotels> hoteli = hotelManager.getHotelsForUser(userId);
             return ResponseEntity.ok(hoteli);
@@ -53,8 +50,6 @@
 
     @GetMapping(path = "/hotel/{id}/list")
-    public ResponseEntity<Hotels> getHotelById (@PathVariable(name = "id") long hotelId)
-    {
-        try {
-
+    public ResponseEntity<Hotels> getHotelById(@PathVariable(name = "id") long hotelId) {
+        try {
             return ResponseEntity.ok(hotelManager.findHotelByID(hotelId));
         } catch (Exception e) {
@@ -65,6 +60,5 @@
 
     @PostMapping(path = "/hotel/edit")
-    public void edit(@RequestBody Hotels hotel)
-    {
+    public void edit(@RequestBody Hotels hotel) {
         hotelManager.editHotel(hotel.getHotelId(), hotel.getHotelName(), hotel.getHotelDescripiton(), hotel.getHotelLocation(), hotel.getHotelEDBS(), hotel.getParking(), hotel.getPetFriendly(), hotel.getInternetAvailable());
     }
@@ -72,15 +66,11 @@
     @GetMapping(path = "/hotel/delete")
     public ResponseEntity remove(@RequestParam(name = "hotelId") long hotelId) {
-        try
-        {
+        try {
             hotelManager.deleteHotel(hotelId);
             return new ResponseEntity(HttpStatus.OK);
-        }
-        catch (Exception exception)
-        {
-            return new ResponseEntity(HttpStatus.NOT_FOUND);
-        }
-    }
-
+        } catch (Exception exception) {
+            return new ResponseEntity(HttpStatus.NOT_FOUND);
+        }
+    }
 
 
@@ -90,6 +80,5 @@
             hotelManager.deleteHotelImage(hotelId);
             return new ResponseEntity(HttpStatus.OK);
-        }
-        catch (Exception exception) {
+        } catch (Exception exception) {
             return new ResponseEntity(HttpStatus.NOT_FOUND);
         }
@@ -97,6 +86,5 @@
 
     @GetMapping(path = "/hotel/{id}/room")
-    public List<HotelRoom> getHotelRooms(@PathVariable(value = "id") long hotelId)
-    {
+    public List<HotelRoom> getHotelRooms(@PathVariable(value = "id") long hotelId) {
         System.out.println("ovde so id: " + hotelId);
         return hotelManager.getRoomsOfHotel(hotelId);
@@ -108,6 +96,5 @@
     public void addRoom(@RequestBody HotelRoom room,
                         @RequestParam(name = "hotelId") long hotelId) {
-        Hotels h = hotelManager.findHotelByID(hotelId);
-        hotelManager.createRoom(h, room.getHotelRoomDescription(), room.getHotelRoomName(), room.getKitchenAvailable(), room.getAirConditioning(), room.getBalcony(), room.getPrice(), room.getNumOfBeds());
+        hotelManager.createRoom(hotelId, room.getHotelRoomDescription(), room.getHotelRoomName(), room.getKitchenAvailable(), room.getAirConditioning(), room.getBalcony(), room.getPrice(), room.getNumOfBeds());
     }
 
@@ -119,11 +106,8 @@
     @GetMapping(path = "/hotel/rooms/delete")
     public ResponseEntity removeRoom(@RequestParam(name = "hotelRoomId") long hotelRoomId) {
-        try
-        {
+        try {
             hotelManager.deleteRoom(hotelRoomId);
             return new ResponseEntity(HttpStatus.OK);
-        }
-        catch (Exception exception)
-        {
+        } catch (Exception exception) {
             return new ResponseEntity(HttpStatus.NOT_FOUND);
         }
@@ -139,40 +123,31 @@
     @GetMapping(path = "/hotel/rooms/reservation/delete")
     public ResponseEntity removeReservation(@RequestParam(name = "hotelRoomReservationId") long hotelRoomReservationId) {
-        try
-        {
+        try {
             hotelManager.deleteReservation(hotelRoomReservationId);
             return new ResponseEntity(HttpStatus.OK);
-        }
-        catch (Exception exception)
-        {
-            return new ResponseEntity(HttpStatus.NOT_FOUND);
-        }
-    }
-
-        //HOTEL AVAILABILITY CRUD
+        } catch (Exception exception) {
+            return new ResponseEntity(HttpStatus.NOT_FOUND);
+        }
+    }
+
+    //HOTEL AVAILABILITY CRUD
     @PostMapping(path = "/hotel/rooms/available/{id}/add")
     public void addRoomAvailible(@RequestBody HotelRoomAvailable hotelRoomAvailable,
-                                 @PathVariable long id)
-    {
-        HotelRoom hotelRoom = hotelManager.findRoomById(id);
-        hotelManager.createRoomAvailible(hotelRoom, hotelRoomAvailable.getDateFrom(), hotelRoomAvailable.getDateTo(), hotelRoomAvailable.getNumberOfBeds());
+                                 @PathVariable long id) {
+
+        hotelManager.createRoomAvailible(id, hotelRoomAvailable.getDateFrom(), hotelRoomAvailable.getDateTo(), hotelRoomAvailable.getNumberOfBeds());
     }
 
     @PostMapping(path = "/hotel/rooms/available/edit")
-    public void editRoomAvailible(@RequestBody HotelRoomAvailable hotelRoomAvailable)
-    {
+    public void editRoomAvailible(@RequestBody HotelRoomAvailable hotelRoomAvailable) {
         hotelManager.editRoomAvailible(hotelRoomAvailable.getHotelRoomAvailableId(), hotelRoomAvailable.getHotelRoom(), hotelRoomAvailable.getDateFrom(), hotelRoomAvailable.getDateTo(), hotelRoomAvailable.getNumberOfBeds());
     }
 
     @GetMapping(path = "/hotel/rooms/available/remove")
-    public ResponseEntity removeRoomAvailible(@RequestParam(name = "hotelRoomAvailibleId") long hotelRoomAvailibleId)
-    {
-        try
-        {
+    public ResponseEntity removeRoomAvailible(@RequestParam(name = "hotelRoomAvailibleId") long hotelRoomAvailibleId) {
+        try {
             hotelManager.deleteRoomAvailible(hotelRoomAvailibleId);
             return new ResponseEntity(HttpStatus.OK);
-        }
-        catch (Exception ex)
-        {
+        } catch (Exception ex) {
             return new ResponseEntity(HttpStatus.NOT_FOUND);
         }
@@ -180,6 +155,5 @@
 
     @GetMapping(path = "hotel/rooms/{id}/available")
-    public List<HotelRoomAvailable> getRoomAvailability(@PathVariable Long id)
-    {
+    public List<HotelRoomAvailable> getRoomAvailability(@PathVariable Long id) {
         return hotelManager.getRoomsAvailableById(id);
     }
@@ -190,19 +164,15 @@
                                                @RequestParam(name = "dateTo") @DateTimeFormat(pattern = "yyyy-MM-dd") Date dateTo,
                                                @RequestParam(name = "numBeds") int numBeds,
-                                               @RequestParam(name = "flexible") Boolean flexible)
-    {
-        System.out.println(flexible);
-        System.out.println(dateFrom + " " + dateTo);
+                                               @RequestParam(name = "flexible") Boolean flexible) {
         return hotelManager.getRoomsAvailibilityByDateAndLocation(hotelLocation, dateFrom, dateTo, numBeds, flexible);
     }
 
     @PostMapping(path = "/hotel/reserve")
-    public void reserveHotelRoom(@RequestParam(name = "hotelRoomId")Long hotelRoomId,
+    public void reserveHotelRoom(@RequestParam(name = "hotelRoomId") Long hotelRoomId,
                                  @RequestParam(name = "userId") Long userId,
                                  @RequestParam(name = "hotelRoomAvailableId") Long hotelRoomAvailableId,
                                  @RequestParam(name = "numberOfBeds") Integer numberOfBeds,
                                  @RequestParam(name = "from") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) Date from,
-                                 @RequestParam(name = "to") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) Date to){
-
+                                 @RequestParam(name = "to") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) Date to) {
 
 
@@ -211,35 +181,30 @@
 
     @GetMapping(path = "/hotel/{id}/reservations/active")
-    public List<HotelReservationDto> getActiveReservationsForHotel(@PathVariable Long id)
-    {
+    public List<HotelReservationDto> getActiveReservationsForHotel(@PathVariable Long id) {
         return hotelManager.findVaidReseravtionsByHotel(id);
     }
 
     @GetMapping(path = "/hotel/reservations/user/{id}")
-    public List<HotelReservationUserDto> getActiveReservationsForUser(@PathVariable Long id)
-    {
+    public List<HotelReservationUserDto> getActiveReservationsForUser(@PathVariable Long id) {
         return hotelManager.findValidHotelReservationsByUser(id);
     }
 
     @GetMapping(path = "/hotel/reservations/user/{id}/past")
-    public List<HotelReservationUserDto> getPastReservationsForUser(@PathVariable Long id)
-    {
+    public List<HotelReservationUserDto> getPastReservationsForUser(@PathVariable Long id) {
         return hotelManager.findPastHotelReservationsByUser(id);
     }
 
     @GetMapping(path = "/hotel/{id}/images")
-    public List<HotelsImages> getImagesForHotel(@PathVariable Long id)
-    {
+    public List<HotelsImages> getImagesForHotel(@PathVariable Long id) {
         return hotelManager.getHotelImages(id);
     }
 
     @GetMapping(path = "/room/{id}/images")
-    public List<HotelRoomImages> getImagesForHotelRoom(@PathVariable Long id)
-    {
+    public List<HotelRoomImages> getImagesForHotelRoom(@PathVariable Long id) {
         return hotelManager.getRoomImages(id);
     }
 
     @PostMapping("/hotel/{id}/cancel")
-    public void cancelHotelReservation(@PathVariable Long id){
+    public void cancelHotelReservation(@PathVariable Long id) {
         hotelManager.deleteReservation(id);
     }
Index: src/main/java/com/tourMate/controllers/RestaurantController.java
===================================================================
--- src/main/java/com/tourMate/controllers/RestaurantController.java	(revision 07f4e8b52fa18ab7781f9660c09d7982d8cd5a0b)
+++ src/main/java/com/tourMate/controllers/RestaurantController.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -6,4 +6,5 @@
 import com.tourMate.dto.RestaurantReservationUserDto;
 import com.tourMate.entities.*;
+import com.tourMate.services.MenuManager;
 import com.tourMate.services.RestaurantManager;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -23,4 +24,6 @@
     @Autowired
     RestaurantManager restaurantManager;
+    @Autowired
+    MenuManager menuManager;
 
     @PostMapping(path = "/restaurant/add")
@@ -34,4 +37,13 @@
     public void addMenu(@PathVariable(name = "id") long restaurantId, @RequestBody Menu menu) {
         restaurantManager.addMenuToRestaurant(restaurantId, menu);
+    }
+
+    @PostMapping(path = "/menu/{id}/edit")
+    public void editMenu(@PathVariable Long id,
+                         @RequestParam String name,
+                         @RequestParam String ingredients,
+                         @RequestParam double price)
+    {
+        menuManager.editMenu(id, name, ingredients, price);
     }
 
@@ -149,13 +161,6 @@
                                                          @RequestParam(name = "hourTo") String hourTo,
                                                          @RequestParam(name = "numPeople") int noSeats) {
-        Date dateFrom = date;
-        Date dateTo = Date.from(date.toInstant());
-        String[] splittedFrom = hourFrom.split(":");
-        String[] splittedTo = hourTo.split(":");
-        dateFrom.setHours(Integer.parseInt(splittedFrom[0]));
-        dateFrom.setMinutes(Integer.parseInt(splittedFrom[1]));
-        dateTo.setHours(Integer.parseInt(splittedTo[0]));
-        dateTo.setMinutes(Integer.parseInt(splittedTo[1]));
-        return restaurantManager.getTablesByDateAndLocation(restaurantLocation, dateFrom, dateTo, noSeats);
+
+        return restaurantManager.getTablesByDateAndLocation(restaurantLocation, date, hourFrom, hourTo, noSeats);
     }
 
Index: src/main/java/com/tourMate/controllers/ReviewController.java
===================================================================
--- src/main/java/com/tourMate/controllers/ReviewController.java	(revision 07f4e8b52fa18ab7781f9660c09d7982d8cd5a0b)
+++ src/main/java/com/tourMate/controllers/ReviewController.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -28,5 +28,4 @@
     public void edit(@RequestBody Reviews review)
     {
-//        editReview(long id, String title, String description, int numStar, Hotels hotel, Restaurants restaurant, Transport transport)
         reviewManager.editReview(review.getReviewId(), review.getTitle(), review.getDescription(), review.getNumStar(), review.getHotel(), review.getRestaurant(), review.getTransport());
     }
Index: src/main/java/com/tourMate/controllers/TransportController.java
===================================================================
--- src/main/java/com/tourMate/controllers/TransportController.java	(revision 07f4e8b52fa18ab7781f9660c09d7982d8cd5a0b)
+++ src/main/java/com/tourMate/controllers/TransportController.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -84,11 +84,6 @@
     @PostMapping(path = "/transport/available/add")
     public void add(@RequestBody TransportAvailible transportAvailable, @RequestParam(name = "transportId") long transportId) {
-        Transport t = transportManager.getTransportById(transportId);
-        List<TransportRoute> routes = transportAvailable.getRoutes().stream().toList();
-        routes.get(0).setDeparture(transportAvailable.getDate());
-        transportAvailable.setTime(routes.get(routes.size() - 1).getArrival());
-        routes.forEach(x -> x.setParentRoute(transportAvailable));
-        transportAvailable.setTransport(t);
-        transportManager.createTransportAvailable(transportAvailable.getTransport(), transportAvailable.getFrom(), transportAvailable.getTo(), transportAvailable.getDate(), transportAvailable.getFreeSpace(), transportAvailable.getTime(), routes);
+
+        transportManager.createTransportAvailable(transportAvailable, transportAvailable.getTransport(), transportAvailable.getFrom(), transportAvailable.getTo(), transportAvailable.getDate(), transportAvailable.getFreeSpace(), transportAvailable.getTime(), transportId, transportAvailable.getRoutes());
     }
 
Index: src/main/java/com/tourMate/controllers/UsersController.java
===================================================================
--- src/main/java/com/tourMate/controllers/UsersController.java	(revision 07f4e8b52fa18ab7781f9660c09d7982d8cd5a0b)
+++ src/main/java/com/tourMate/controllers/UsersController.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -1,6 +1,8 @@
 package com.tourMate.controllers;
 
+import com.tourMate.dto.PrincipalInfo;
 import com.tourMate.entities.Business;
 import com.tourMate.entities.User;
+import com.tourMate.config.oauth2.OAuth2UserDetailsCustom;
 import com.tourMate.services.BusinessManager;
 import com.tourMate.services.UsersManager;
@@ -9,4 +11,5 @@
 import org.springframework.http.ResponseEntity;
 import org.springframework.security.core.Authentication;
+import org.springframework.security.core.parameters.P;
 import org.springframework.web.bind.annotation.*;
 
@@ -57,6 +60,4 @@
         usersManager.approveUserProfile(userId);
         return new ResponseEntity<>(HttpStatus.OK);
-
-
     }
 
@@ -70,5 +71,4 @@
     @PostMapping(path = "/register")
     public List<User> add(@RequestBody User user) {
-        System.out.println(user.getName() + user.getSurname());
         usersManager.createUser(user.getName(), user.getSurname(), user.getEmail(), user.getBirthDate(), user.getAddress(), user.getContact());
         return usersManager.getCreatedUsers();
@@ -88,34 +88,57 @@
     @GetMapping(value = "/principal")
     @ResponseBody
-    public User currentUser(Authentication authentication) {
-        return (User) authentication.getPrincipal();
+    public PrincipalInfo currentUser(Authentication authentication) {
+        Long id;
+        if(authentication.getPrincipal() instanceof OAuth2UserDetailsCustom)
+        {
+            OAuth2UserDetailsCustom oAuth2UserDetailsCustom = (OAuth2UserDetailsCustom) authentication.getPrincipal();
+            id = oAuth2UserDetailsCustom.getId();
+        }
+        else
+        {
+            User user = (User) authentication.getPrincipal();
+            id = user.getUserID();
+        }
+        return usersManager.getPrincipalInfo(id);
     }
     @PostMapping(path = "/user/edit")
-    public List<User> edit(@RequestBody User user)
+    public void edit(@RequestBody User user)
     {
-        System.out.println(user.getName() + " " + user.getSurname() + "id e " + user.getUserID());
-        // long userID, String name, String surname, String email, Date birthDate, String address, String contact
         usersManager.editUser(user.getUserID(), user.getName(), user.getSurname(), user.getEmail(), user.getBirthDate(), user.getAddress(), user.getContact());
-        return usersManager.getCreatedUsers();
     }
 
     @GetMapping(path = "/user/delete")
-    public ResponseEntity remove(@RequestParam(name = "userId") long userId) {
+    public ResponseEntity<?> remove(@RequestParam(name = "userId") long userId) {
         try
         {
             usersManager.deleteUser(userId);
-            return new ResponseEntity(HttpStatus.OK);
+            return new ResponseEntity<>(HttpStatus.OK);
         }
         catch (Exception exception)
         {
-            return new ResponseEntity(HttpStatus.NOT_FOUND);
+            return new ResponseEntity<>(HttpStatus.NOT_FOUND);
         }
     }
 
     @GetMapping("/users/unlock/{id}")
-    public ResponseEntity unlock(@PathVariable Long id)
+    public ResponseEntity<?> unlock(@PathVariable Long id)
     {
         usersManager.unlock(id);
-        return new ResponseEntity(HttpStatus.OK);
+        return new ResponseEntity<>(HttpStatus.OK);
+    }
+
+    @PostMapping("/users/{id}/connect")
+    public ResponseEntity<?> connectAccount(@PathVariable Long id,
+                                            @RequestParam String username,
+                                            @RequestParam String password)
+    {
+        usersManager.connectAccount(id, username, password);
+        return new ResponseEntity<>(HttpStatus.OK);
+    }
+
+    @GetMapping("/users/{id}/connected")
+    public List<User> getConnectedAccounts(@PathVariable Long id)
+    {
+        return usersManager.findConnectedAccountsByUser(id);
     }
 }
Index: src/main/java/com/tourMate/controllers/UtilsController.java
===================================================================
--- src/main/java/com/tourMate/controllers/UtilsController.java	(revision 07f4e8b52fa18ab7781f9660c09d7982d8cd5a0b)
+++ src/main/java/com/tourMate/controllers/UtilsController.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -2,4 +2,5 @@
 
 import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RestController;
@@ -10,15 +11,10 @@
 import java.net.http.HttpResponse;
 
-@RestController
+@Controller
 public class UtilsController {
-    @GetMapping("/loo")
-    public ResponseEntity<?> testFnc(RedirectAttributes attributes) {
-        String redirectUrl = "https://example.com"; // Replace with your desired redirect URL
-
-        // Using UriComponentsBuilder to handle URL encoding
-        return ResponseEntity
-                .status(302) // 302 Found status code for redirect
-                .location(UriComponentsBuilder.fromUriString(redirectUrl).build().toUri())
-                .build();
+    @GetMapping("/login")
+    public String getLoginPage()
+    {
+        return "login";
     }
 }
Index: src/main/java/com/tourMate/dao/HotelDao.java
===================================================================
--- src/main/java/com/tourMate/dao/HotelDao.java	(revision 07f4e8b52fa18ab7781f9660c09d7982d8cd5a0b)
+++ src/main/java/com/tourMate/dao/HotelDao.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -97,4 +97,6 @@
 
     List<HotelRoomReservations> findPastReservationByUser(User u);
+
+    List<HotelRoomReservations> getReservationsInPeriod(String hotelLocation, Date dateFrom, Date dateTo);
 //    public void createHotel(Hotels hotel, long userId);
 //    public void editHotel(long hotelId, String hotelName, String hotelDescripiton, String hotelLocation, String hotelEDBS, Boolean parking, Boolean petFriendly, Boolean internetAvailable);
Index: src/main/java/com/tourMate/dao/TokenDao.java
===================================================================
--- src/main/java/com/tourMate/dao/TokenDao.java	(revision 07f4e8b52fa18ab7781f9660c09d7982d8cd5a0b)
+++ 	(revision )
@@ -1,14 +1,0 @@
-package com.tourMate.dao;
-
-import com.tourMate.entities.Token;
-import jakarta.transaction.Transactional;
-
-import java.time.LocalDateTime;
-import java.util.Date;
-
-public interface TokenDao {
-    public void saveToken(Token token);
-    public Token getToken(String token);
-    @Transactional
-    public void setConfirmedAt(String token, LocalDateTime dateTime);
-}
Index: src/main/java/com/tourMate/dao/TransportDao.java
===================================================================
--- src/main/java/com/tourMate/dao/TransportDao.java	(revision 07f4e8b52fa18ab7781f9660c09d7982d8cd5a0b)
+++ src/main/java/com/tourMate/dao/TransportDao.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -1,6 +1,4 @@
 package com.tourMate.dao;
 
-import com.tourMate.dto.RouteListingDto;
-import com.tourMate.dto.TransportDto;
 import com.tourMate.entities.*;
 import jakarta.transaction.Transactional;
@@ -19,9 +17,9 @@
     List<Transport> getTransports();
 
-    List<TransportDto> getTransportsByUser(User u);
+    List<Transport> getTransportsByUser(User u);
 
-    List<RouteListingDto> getRoutesForTransport(Transport t);
+    List<TransportAvailible> getRoutesForTransport(Transport t);
 
-    TransportDto findTransportById(long transportId);
+    Transport findTransportById(long transportId);
 
     Transport getTransportById(long transportId);
Index: src/main/java/com/tourMate/dao/UsersDao.java
===================================================================
--- src/main/java/com/tourMate/dao/UsersDao.java	(revision 07f4e8b52fa18ab7781f9660c09d7982d8cd5a0b)
+++ src/main/java/com/tourMate/dao/UsersDao.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -1,6 +1,8 @@
 package com.tourMate.dao;
 
+import com.tourMate.entities.Providers;
 import com.tourMate.entities.Role;
 import com.tourMate.entities.User;
+import jakarta.transaction.Transactional;
 import org.springframework.security.core.userdetails.UserDetails;
 
@@ -29,4 +31,12 @@
 
     Role findById(Long id);
-    void updateUser(User s);
+    User updateUser(User s);
+    User findByUsernameAndProvider(String username, String providers);
+
+    @Transactional
+    User mergeUser(User user);
+
+    List<User> getAdmins();
+
+    List<User> findConnectedAccountsByUser(User u);
 }
Index: src/main/java/com/tourMate/dao/impl/BusinessDaoImpl.java
===================================================================
--- src/main/java/com/tourMate/dao/impl/BusinessDaoImpl.java	(revision 07f4e8b52fa18ab7781f9660c09d7982d8cd5a0b)
+++ src/main/java/com/tourMate/dao/impl/BusinessDaoImpl.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -4,7 +4,10 @@
 import com.tourMate.entities.Business;
 import com.tourMate.entities.User;
+import com.tourMate.events.OnBusinessApprovedEvent;
 import jakarta.persistence.EntityManager;
 import jakarta.persistence.PersistenceContext;
 import jakarta.transaction.Transactional;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationEventPublisher;
 import org.springframework.stereotype.Service;
 
@@ -16,4 +19,6 @@
     @PersistenceContext
     EntityManager em;
+    @Autowired
+    ApplicationEventPublisher eventPublisher;
 
     @Transactional
@@ -37,5 +42,8 @@
     public boolean hasBusiness(User u)
     {
-        return Integer.parseInt(em.createQuery("SELECT COUNT(b) FROM Business b WHERE b.user = :user").setParameter("user", u).getSingleResult().toString()) > 0;
+        return Integer.parseInt(em.createQuery("SELECT COUNT(b) FROM Business b WHERE b.user = :user or b.user in :users")
+                .setParameter("user", u)
+                .setParameter("users", u.getConnectedAccounts())
+                .getSingleResult().toString()) > 0;
     }
 
@@ -49,4 +57,5 @@
     public void approveBusiness(Business b) {
         em.persist(b);
+        eventPublisher.publishEvent(new OnBusinessApprovedEvent(b.getUser()));
     }
 
Index: src/main/java/com/tourMate/dao/impl/HotelDaoImpl.java
===================================================================
--- src/main/java/com/tourMate/dao/impl/HotelDaoImpl.java	(revision 07f4e8b52fa18ab7781f9660c09d7982d8cd5a0b)
+++ src/main/java/com/tourMate/dao/impl/HotelDaoImpl.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -3,7 +3,11 @@
 import com.tourMate.dao.HotelDao;
 import com.tourMate.entities.*;
+import com.tourMate.events.OnHotelReservationEvent;
+import com.tourMate.events.OnRegistrationSuccessEvent;
 import jakarta.persistence.EntityManager;
 import jakarta.persistence.PersistenceContext;
 import jakarta.transaction.Transactional;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationEventPublisher;
 import org.springframework.stereotype.Service;
 
@@ -17,4 +21,6 @@
     @PersistenceContext
     EntityManager em;
+    @Autowired
+    ApplicationEventPublisher eventPublisher;
 
     @Override
@@ -31,12 +37,9 @@
     @Override
     public List<Hotels> getHotelsForUser(User u) {
-        return em.createQuery("select h from Hotels h where h.owner = :u").setParameter("u", u).getResultList();
-    }
-
-    @Override
-    public List<Hotels> getHotelsByLocation(String hotelLocation) {
-        return em.createQuery("select h from Hotels h where h.hotelLocation = hotelLocation").getResultList();
-    }
-
+        return em.createQuery("select h from Hotels h where h.owner = :u or h.owner in :users")
+                .setParameter("u", u)
+                .setParameter("users", u.getConnectedAccounts())
+                .getResultList();
+    }
     @Transactional
     @Override
@@ -211,7 +214,4 @@
         }
 
-
-
-
     }
 
@@ -232,4 +232,5 @@
     public void createReservation(HotelRoomReservations  r) {
         em.persist(r);
+        eventPublisher.publishEvent(new OnHotelReservationEvent(r.getUser(), r));
     }
 
@@ -243,5 +244,4 @@
     @Override
     public void deleteReservation(HotelRoomReservations hr) {
-
         em.remove(hr);
     }
@@ -281,3 +281,20 @@
                 .setParameter("user", u).getResultList();
     }
+
+    @Override
+    public List<HotelRoomReservations> getReservationsInPeriod(String hotelLocation, Date dateFrom, Date dateTo) {
+        return em.createQuery("select hr from HotelRoomReservations hr where hr.hotelRoom.hotel.hotelLocation like :hotelLocation and (hr.dateFrom between :dateFrom and :dateTo) or (hr.dateTo between :dateFrom and :dateTo)")
+                .setParameter("hotelLocation", hotelLocation)
+                .setParameter("dateFrom", dateFrom)
+                .setParameter("dateTo", dateTo)
+                .getResultList();
+    }
+
+    @Override
+    public List<Hotels> getHotelsByLocation(String hotelLocation)
+    {
+        return em.createQuery("select h from Hotels h where h.hotelLocation like :hotelLocation")
+                .setParameter("hotelLocation", hotelLocation)
+                .getResultList();
+    }
 }
Index: src/main/java/com/tourMate/dao/impl/RestaurantDaoImpl.java
===================================================================
--- src/main/java/com/tourMate/dao/impl/RestaurantDaoImpl.java	(revision 07f4e8b52fa18ab7781f9660c09d7982d8cd5a0b)
+++ src/main/java/com/tourMate/dao/impl/RestaurantDaoImpl.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -102,5 +102,8 @@
     @Override
     public List<Restaurant> getRestaurantsByUser(User u) {
-        return em.createQuery("select r from Restaurant r where r.restaurantOwner = :u").setParameter("u", u).getResultList();
+        return em.createQuery("select r from Restaurant r where r.restaurantOwner = :u or r.restaurantOwner in :users")
+                .setParameter("u", u)
+                .setParameter("users", u.getConnectedAccounts())
+                .getResultList();
     }
 
Index: src/main/java/com/tourMate/dao/impl/TokenDaoImpl.java
===================================================================
--- src/main/java/com/tourMate/dao/impl/TokenDaoImpl.java	(revision 07f4e8b52fa18ab7781f9660c09d7982d8cd5a0b)
+++ 	(revision )
@@ -1,36 +1,0 @@
-package com.tourMate.dao.impl;
-
-import com.tourMate.dao.TokenDao;
-import com.tourMate.entities.Token;
-import jakarta.persistence.Entity;
-import jakarta.persistence.EntityManager;
-import jakarta.persistence.PersistenceContext;
-import jakarta.transaction.Transactional;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.time.LocalDateTime;
-
-@Service
-public class TokenDaoImpl implements TokenDao {
-
-    @PersistenceContext
-    EntityManager em;
-    @Override
-    public void saveToken(Token token) {
-        em.persist(token);
-    }
-
-    @Override
-    public Token getToken(String token) {
-        return (Token) em.createQuery("select t from Token t where t.token = :token").setParameter("token", token).getSingleResult();
-    }
-
-    @Override
-    @Transactional
-    public void setConfirmedAt(String token, LocalDateTime dateTime) {
-        Token t = getToken(token);
-        t.setConfirmedAt(LocalDateTime.now());
-        em.persist(t);
-    }
-}
Index: src/main/java/com/tourMate/dao/impl/TransportDaoImpl.java
===================================================================
--- src/main/java/com/tourMate/dao/impl/TransportDaoImpl.java	(revision 07f4e8b52fa18ab7781f9660c09d7982d8cd5a0b)
+++ src/main/java/com/tourMate/dao/impl/TransportDaoImpl.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -2,6 +2,4 @@
 
 import com.tourMate.dao.TransportDao;
-import com.tourMate.dto.RouteListingDto;
-import com.tourMate.dto.TransportDto;
 import com.tourMate.entities.*;
 import jakarta.persistence.EntityManager;
@@ -37,83 +35,22 @@
 
     @Override
-    public List<TransportDto> getTransportsByUser(User u) {
-        List<Transport> transports = em.createQuery("select t from Transport t where t.owner = :u").setParameter("u", u).getResultList();
-        return transports.stream().map(x -> new TransportDto(
-                x.getTransportID(),
-                x.getTransportName(),
-                x.getCarBrand(),
-                x.getCarType(),
-                x.getCarManufacturedYear(),
-                x.getNoPassengers(),
-                x.getNoBags(),
-                x.getEMBG(),
-                x.getOwner(),
-                x.getCarPlate(),
-                x.getAvailableRoutes().stream().map(y -> new RouteListingDto(
-                        y.getTransportAvailibleId(),
-                        y.getFrom(),
-                        y.getTo(),
-                        y.getDate(),
-                        y.getFreeSpace(),
-                        y.getTime(),
-                        y.getRoutes(),
-                        y.getRoutes().stream()
-                                .mapToDouble(TransportRoute::getPrice)
-                                .max().orElse(0)
-                )).toList(),
-                x.getAvailableRoutes().stream()
-                        .flatMapToDouble(y -> y.getRoutes()
-                                .stream()
-                                .mapToDouble(TransportRoute::getPrice)).max().orElseGet(() -> 0)
-        )).toList();
+    public List<Transport> getTransportsByUser(User u) {
+        List<Transport> transports = em.createQuery("select t from Transport t where t.owner = :u or t.owner in :users")
+                .setParameter("u", u)
+                .setParameter("users", u.getConnectedAccounts())
+                .getResultList();
+        return transports;
     }
 
     @Override
-    public List<RouteListingDto> getRoutesForTransport(Transport t) {
+    public List<TransportAvailible> getRoutesForTransport(Transport t) {
         List<TransportAvailible> transportsAvailible = em.createQuery("select ta from TransportAvailible ta where ta.transport = :transport").setParameter("transport", t).getResultList();
-        return transportsAvailible.stream().map(x -> new RouteListingDto(
-                x.getTransportAvailibleId(),
-                x.getFrom(),
-                x.getTo(),
-                x.getDate(),
-                x.getFreeSpace(),
-                x.getTime(),
-                x.getRoutes(),
-                x.getRoutes().stream()
-                        .mapToDouble(TransportRoute::getPrice)
-                        .max().orElse(0)
-        )).toList();
+        return transportsAvailible;
     }
 
     @Override
-    public TransportDto findTransportById(long transportId) {
+    public Transport findTransportById(long transportId) {
         Transport x = em.find(Transport.class,transportId);
-        return new TransportDto(
-                x.getTransportID(),
-                x.getTransportName(),
-                x.getCarBrand(),
-                x.getCarType(),
-                x.getCarManufacturedYear(),
-                x.getNoPassengers(),
-                x.getNoBags(),
-                x.getEMBG(),
-                x.getOwner(),
-                x.getCarPlate(),
-                x.getAvailableRoutes().stream().map(y -> new RouteListingDto(
-                        y.getTransportAvailibleId(),
-                        y.getFrom(),
-                        y.getTo(),
-                        y.getDate(),
-                        y.getFreeSpace(),
-                        y.getTime(),
-                        y.getRoutes(),
-                        y.getRoutes().stream()
-                                .mapToDouble(TransportRoute::getPrice)
-                                .max().orElse(0)
-                )).toList(),
-                x.getAvailableRoutes().stream()
-                        .flatMapToDouble(y -> y.getRoutes()
-                                                        .stream()
-                                                        .mapToDouble(TransportRoute::getPrice)).max().orElseGet(() -> 0));
+        return x;
     }
 
Index: src/main/java/com/tourMate/dao/impl/UsersDaoImpl.java
===================================================================
--- src/main/java/com/tourMate/dao/impl/UsersDaoImpl.java	(revision 07f4e8b52fa18ab7781f9660c09d7982d8cd5a0b)
+++ src/main/java/com/tourMate/dao/impl/UsersDaoImpl.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -4,24 +4,27 @@
 import com.tourMate.entities.Role;
 import com.tourMate.entities.User;
+import com.tourMate.events.OnProfileEnabledEvent;
+import com.tourMate.events.OnRegistrationSuccessEvent;
 import jakarta.persistence.EntityManager;
 import jakarta.persistence.PersistenceContext;
 import jakarta.transaction.Transactional;
-import org.jetbrains.annotations.NotNull;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationEventPublisher;
 import org.springframework.security.core.userdetails.UserDetails;
 import org.springframework.security.crypto.password.PasswordEncoder;
-import org.springframework.stereotype.Service;
+import org.springframework.stereotype.Repository;
 
 import java.util.Date;
 import java.util.List;
 
-@Service
+@Repository
 public class UsersDaoImpl implements UsersDao {
 
     @PersistenceContext
     EntityManager em;
-
     @Autowired
     PasswordEncoder passwordEncoder;
+    @Autowired
+    private ApplicationEventPublisher eventPublisher;
 
     @Transactional
@@ -30,5 +33,11 @@
         Role r = em.find(Role.class, 2);
         User user = new User(name, surname, email, passwordEncoder.encode("password"), birthDate, address, contact, r);
+        user.setProvider("local");
+        user.setLocked(true);
         em.persist(user);
+        if(user.getProvider().equals("local"))
+        {
+            eventPublisher.publishEvent(new OnRegistrationSuccessEvent(user));
+        }
     }
 
@@ -84,4 +93,5 @@
         u.setEnabled(true);
         em.persist(u);
+        eventPublisher.publishEvent(new OnProfileEnabledEvent(u));
     }
 
@@ -93,8 +103,42 @@
     @Override
     @Transactional
-    public void updateUser(User s) {
+    public User updateUser(User s) {
         em.persist(s);
+        return s;
     }
 
+    @Override
+    public User findByUsernameAndProvider(String username, String providers)
+    {
+        try
+        {
+            return (User) em.createQuery("select u from User u where u.email = :username and u.provider = :provider")
+                    .setParameter("username", username)
+                    .setParameter("provider", providers)
+                    .getSingleResult();
+        }
+        catch (Exception ex)
+        {
+            return null;
+        }
+    }
 
+    @Override
+    @Transactional
+    public User mergeUser(User user) {
+        return em.merge(user);
+    }
+
+    @Override
+    public List<User> getAdmins() {
+        return em.createQuery("select u from User u where u.role.roleName = 'SUPERADMIN'")
+                .getResultList();
+    }
+
+    @Override
+    public List<User> findConnectedAccountsByUser(User u) {
+        return em.createQuery("select u.connectedAccounts from User u where u = :user")
+                .setParameter("user", u)
+                .getResultList();
+    }
 }
Index: src/main/java/com/tourMate/dto/HotelDto.java
===================================================================
--- src/main/java/com/tourMate/dto/HotelDto.java	(revision 07f4e8b52fa18ab7781f9660c09d7982d8cd5a0b)
+++ src/main/java/com/tourMate/dto/HotelDto.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -21,6 +21,7 @@
     private double averageScore;
     private List<HotelsImages> images;
-
-    public HotelDto(long hotelId, String hotelName, String hotelDescripiton, String hotelLocation, String hotelEDBS, Boolean parking, Boolean petFriendly, Boolean internetAvailable, double totalPrice, List<HotelRoomAvailable> hotelRooms, List<Reviews> hotelReviews, double averageScore, List<HotelsImages> images) {
+    private Boolean promoted;
+    private Boolean marketed;
+    public HotelDto(long hotelId, String hotelName, String hotelDescripiton, String hotelLocation, String hotelEDBS, Boolean parking, Boolean petFriendly, Boolean internetAvailable, double totalPrice, List<HotelRoomAvailable> hotelRooms, List<Reviews> hotelReviews, double averageScore, List<HotelsImages> images, Boolean promoted, Boolean marketed) {
         this.hotelId = hotelId;
         this.hotelName = hotelName;
@@ -36,4 +37,6 @@
         this.averageScore = averageScore;
         this.images = images;
+        this.promoted = promoted;
+        this.marketed = marketed;
     }
 
@@ -132,3 +135,27 @@
         this.images = images;
     }
+
+    public void setHotelReviews(List<Reviews> hotelReviews) {
+        this.hotelReviews = hotelReviews;
+    }
+
+    public void setAverageScore(double averageScore) {
+        this.averageScore = averageScore;
+    }
+
+    public Boolean getPromoted() {
+        return promoted;
+    }
+
+    public void setPromoted(Boolean promoted) {
+        this.promoted = promoted;
+    }
+
+    public Boolean getMarketed() {
+        return marketed;
+    }
+
+    public void setMarketed(Boolean marketed) {
+        this.marketed = marketed;
+    }
 }
Index: src/main/java/com/tourMate/dto/PrincipalInfo.java
===================================================================
--- src/main/java/com/tourMate/dto/PrincipalInfo.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
+++ src/main/java/com/tourMate/dto/PrincipalInfo.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -0,0 +1,71 @@
+package com.tourMate.dto;
+
+public class PrincipalInfo {
+    Long id;
+    String username;
+    String role;
+    String name;
+    String surname;
+    String email;
+
+    public PrincipalInfo(Long id, String username, String role, String name, String surname, String email) {
+        this.id = id;
+        this.username = username;
+        this.role = role;
+        this.name = name;
+        this.surname = surname;
+        this.email = email;
+    }
+
+    public PrincipalInfo() {
+
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    public String getRole() {
+        return role;
+    }
+
+    public void setRole(String role) {
+        this.role = role;
+    }
+
+    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 String getEmail() {
+        return email;
+    }
+
+    public void setEmail(String email) {
+        this.email = email;
+    }
+}
Index: src/main/java/com/tourMate/entities/Providers.java
===================================================================
--- src/main/java/com/tourMate/entities/Providers.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
+++ src/main/java/com/tourMate/entities/Providers.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -0,0 +1,8 @@
+package com.tourMate.entities;
+
+public enum Providers {
+    local,
+    github,
+    google,
+    facebook
+}
Index: src/main/java/com/tourMate/entities/User.java
===================================================================
--- src/main/java/com/tourMate/entities/User.java	(revision 07f4e8b52fa18ab7781f9660c09d7982d8cd5a0b)
+++ src/main/java/com/tourMate/entities/User.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -14,4 +14,5 @@
 import java.util.Collections;
 import java.util.Date;
+import java.util.List;
 
 @Entity
@@ -27,5 +28,5 @@
     private String name;
 
-    @Column(name = "surname", unique = false, nullable = false)
+    @Column(name = "surname", unique = false, nullable = true)
     private String surname;
 
@@ -34,16 +35,16 @@
     private String email;
 
-    @Column(name = "password", unique = true, nullable = false)
+    @Column(name = "password", unique = true, nullable = true)
     @NotNull
     private String password;
 
-    @Column(name = "birth_date", unique = false, nullable = false)
+    @Column(name = "birth_date", unique = false, nullable = true)
     @NotNull
     private Date birthDate;
 
-    @Column(name = "address", unique = false, nullable = false)
+    @Column(name = "address", unique = false, nullable = true)
     private String address;
 
-    @Column(name = "contact", unique = false, nullable = false)
+    @Column(name = "contact", unique = false, nullable = true)
     private String contact;
 
@@ -57,4 +58,11 @@
     boolean enabled;
 
+    @Column(name = "provider", unique = false, nullable = true)
+    String provider;
+
+    @ManyToMany
+    @JsonIgnore
+    List<User> connectedAccounts;
+
 
     public User(@NotNull String name, String surname, @NotNull String email, @NotNull String password, @NotNull Date birthDate, String address, String contact, Role role) {
@@ -120,4 +128,16 @@
     }
 
+    public List<User> getConnectedAccounts() {
+        return connectedAccounts;
+    }
+
+    public void setConnectedAccounts(List<User> connectedAccounts) {
+        this.connectedAccounts = connectedAccounts;
+    }
+
+    public void addConnectedUser(User u)
+    {
+        connectedAccounts.add(u);
+    }
 
     public void setSurname(String surname) {
@@ -212,3 +232,11 @@
         this.enabled = enabled;
     }
+
+    public String getProvider() {
+        return provider;
+    }
+
+    public void setProvider(String  provider) {
+        this.provider = provider;
+    }
 }
Index: src/main/java/com/tourMate/events/EmailEvent.java
===================================================================
--- src/main/java/com/tourMate/events/EmailEvent.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
+++ src/main/java/com/tourMate/events/EmailEvent.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -0,0 +1,48 @@
+package com.tourMate.events;
+
+import com.tourMate.entities.User;
+import org.springframework.context.ApplicationEvent;
+
+public abstract class EmailEvent extends ApplicationEvent {
+    protected EventType eventType;
+    protected User user;
+    protected String subject;
+    protected String message;
+
+    public EmailEvent(User user) {
+        super(user);
+        this.user = user;
+    }
+
+    public User getUser() {
+        return user;
+    }
+
+    public void setUser(User user) {
+        this.user = user;
+    }
+
+    public EventType getEventType() {
+        return eventType;
+    }
+
+    public void setEventType(EventType eventType) {
+        this.eventType = eventType;
+    }
+
+    public String getSubject() {
+        return subject;
+    }
+
+    public void setSubject(String subject) {
+        this.subject = subject;
+    }
+
+    public String getMessage() {
+        return message;
+    }
+
+    public void setMessage(String message) {
+        this.message = message;
+    }
+}
Index: src/main/java/com/tourMate/events/EventType.java
===================================================================
--- src/main/java/com/tourMate/events/EventType.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
+++ src/main/java/com/tourMate/events/EventType.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -0,0 +1,10 @@
+package com.tourMate.events;
+
+public enum EventType {
+    REGISTRATION,
+    PROFILE_ENABLED,
+    BUSINESS_APPROVED,
+    HOTEL_RESERVATION,
+    TRANSPORT_RESERVATION,
+    RESTAURANT_RESERVATION
+}
Index: src/main/java/com/tourMate/events/OnBusinessApprovedEvent.java
===================================================================
--- src/main/java/com/tourMate/events/OnBusinessApprovedEvent.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
+++ src/main/java/com/tourMate/events/OnBusinessApprovedEvent.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -0,0 +1,12 @@
+package com.tourMate.events;
+
+import com.tourMate.entities.User;
+
+public class OnBusinessApprovedEvent extends EmailEvent{
+    public OnBusinessApprovedEvent(User u) {
+        super(u);
+        this.eventType = EventType.BUSINESS_APPROVED;
+        this.subject = "TourMate - Верификуван бизнис";
+        this.message = "Драг кориснику,\n\nВе известуваме дека Вашата регистрација за фирма е одобрена. Можете да започнете со користење на бизнис услугите од нашата апликација.\n\n\nСо почит,\nTourMate";
+    }
+}
Index: src/main/java/com/tourMate/events/OnHotelReservationEvent.java
===================================================================
--- src/main/java/com/tourMate/events/OnHotelReservationEvent.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
+++ src/main/java/com/tourMate/events/OnHotelReservationEvent.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -0,0 +1,32 @@
+package com.tourMate.events;
+
+import com.tourMate.entities.HotelRoomReservations;
+import com.tourMate.entities.User;
+
+import java.text.SimpleDateFormat;
+
+public class OnHotelReservationEvent extends EmailEvent{
+    private HotelRoomReservations hotelRoomReservations;
+    public OnHotelReservationEvent(User u, HotelRoomReservations hotelRoomReservations) {
+        super(u);
+        this.hotelRoomReservations = hotelRoomReservations;
+        this.eventType = EventType.HOTEL_RESERVATION;
+        this.subject = "TourMate - Потврда за резервација - " + hotelRoomReservations.getHotelRoom().getHotel().getHotelName();
+        this.message = String.format("Драг кориснику,\n\nВе известуваме дека Вашата резервација за %s е потврдена\n\n" +
+                        "Детали за резервацијата:\n" +
+                        "%s - %s" +
+                        "\n%s" +
+                        "\n\n\nСо почит,\nTourMate", hotelRoomReservations.getHotelRoom().getHotel().getHotelName()
+                , new SimpleDateFormat("dd-MM-yyyy").format(hotelRoomReservations.getDateFrom())
+                , new SimpleDateFormat("dd-MM-yyyy").format(hotelRoomReservations.getDateTo())
+                , hotelRoomReservations.getHotelRoom().getHotelRoomName());
+    }
+
+    public HotelRoomReservations getHotelRoomReservations() {
+        return hotelRoomReservations;
+    }
+
+    public void setHotelRoomReservations(HotelRoomReservations hotelRoomReservations) {
+        this.hotelRoomReservations = hotelRoomReservations;
+    }
+}
Index: src/main/java/com/tourMate/events/OnProfileEnabledEvent.java
===================================================================
--- src/main/java/com/tourMate/events/OnProfileEnabledEvent.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
+++ src/main/java/com/tourMate/events/OnProfileEnabledEvent.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -0,0 +1,17 @@
+package com.tourMate.events;
+
+import com.tourMate.entities.User;
+import jdk.jfr.Event;
+import org.springframework.context.ApplicationEvent;
+
+public class OnProfileEnabledEvent extends EmailEvent {
+    private static final long serialVersionUID = 1L;
+    private User user;
+
+    public OnProfileEnabledEvent(User user) {
+        super(user);
+        this.eventType = EventType.PROFILE_ENABLED;
+        this.subject = "TourMate - Активиран профил";
+        this.message = "Драг кориснику,\n\nВе известуваме дека Вашата регистрација е ревидирана од страна на администраторот и Вашиот профил е одобрен. Можете да започнете со користење.\n\n\nСо почит,\nTourMate";
+    }
+}
Index: src/main/java/com/tourMate/events/OnRegistrationSuccessEvent.java
===================================================================
--- src/main/java/com/tourMate/events/OnRegistrationSuccessEvent.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
+++ src/main/java/com/tourMate/events/OnRegistrationSuccessEvent.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -0,0 +1,17 @@
+package com.tourMate.events;
+
+import com.tourMate.entities.User;
+import lombok.Data;
+import org.springframework.context.ApplicationEvent;
+
+public class OnRegistrationSuccessEvent extends EmailEvent {
+    private static final long serialVersionUID = 1L;
+    private User user;
+
+    public OnRegistrationSuccessEvent(User user) {
+        super(user);
+        this.eventType = EventType.REGISTRATION;
+        this.subject = "TourMate - Успешна регистрација";
+        this.message = "Драг кориснику,\n\nВе известуваме дека Вашата регистрација на апликацијата TourMate е успешна. За да можете да го користите профилот, потребно е истиот да е одобрен од страна на администраторот за што ќе добиете дополнителна потврда на оваа адреса.\n\n\nСо почит,\nTourMate";
+    }
+}
Index: src/main/java/com/tourMate/events/OnRestaurantReservationEvent.java
===================================================================
--- src/main/java/com/tourMate/events/OnRestaurantReservationEvent.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
+++ src/main/java/com/tourMate/events/OnRestaurantReservationEvent.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -0,0 +1,34 @@
+package com.tourMate.events;
+
+import com.tourMate.entities.RestaurantReservations;
+import com.tourMate.entities.TransportReservation;
+import com.tourMate.entities.User;
+
+import java.text.SimpleDateFormat;
+
+public class OnRestaurantReservationEvent extends EmailEvent {
+    private RestaurantReservations restaurantReservations;
+    public OnRestaurantReservationEvent(User u, RestaurantReservations restaurantReservations) {
+        super(u);
+        this.restaurantReservations = restaurantReservations;
+        this.eventType = EventType.RESTAURANT_RESERVATION;
+        this.subject = "TourMate - Потврда за резервација - " + restaurantReservations.getTable().getRestaurant().getRestaurantName();
+        this.message = String.format("Драг кориснику,\n\nВе известуваме дека Вашата резервација за %s е потврдена\n\n" +
+                        "Детали за резервацијата:\n" +
+                        "%s - %s" +
+                        "\nМаса за %s луѓе" +
+                        "\n\n\nСо почит,\nTourMate", restaurantReservations.getTable().getRestaurant().getRestaurantName()
+                , new SimpleDateFormat("dd-MM-yyyy hh:mm").format(restaurantReservations.getTimeFrom())
+                , new SimpleDateFormat("dd-MM-yyyy hh:mm").format(restaurantReservations.getTimeTo())
+                , restaurantReservations.getTable().getNoSeats());
+
+    }
+
+    public RestaurantReservations getRestaurantReservations() {
+        return restaurantReservations;
+    }
+
+    public void setRestaurantReservations(RestaurantReservations restaurantReservations) {
+        this.restaurantReservations = restaurantReservations;
+    }
+}
Index: src/main/java/com/tourMate/events/OnTransportReservationEvent.java
===================================================================
--- src/main/java/com/tourMate/events/OnTransportReservationEvent.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
+++ src/main/java/com/tourMate/events/OnTransportReservationEvent.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -0,0 +1,30 @@
+package com.tourMate.events;
+
+import com.tourMate.entities.HotelRoomReservations;
+import com.tourMate.entities.TransportReservation;
+import com.tourMate.entities.User;
+
+public class OnTransportReservationEvent extends EmailEvent {
+    private TransportReservation transportReservation;
+    public OnTransportReservationEvent(User u, TransportReservation transportReservation) {
+        super(u);
+        this.transportReservation = transportReservation;
+        this.eventType = EventType.HOTEL_RESERVATION;
+
+        this.subject = "TourMate - Потврда за резервација за рута " + transportReservation.getTransportRoute().getFrom() + " " + transportReservation.getTransportRoute().getTo();
+        this.message = String.format("Драг кориснику,\n\nВе известуваме дека Вашата резервација за патувањето %s е потврдена\n\n" +
+                        "Детали за резервацијата:\n" +
+                        "%s - %s" +
+                        "\n\n\nСо почит,\nTourMate", transportReservation.getTransportRoute().getFrom() + " " + transportReservation.getTransportRoute().getTo()
+                , transportReservation.getTransportRoute().getDeparture()
+                , transportReservation.getTransportRoute().getArrival());
+    }
+
+    public TransportReservation getTransportReservation() {
+        return transportReservation;
+    }
+
+    public void setTransportReservation(TransportReservation transportReservation) {
+        this.transportReservation = transportReservation;
+    }
+}
Index: src/main/java/com/tourMate/listeners/RegistrationEmailListener.java
===================================================================
--- src/main/java/com/tourMate/listeners/RegistrationEmailListener.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
+++ src/main/java/com/tourMate/listeners/RegistrationEmailListener.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -0,0 +1,27 @@
+package com.tourMate.listeners;
+
+import com.tourMate.entities.User;
+import com.tourMate.events.*;
+import com.tourMate.services.MailingService;
+import com.tourMate.services.UsersManager;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationListener;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Component;
+
+import java.text.SimpleDateFormat;
+
+@Component
+public class RegistrationEmailListener implements ApplicationListener<EmailEvent> {
+
+    @Autowired
+    private Environment environment;
+    @Autowired
+    private MailingService mailingService;
+
+
+    @Override
+    public void onApplicationEvent(EmailEvent event) {
+        mailingService.sendMail(event.getUser().getEmail(), event.getSubject(), event.getMessage());
+    }
+}
Index: src/main/java/com/tourMate/services/HotelManager.java
===================================================================
--- src/main/java/com/tourMate/services/HotelManager.java	(revision 07f4e8b52fa18ab7781f9660c09d7982d8cd5a0b)
+++ src/main/java/com/tourMate/services/HotelManager.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -25,8 +25,8 @@
     public HotelRoom findRoomById (long hotelRoomId);
     public List<HotelRoomImages> getRoomImages(Long hotelRoom);
-    public void createRoom(Hotels hotel, String hotelRoomDescription, String hotelRoomName, Boolean kitchenAvailable, Boolean airConditioning, Boolean balcony, double price, int numOfBeds);
+    public void createRoom(Long hotelId, String hotelRoomDescription, String hotelRoomName, Boolean kitchenAvailable, Boolean airConditioning, Boolean balcony, double price, int numOfBeds);
     public void editRoom(long hotelRoomId, Hotels hotel, String hotelRoomDescription, String hotelRoomName, Boolean kitchenAvailable, Boolean airConditioning, Boolean balcony, double price);
     public void deleteRoom(long hotelRoomId);
-    public void createRoomAvailible(HotelRoom hotelRoom, Date dateFrom, Date dateTo, int numberOfBeds);
+    public void createRoomAvailible(long hotelRoom, Date dateFrom, Date dateTo, int numberOfBeds);
     public void editRoomAvailible(long hotelRoomAvailableId, HotelRoom hotelRoom, Date dateFrom, Date dateTo, int numberOfBeds);
     public void editRoomAvailibleReservation(Long HotelRoomAvailableId, Long hotelRoomId, Date from, Date to, int numberOfBeds);
@@ -36,4 +36,7 @@
     public List<HotelRoomAvailable> getRoomsAvailableById(Long id);
     public List<HotelRoomAvailable> getRoomsAvailibilityByHotel(Hotels hotel);
+
+    List<HotelRoomReservations> getReservationsInPeriod(String hotelLocation, Date dateFrom, Date dateTo);
+
     public List<HotelDto> getRoomsAvailibilityByDateAndLocation(String hotelLocation, Date dateFrom, Date dateTo, int numberOfBeds, Boolean flexible);
     public void createReservation(Long userId, Long hotelRoomId, Long hotelRoomAvailableId, Date dateFrom, Date dateTo, Integer numberOfBeds);
Index: src/main/java/com/tourMate/services/MailingService.java
===================================================================
--- src/main/java/com/tourMate/services/MailingService.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
+++ src/main/java/com/tourMate/services/MailingService.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -0,0 +1,5 @@
+package com.tourMate.services;
+
+public interface MailingService {
+    public void sendMail(String to, String subject, String message);
+}
Index: src/main/java/com/tourMate/services/RestaurantManager.java
===================================================================
--- src/main/java/com/tourMate/services/RestaurantManager.java	(revision 07f4e8b52fa18ab7781f9660c09d7982d8cd5a0b)
+++ src/main/java/com/tourMate/services/RestaurantManager.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -37,5 +37,5 @@
     public List<RestaurantsTable> getRestaurantTables(long restaurantID);
 
-    public List<RestaurantDto> getTablesByDateAndLocation(String restaurantLocation, Date hourFrom, Date hourTo, int noSeats);
+    public List<RestaurantDto> getTablesByDateAndLocation(String restaurantLocation, Date date, String hourFrom, String hourTo, int noSeats);
 
     public RestaurantsTable findTableById(long tableId);
Index: src/main/java/com/tourMate/services/TokenManager.java
===================================================================
--- src/main/java/com/tourMate/services/TokenManager.java	(revision 07f4e8b52fa18ab7781f9660c09d7982d8cd5a0b)
+++ 	(revision )
@@ -1,9 +1,0 @@
-package com.tourMate.services;
-
-import com.tourMate.entities.Token;
-
-public interface TokenManager {
-    public void saveToken(Token token);
-    public Token getToken(String token);
-    public void setConfirmedAt(String token);
-}
Index: src/main/java/com/tourMate/services/TransportManager.java
===================================================================
--- src/main/java/com/tourMate/services/TransportManager.java	(revision 07f4e8b52fa18ab7781f9660c09d7982d8cd5a0b)
+++ src/main/java/com/tourMate/services/TransportManager.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -45,5 +45,5 @@
     public List<TransportAvailible> getTransportsAvailable();
 
-    public void createTransportAvailable(Transport transport, String departureLocation, String arrivalLocation, Date date, Integer noSeats, Date departureHour, Collection<TransportRoute> routes);
+    public void createTransportAvailable(TransportAvailible transportAvailible, Transport transport, String departureLocation, String arrivalLocation, Date date, Integer noSeats, Date departureHour, Long trnasportId, Collection<TransportRoute> routes);
     public void editTransportAvailable(Transport transport, long availableID, String departureLocation, String arrivalLocation, Date date, Integer noSeats, Date departureHour);
 
Index: src/main/java/com/tourMate/services/UsersManager.java
===================================================================
--- src/main/java/com/tourMate/services/UsersManager.java	(revision 07f4e8b52fa18ab7781f9660c09d7982d8cd5a0b)
+++ src/main/java/com/tourMate/services/UsersManager.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -1,4 +1,5 @@
 package com.tourMate.services;
 
+import com.tourMate.dto.PrincipalInfo;
 import com.tourMate.entities.User;
 
@@ -20,3 +21,10 @@
 
     void unlock(Long id);
+
+    List<User> getAdmins();
+
+    void connectAccount(Long id, String username, String password);
+
+    List<User> findConnectedAccountsByUser(Long id);
+    PrincipalInfo getPrincipalInfo(Long userId);
 }
Index: src/main/java/com/tourMate/services/impl/HotelManagerImpl.java
===================================================================
--- src/main/java/com/tourMate/services/impl/HotelManagerImpl.java	(revision 07f4e8b52fa18ab7781f9660c09d7982d8cd5a0b)
+++ src/main/java/com/tourMate/services/impl/HotelManagerImpl.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -13,7 +13,5 @@
 
 import java.time.Duration;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
@@ -123,5 +121,6 @@
 
     @Override
-    public void createRoom(Hotels hotel, String hotelRoomDescription, String hotelRoomName, Boolean kitchenAvailable, Boolean airConditioning, Boolean balcony, double price, int numOfBeds) {
+    public void createRoom(Long hotelId, String hotelRoomDescription, String hotelRoomName, Boolean kitchenAvailable, Boolean airConditioning, Boolean balcony, double price, int numOfBeds) {
+        Hotels hotel = findHotelByID(hotelId);
         HotelRoom hotelRoom = new HotelRoom(hotel, hotelRoomDescription, hotelRoomName, kitchenAvailable, airConditioning, balcony, price, numOfBeds);
         hotelDao.createRoom(hotelRoom);
@@ -154,5 +153,6 @@
 
     @Override
-    public void createRoomAvailible(HotelRoom hotelRoom, Date dateFrom, Date dateTo, int numberOfBeds) {
+    public void createRoomAvailible(long hotelRoomId, Date dateFrom, Date dateTo, int numberOfBeds) {
+        HotelRoom hotelRoom = findRoomById(hotelRoomId);
         HotelRoomAvailable hra = new HotelRoomAvailable(hotelRoom, dateFrom, dateTo, numberOfBeds);
         hotelDao.createRoomAvailible(hra);
@@ -168,5 +168,9 @@
         hotelDao.editRoomAvailible(hr);
     }
-
+    //01-01-2024 - 30-01-2024
+    //05-01-2024 - 10-01-2024
+
+    //01-01 - 05-01
+    //10-01 - 30-01
     @Override
     public void editRoomAvailibleReservation(Long HotelRoomAvailableId, Long hotelRoomId, Date from, Date to, int numberOfBeds){
@@ -202,6 +206,31 @@
 
     @Override
+    public List<HotelRoomReservations> getReservationsInPeriod(String hotelLocation, Date dateFrom, Date dateTo)
+    {
+        return hotelDao.getReservationsInPeriod(hotelLocation, dateFrom, dateTo);
+    }
+
+    @Override
     public List<HotelDto> getRoomsAvailibilityByDateAndLocation(String hotelLocation, Date dateFrom, Date dateTo, int numberOfBeds, Boolean flexible) {
         long numberOfNights = Duration.between(dateFrom.toInstant(), dateTo.toInstant()).toDays();
+        List<Hotels> hotels = getHotelsByLocation(hotelLocation);
+        List<HotelRoomReservations> hotelRoomReservations = getReservationsInPeriod(hotelLocation, dateFrom, dateTo);
+        List<Hotels> hotelsWithReservations = hotelRoomReservations.stream().map(x -> x.getHotelRoom().getHotel()).toList();
+        List<Hotels> mostReservedHotels = hotelRoomReservations.stream()
+                .collect(Collectors.groupingBy(x -> x.getHotelRoom().getHotel(), Collectors.counting())).entrySet().stream()
+                .sorted(Map.Entry.comparingByValue(Comparator.reverseOrder()))
+                .limit(5)
+                .map(Map.Entry::getKey)
+                .toList();
+        List<Hotels> leastReservedHotels = hotelRoomReservations.stream()
+                .collect(Collectors.groupingBy(x -> x.getHotelRoom().getHotel(), Collectors.counting())).entrySet().stream()
+                .sorted(Map.Entry.comparingByValue())
+                .limit(5)
+                .map(Map.Entry::getKey)
+                .toList();
+        List<Hotels> hotelsWithoutReservations = hotels.stream().filter(x -> !hotelsWithReservations.contains(x)).toList();
+        List<Hotels> hotelsToBeMarketed = new ArrayList<>();
+        hotelsToBeMarketed.addAll(hotelsWithoutReservations);
+        hotelsToBeMarketed.addAll(leastReservedHotels);
         List<HotelRoomAvailable> roomsAvailible = hotelDao.getRoomsAvailibilityByDateAndLocation(hotelLocation, dateFrom, dateTo, numberOfBeds, flexible);
         Map<Hotels, List<HotelRoomAvailable>> roomsByHotels = roomsAvailible.stream().collect(Collectors.groupingBy(x -> x.getHotelRoom().getHotel()));
@@ -220,5 +249,7 @@
                         getReviewsForHotel(x.getHotelId()),
                         getReviewsForHotel(x.getHotelId()).stream().mapToDouble(Reviews::getNumStar).average().orElse(0),
-                        getHotelImages(x.getHotelId())
+                        getHotelImages(x.getHotelId()),
+                        mostReservedHotels.contains(x),
+                        hotelsToBeMarketed.contains(x)
                 )).toList();
         return hotelsList;
@@ -227,4 +258,5 @@
 
     @Override
+    // TODO:Transactional
     public void createReservation(Long userId, Long hotelRoomId, Long hotelRoomAvailableId, Date dateFrom, Date dateTo, Integer numberOfBeds) {
         HotelRoom room = hotelDao.findRoomById(hotelRoomId);
@@ -246,4 +278,5 @@
         hotelDao.editReservation(hr);
     }
+
 
     @Override
Index: src/main/java/com/tourMate/services/impl/MailingServiceImpl.java
===================================================================
--- src/main/java/com/tourMate/services/impl/MailingServiceImpl.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
+++ src/main/java/com/tourMate/services/impl/MailingServiceImpl.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -0,0 +1,26 @@
+package com.tourMate.services.impl;
+
+import com.tourMate.services.MailingService;
+import org.springframework.mail.SimpleMailMessage;
+import org.springframework.mail.javamail.JavaMailSender;
+import org.springframework.stereotype.Service;
+
+@Service
+public class MailingServiceImpl implements MailingService {
+
+    private final JavaMailSender emailSender;
+
+    public MailingServiceImpl(JavaMailSender emailSender) {
+        this.emailSender = emailSender;
+    }
+
+    @Override
+    public void sendMail(String to, String subject, String messageText) {
+        SimpleMailMessage mail = new SimpleMailMessage();
+        mail.setFrom("Trip2MK");
+        mail.setTo(to);
+        mail.setSubject(subject);
+        mail.setText(messageText);
+        emailSender.send(mail);
+    }
+}
Index: src/main/java/com/tourMate/services/impl/RestaurantManagerImpl.java
===================================================================
--- src/main/java/com/tourMate/services/impl/RestaurantManagerImpl.java	(revision 07f4e8b52fa18ab7781f9660c09d7982d8cd5a0b)
+++ src/main/java/com/tourMate/services/impl/RestaurantManagerImpl.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -89,6 +89,14 @@
 
     @Override
-    public List<RestaurantDto> getTablesByDateAndLocation(String restaurantLocation, Date hourFrom, Date hourTo, int noSeats) {
-        List<RestaurantsAvailible> restaurantsAvailibles = restaurantDao.getTablesByDateAndLocation(restaurantLocation, hourFrom, hourTo, noSeats);
+    public List<RestaurantDto> getTablesByDateAndLocation(String restaurantLocation, Date date, String hourFrom, String hourTo, int noSeats) {
+        Date dateFrom = date;
+        Date dateTo = Date.from(date.toInstant());
+        String[] splittedFrom = hourFrom.split(":");
+        String[] splittedTo = hourTo.split(":");
+        dateFrom.setHours(Integer.parseInt(splittedFrom[0]));
+        dateFrom.setMinutes(Integer.parseInt(splittedFrom[1]));
+        dateTo.setHours(Integer.parseInt(splittedTo[0]));
+        dateTo.setMinutes(Integer.parseInt(splittedTo[1]));
+        List<RestaurantsAvailible> restaurantsAvailibles = restaurantDao.getTablesByDateAndLocation(restaurantLocation, dateFrom, dateTo, noSeats);
         Map<Restaurant, List<RestaurantsAvailible>> tablesByRestaurants = restaurantsAvailibles.stream().collect(Collectors.groupingBy(x -> x.getRestaurantTable().getRestaurant()));
         List<RestaurantDto> restaurantsList = tablesByRestaurants.keySet().stream()
Index: src/main/java/com/tourMate/services/impl/TokenManagerImpl.java
===================================================================
--- src/main/java/com/tourMate/services/impl/TokenManagerImpl.java	(revision 07f4e8b52fa18ab7781f9660c09d7982d8cd5a0b)
+++ 	(revision )
@@ -1,31 +1,0 @@
-package com.tourMate.services.impl;
-
-import com.tourMate.dao.TokenDao;
-import com.tourMate.entities.Token;
-import com.tourMate.services.TokenManager;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.time.LocalDateTime;
-
-@Service
-public class TokenManagerImpl implements TokenManager {
-    @Autowired
-    TokenDao tokenDao;
-
-
-    @Override
-    public void saveToken(Token token) {
-        tokenDao.saveToken(token);
-    }
-
-    @Override
-    public Token getToken(String token) {
-        return tokenDao.getToken(token);
-    }
-    
-    @Override
-    public void setConfirmedAt(String token) {
-        tokenDao.setConfirmedAt(token, LocalDateTime.now());
-    }
-}
Index: src/main/java/com/tourMate/services/impl/TransportManagerImpl.java
===================================================================
--- src/main/java/com/tourMate/services/impl/TransportManagerImpl.java	(revision 07f4e8b52fa18ab7781f9660c09d7982d8cd5a0b)
+++ src/main/java/com/tourMate/services/impl/TransportManagerImpl.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -46,5 +46,33 @@
     public List<TransportDto> getTransportsByUser(long userId) {
         User u = usersManager.findUserByID(userId);
-        return transportDao.getTransportsByUser(u);
+        List<Transport> transports = transportDao.getTransportsByUser(u);
+        return transports.stream().map(x -> new TransportDto(
+                x.getTransportID(),
+                x.getTransportName(),
+                x.getCarBrand(),
+                x.getCarType(),
+                x.getCarManufacturedYear(),
+                x.getNoPassengers(),
+                x.getNoBags(),
+                x.getEMBG(),
+                x.getOwner(),
+                x.getCarPlate(),
+                x.getAvailableRoutes().stream().map(y -> new RouteListingDto(
+                        y.getTransportAvailibleId(),
+                        y.getFrom(),
+                        y.getTo(),
+                        y.getDate(),
+                        y.getFreeSpace(),
+                        y.getTime(),
+                        y.getRoutes(),
+                        y.getRoutes().stream()
+                                .mapToDouble(TransportRoute::getPrice)
+                                .max().orElse(0)
+                )).toList(),
+                x.getAvailableRoutes().stream()
+                        .flatMapToDouble(y -> y.getRoutes()
+                                .stream()
+                                .mapToDouble(TransportRoute::getPrice)).max().orElseGet(() -> 0)
+        )).toList();
     }
 
@@ -52,10 +80,49 @@
     public List<RouteListingDto> getRoutesForTransport(long transportId) {
         Transport t = getTransportById(transportId);
-        return transportDao.getRoutesForTransport(t);
+        List<TransportAvailible> transportAvailibles = transportDao.getRoutesForTransport(t);
+        return transportAvailibles.stream().map(x -> new RouteListingDto(
+                x.getTransportAvailibleId(),
+                x.getFrom(),
+                x.getTo(),
+                x.getDate(),
+                x.getFreeSpace(),
+                x.getTime(),
+                x.getRoutes(),
+                x.getRoutes().stream()
+                        .mapToDouble(TransportRoute::getPrice)
+                        .max().orElse(0)
+        )).toList();
     }
 
     @Override
     public TransportDto findTransportById(long transportId) {
-        return transportDao.findTransportById(transportId);
+        Transport x = transportDao.findTransportById(transportId);
+        return new TransportDto(
+                x.getTransportID(),
+                x.getTransportName(),
+                x.getCarBrand(),
+                x.getCarType(),
+                x.getCarManufacturedYear(),
+                x.getNoPassengers(),
+                x.getNoBags(),
+                x.getEMBG(),
+                x.getOwner(),
+                x.getCarPlate(),
+                x.getAvailableRoutes().stream().map(y -> new RouteListingDto(
+                        y.getTransportAvailibleId(),
+                        y.getFrom(),
+                        y.getTo(),
+                        y.getDate(),
+                        y.getFreeSpace(),
+                        y.getTime(),
+                        y.getRoutes(),
+                        y.getRoutes().stream()
+                                .mapToDouble(TransportRoute::getPrice)
+                                .max().orElse(0)
+                )).toList(),
+                x.getAvailableRoutes().stream()
+                        .flatMapToDouble(y -> y.getRoutes()
+                                .stream()
+                                .mapToDouble(TransportRoute::getPrice)).max().orElseGet(() -> 0));
     }
 
@@ -152,6 +219,12 @@
 
     @Override
-    public void createTransportAvailable(Transport transport, String departureLocation, String arrivalLocation, Date date, Integer noSeats, Date departureHour, Collection<TransportRoute> routes) {
-        TransportAvailible ta=new TransportAvailible(transport,departureLocation,arrivalLocation,date,noSeats,departureHour);
+    public void createTransportAvailable(TransportAvailible transportAvailible, Transport transport, String departureLocation, String arrivalLocation, Date date, Integer noSeats, Date departureHour, Long transportId, Collection<TransportRoute> trRoutes) {
+        Transport t = getTransportById(transportId);
+        List<TransportRoute> routes = trRoutes.stream().toList();
+        routes.get(0).setDeparture(transportAvailible.getDate());
+        transportAvailible.setTime(routes.get(routes.size() - 1).getArrival());
+        routes.forEach(x -> x.setParentRoute(transportAvailible));
+        transportAvailible.setTransport(t);
+        TransportAvailible ta=new TransportAvailible(t,departureLocation,arrivalLocation,date,noSeats,departureHour);
         transportDao.createTransportAvailable(ta);
         routes.forEach(x -> {
Index: src/main/java/com/tourMate/services/impl/UsersManagerImpl.java
===================================================================
--- src/main/java/com/tourMate/services/impl/UsersManagerImpl.java	(revision 07f4e8b52fa18ab7781f9660c09d7982d8cd5a0b)
+++ src/main/java/com/tourMate/services/impl/UsersManagerImpl.java	(revision 0f5aa2759dde06c45eeb640feeb15cb583c6af32)
@@ -2,10 +2,14 @@
 
 import com.tourMate.dao.UsersDao;
+import com.tourMate.dto.PrincipalInfo;
 import com.tourMate.entities.User;
+import com.tourMate.events.OnProfileEnabledEvent;
 import com.tourMate.services.UsersManager;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationEventPublisher;
 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.password.PasswordEncoder;
 import org.springframework.stereotype.Service;
 
@@ -18,5 +22,8 @@
     @Autowired
     UsersDao usersDao;
-
+    @Autowired
+    ApplicationEventPublisher eventPublisher;
+    @Autowired
+    PasswordEncoder passwordEncoder;
     @Override
     public void createUser(String name, String surname, String email, Date birthDate, String address, String contact) {
@@ -64,4 +71,39 @@
 
     @Override
+    public List<User> getAdmins() {
+        return usersDao.getAdmins();
+    }
+
+    @Override
+    public void connectAccount(Long id, String username, String password) {
+        User u1 = findUserByID(id);
+        User u2 = (User) loadUserByUsername(username);
+        if(passwordEncoder.matches(password, u2.getPassword()))
+        {
+            u1.addConnectedUser(u2);
+        }
+        usersDao.updateUser(u1);
+    }
+
+    @Override
+    public List<User> findConnectedAccountsByUser(Long id) {
+        User u = findUserByID(id);
+        return usersDao.findConnectedAccountsByUser(u);
+    }
+
+    @Override
+    public PrincipalInfo getPrincipalInfo(Long userId) {
+        PrincipalInfo principalInfo = new PrincipalInfo();
+        User u = findUserByID(userId);
+        principalInfo.setUsername(u.getUsername());
+        principalInfo.setRole(u.getRole().getRoleName());
+        principalInfo.setId(userId);
+        principalInfo.setName(u.getName());
+        principalInfo.setEmail(u.getEmail());
+        principalInfo.setSurname(u.getSurname());
+        return principalInfo;
+    }
+
+    @Override
     public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
         return usersDao.findUserByUsername(username);
