Index: src/main/java/com/example/rezevirajmasa/demo/bootstrap/DataInitialization.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/bootstrap/DataInitialization.java	(revision d24f17cb212e43f94a77a44d655ba10b4b8143d2)
+++ src/main/java/com/example/rezevirajmasa/demo/bootstrap/DataInitialization.java	(revision d24f17cb212e43f94a77a44d655ba10b4b8143d2)
@@ -0,0 +1,108 @@
+//package com.example.rezevirajmasa.demo.bootstrap;
+//
+//import com.example.rezevirajmasa.demo.model.Reservation;
+//import com.example.rezevirajmasa.demo.model.Restaurant;
+//import com.example.rezevirajmasa.demo.model.TableEntity;
+//import com.example.rezevirajmasa.demo.service.ReservationService;
+//import com.example.rezevirajmasa.demo.service.RestaurantService;
+//import com.example.rezevirajmasa.demo.service.TableService;
+//import jakarta.annotation.PostConstruct;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.boot.ApplicationArguments;
+//import org.springframework.stereotype.Component;
+//
+//import java.time.LocalDate;
+//import java.time.LocalDateTime;
+//import java.time.LocalTime;
+//import java.time.format.DateTimeFormatter;
+//import java.util.ArrayList;
+//import java.util.List;
+//
+//@Component
+//public class DataInitialization {
+//    private final RestaurantService restaurantService;
+//    private final TableService tableService;
+//    private final ReservationService reservationService;
+//
+//    public DataInitialization(RestaurantService restaurantService, TableService tableService, ReservationService reservationService) {
+//        this.restaurantService = restaurantService;
+//        this.tableService = tableService;
+//        this.reservationService = reservationService;
+//    }
+//
+////    @PostConstruct
+//    public void initData() {
+//        for(Restaurant restaurant : restaurantService.listall()) {
+//            extendTimeSlotsIndefinitely(restaurant);
+//        }
+//    }
+//
+//    private void extendTimeSlotsIndefinitely(Restaurant restaurant) {
+//        while (true) {
+//            String[] hours = restaurant.getOperatingHours().split("-");
+//            LocalTime startTime = LocalTime.parse(hours[0], DateTimeFormatter.ofPattern("HH:mm"));
+//            LocalTime endTime = LocalTime.parse(hours[1], DateTimeFormatter.ofPattern("HH:mm"));
+//
+//            // Get the current date and time
+//            LocalDateTime currentDateTime = LocalDateTime.now().with(startTime);
+//
+//            // Calculate the end date (current date + 3 days)
+//            LocalDateTime endDate = LocalDateTime.now().with(endTime).plusDays(3);
+//
+//            List<TableEntity> tables = restaurant.getTablesList();
+//            for (TableEntity table : tables) {
+//                List<LocalDateTime> existingTimeSlots = table.getTimeSlots();
+//                List<Reservation> existingReservations = reservationService.findReservationsByTableAndDateRange(table, currentDateTime, endDate);
+//                List<LocalDateTime> newTimeSlots = generateTimeSlots(currentDateTime, endDate, existingReservations, existingTimeSlots, startTime, endTime);
+//                existingTimeSlots.addAll(newTimeSlots);
+//                tableService.saveTable(table);
+//            }
+//
+//            // Sleep for a period before generating time slots again
+//            try {
+//                // Sleep for 24 hours
+//                Thread.sleep(24 * 60 * 60 * 1000);
+//            } catch (InterruptedException e) {
+//                // Handle interrupted exception
+//                break;
+//            }
+//        }
+//    }
+//
+//    private List<LocalDateTime> generateTimeSlots(LocalDateTime startDate, LocalDateTime endDate, List<Reservation> existingReservations, List<LocalDateTime> existingTimeSlots, LocalTime startTime, LocalTime endTime) {
+//        List<LocalDateTime> timeSlots = new ArrayList<>();
+//        LocalDateTime currentDateTime = startDate;
+//        LocalTime currentTime = startTime;
+//        LocalDate currentDate = LocalDate.now(); // Get the current date
+//
+//        // Generate time slots until the end date
+//        while (currentDateTime.isBefore(endDate)) {
+//            // Ensure the current date is within the restaurant's opening hours
+//            if (currentDateTime.toLocalTime().isBefore(startTime)) {
+//                currentDateTime = currentDateTime.plusDays(1).with(startTime); // Move to the next day and set the start time
+//                continue; // Skip generating time slots for this day
+//            }
+//
+//            final LocalDateTime currentTimeSlotStart = currentDateTime; // Declare a final local variable
+//
+//            // Check if the current time slot overlaps with existing reservations
+//            boolean overlapsReservations = existingReservations.stream()
+//                    .anyMatch(reservation -> isOverlapping(currentTimeSlotStart, currentTimeSlotStart.plusMinutes(15), reservation.getCheckInTime(), reservation.getCheckOutTime()));
+//            boolean overlapsExistingTimeSlots = existingTimeSlots.stream()
+//                    .anyMatch(existingSlot -> isOverlapping(currentTimeSlotStart, currentTimeSlotStart.plusMinutes(15), existingSlot, existingSlot.plusMinutes(15)));
+//
+//            if (!overlapsReservations && !overlapsExistingTimeSlots) {
+//                timeSlots.add(currentDateTime);
+//            }
+//
+//            // Move to the next time slot (add 15 minutes
+//            currentDateTime = currentDateTime.plusMinutes(15);
+//        }
+//
+//        return timeSlots;
+//    }
+//
+//    private boolean isOverlapping(LocalDateTime start1, LocalDateTime end1, LocalDateTime start2, LocalDateTime end2) {
+//        return start1.isBefore(end2) && start2.isBefore(end1);
+//    }
+//}
Index: src/main/java/com/example/rezevirajmasa/demo/bootstrap/ReservationInitializer.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/bootstrap/ReservationInitializer.java	(revision d24f17cb212e43f94a77a44d655ba10b4b8143d2)
+++ src/main/java/com/example/rezevirajmasa/demo/bootstrap/ReservationInitializer.java	(revision d24f17cb212e43f94a77a44d655ba10b4b8143d2)
@@ -0,0 +1,48 @@
+package com.example.rezevirajmasa.demo.bootstrap;
+
+import com.example.rezevirajmasa.demo.model.Reservation;
+import com.example.rezevirajmasa.demo.model.Restaurant;
+import com.example.rezevirajmasa.demo.service.ReservationHistoryService;
+import com.example.rezevirajmasa.demo.service.ReservationService;
+import org.springframework.stereotype.Component;
+
+import jakarta.annotation.PostConstruct;
+import java.time.LocalDateTime;
+import java.util.List;
+import java.util.stream.Collectors;
+
+@Component
+public class ReservationInitializer {
+    private final ReservationHistoryService reservationHistoryService;
+    private final ReservationService reservationService;
+
+    public ReservationInitializer(ReservationHistoryService reservationHistoryService, ReservationService reservationService) {
+        this.reservationHistoryService = reservationHistoryService;
+        this.reservationService = reservationService;
+    }
+
+    @PostConstruct
+    public void initializePastReservations() {
+        LocalDateTime currentTime = LocalDateTime.now();
+        List<Reservation> reservationsToMove = reservationService.findReservationsToMove(currentTime);
+
+        List<Restaurant.ReservationHistory> reservationHistories = reservationsToMove.stream()
+                .map(reservation -> new Restaurant.ReservationHistory(
+                        reservation.getCustomer(),
+                        reservation.getTable(),
+                        reservation.getRestaurant(),
+                        reservation.getReservationDateTime(),
+                        reservation.getPartySize(),
+                        reservation.getSpecialRequests(),
+                        "Done",
+                        null, // You can set cancellation reason if needed, it's not clear from the code provided
+                        reservation.getCheckInTime() // Use currentTime for check-in date
+                ))
+                .collect(Collectors.toList());
+
+        reservationHistoryService.moveReservationsToPast(reservationHistories);
+
+        reservationsToMove.forEach(reservation -> reservationService.deleteReservation(reservation.getReservationID()));
+    }
+
+}
Index: src/main/java/com/example/rezevirajmasa/demo/bootstrap/TimeSlotManagementService.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/bootstrap/TimeSlotManagementService.java	(revision d24f17cb212e43f94a77a44d655ba10b4b8143d2)
+++ src/main/java/com/example/rezevirajmasa/demo/bootstrap/TimeSlotManagementService.java	(revision d24f17cb212e43f94a77a44d655ba10b4b8143d2)
@@ -0,0 +1,81 @@
+package com.example.rezevirajmasa.demo.bootstrap;
+
+import com.example.rezevirajmasa.demo.model.Reservation;
+import com.example.rezevirajmasa.demo.model.Restaurant;
+import com.example.rezevirajmasa.demo.model.TableEntity;
+import com.example.rezevirajmasa.demo.repository.ReservationRepository;
+import com.example.rezevirajmasa.demo.repository.TableRepository;
+import jakarta.annotation.PostConstruct;
+import jakarta.annotation.PreDestroy;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cglib.core.Local;
+import org.springframework.stereotype.Component;
+
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Collectors;
+
+@Component
+public class TimeSlotManagementService  {
+    @Autowired
+    private TableRepository tableRepository;
+    @Autowired
+    private ReservationRepository reservationRepository;
+
+    @PostConstruct
+    public void initializeTimeSlots() {
+        LocalDate startDate = LocalDate.now();
+        initializeTimeSlotsForNextDays(startDate);
+    }
+
+    private void initializeTimeSlotsForNextDays(LocalDate startDate) {
+        LocalDate currentDate = startDate;
+        for (int i = 0; i < 3; i++) {
+            Iterable<TableEntity> tableEntities = tableRepository.findAll();
+            for (TableEntity tableEntity : tableEntities) {
+                initializeTimeSlotsForTable(tableEntity, currentDate);
+                tableRepository.save(tableEntity);
+            }
+            currentDate = currentDate.plusDays(1);
+        }
+    }
+
+    private void initializeTimeSlotsForTable(TableEntity tableEntity, LocalDate date) {
+        // Get existing time slots for the table
+        List<LocalDateTime> existingTimeSlots = tableEntity.getTimeSlots().stream()
+                .filter(slot -> slot.toLocalDate().isEqual(date)) // Filter time slots for the specified date
+                .toList();
+
+        // If existing time slots are not null and not empty, return without initializing new ones
+        if (!existingTimeSlots.isEmpty()) {
+            return;
+        }
+
+        Restaurant restaurant = tableEntity.getRestaurant();
+        String[] hours = restaurant.getOperatingHours().split("-");
+        LocalTime startTime = LocalTime.parse(hours[0], DateTimeFormatter.ofPattern("HH:mm"));
+        LocalTime endTime = LocalTime.parse(hours[1], DateTimeFormatter.ofPattern("HH:mm"));
+
+        List<LocalDateTime> reservationCheckIns = getReservationCheckInsAfterNow(date);
+
+        tableEntity.initializeTimeSlots(startTime, endTime, Collections.singletonList(date), reservationCheckIns);
+    }
+
+    private List<LocalDateTime> getReservationCheckInsAfterNow(LocalDate date) {
+        LocalDateTime currentTime = LocalDateTime.now();
+        List<Reservation> reservations = reservationRepository.findByCheckInTimeAfterAndCheckInTimeBefore(
+                LocalDateTime.of(date, LocalTime.MIN), LocalDateTime.of(date, LocalTime.MAX));
+        List<LocalDateTime> checkIns = new ArrayList<>();
+        for (Reservation reservation : reservations) {
+            if (reservation.getCheckInTime().isAfter(currentTime)) {
+                checkIns.add(reservation.getCheckInTime());
+            }
+        }
+        return checkIns;
+    }
+}
Index: src/main/java/com/example/rezevirajmasa/demo/component/ReservationScheduler.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/component/ReservationScheduler.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ 	(revision )
@@ -1,20 +1,0 @@
-package com.example.rezevirajmasa.demo.component;
-
-import com.example.rezevirajmasa.demo.service.ReservationService;
-import jakarta.annotation.PostConstruct;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Component;
-
-@Component
-public class ReservationScheduler {
-    private final ReservationService reservationService;
-
-    public ReservationScheduler(ReservationService reservationService) {
-        this.reservationService = reservationService;
-    }
-
-    @PostConstruct
-    void runOnStartup() {
-        reservationService.findReservationsToMove();
-    }
-}
Index: src/main/java/com/example/rezevirajmasa/demo/config/ModelMapperConfig.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/config/ModelMapperConfig.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ 	(revision )
@@ -1,34 +1,0 @@
-package com.example.rezevirajmasa.demo.config;
-
-import com.example.rezevirajmasa.demo.dto.ReservationDTO;
-import com.example.rezevirajmasa.demo.dto.RestaurantDTO;
-import com.example.rezevirajmasa.demo.dto.TableDTO;
-import com.example.rezevirajmasa.demo.model.Reservation;
-import com.example.rezevirajmasa.demo.model.Restaurant;
-import com.example.rezevirajmasa.demo.model.TableEntity;
-import org.modelmapper.ModelMapper;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-@Configuration
-public class ModelMapperConfig {
-    @Bean
-    public ModelMapper modelMapper() {
-        ModelMapper modelMapper = new ModelMapper();
-
-        modelMapper.typeMap(Restaurant.class, RestaurantDTO.class).addMappings(mapper -> {
-            mapper.map(Restaurant::getTablesList, RestaurantDTO::setTablesList);
-        });
-
-        modelMapper.typeMap(TableEntity.class, TableDTO.class).addMappings(mapper -> {
-            mapper.map(TableEntity::getReservations, TableDTO::setReservations);
-        });
-
-        modelMapper.typeMap(Reservation.class, ReservationDTO.class).addMappings(mapper -> {
-            mapper.map(Reservation::getReservationStatus, ReservationDTO::setReservationStatus);
-            mapper.map(Reservation::getPaymentStatus, ReservationDTO::setPaymentStatus);
-        });
-
-        return modelMapper;
-    }
-}
Index: src/main/java/com/example/rezevirajmasa/demo/config/PasswordEncoder.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/config/PasswordEncoder.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ 	(revision )
@@ -1,13 +1,0 @@
-package com.example.rezevirajmasa.demo.config;
-
-import org.springframework.context.annotation.Bean;
-import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
-import org.springframework.stereotype.Component;
-
-@Component
-public class PasswordEncoder {
-    @Bean
-    public org.springframework.security.crypto.password.PasswordEncoder passwordEncoder() {
-        return new BCryptPasswordEncoder();
-    }
-}
Index: src/main/java/com/example/rezevirajmasa/demo/config/RestExceptionHandler.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/config/RestExceptionHandler.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ 	(revision )
@@ -1,25 +1,0 @@
-package com.example.rezevirajmasa.demo.config;
-
-import com.example.rezevirajmasa.demo.dto.ErrorDto;
-import com.example.rezevirajmasa.demo.model.exceptions.AppException;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.http.converter.HttpMessageNotWritableException;
-import org.springframework.web.bind.annotation.ControllerAdvice;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.ResponseBody;
-
-@ControllerAdvice
-public class RestExceptionHandler {
-    @ExceptionHandler(value = {AppException.class})
-    @ResponseBody
-    public ResponseEntity<ErrorDto> handleException(AppException ex) {
-        return ResponseEntity.status(ex.getCode())
-                .body(ErrorDto.builder().message(ex.getMessage()).build());
-    }
-
-    @ExceptionHandler(HttpMessageNotWritableException.class)
-    public ResponseEntity<String> handleHttpMessageNotWritableException(HttpMessageNotWritableException ex) {
-        return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("An error occurred while processing the response.");
-    }
-}
Index: src/main/java/com/example/rezevirajmasa/demo/config/SecurityConfig.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/config/SecurityConfig.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ src/main/java/com/example/rezevirajmasa/demo/config/SecurityConfig.java	(revision d24f17cb212e43f94a77a44d655ba10b4b8143d2)
@@ -1,11 +1,7 @@
 package com.example.rezevirajmasa.demo.config;
 
-import com.example.rezevirajmasa.demo.model.exceptions.CustomerAuthenticationEntryPoint;
-import com.example.rezevirajmasa.demo.web.filters.JwtAuthFilter;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.http.HttpMethod;
 import org.springframework.security.authentication.AuthenticationManager;
-import org.springframework.security.config.Customizer;
 import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
 import org.springframework.security.config.annotation.web.builders.HttpSecurity;
@@ -13,20 +9,11 @@
 import org.springframework.security.config.annotation.web.configuration.WebSecurityCustomizer;
 import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
-import org.springframework.security.config.http.SessionCreationPolicy;
 import org.springframework.security.core.userdetails.UserDetailsService;
 import org.springframework.security.web.SecurityFilterChain;
-import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
-import org.springframework.security.web.authentication.www.BasicAuthenticationFilter;
 import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
-import org.springframework.web.cors.CorsConfiguration;
+import org.springframework.context.annotation.Configuration;
 import org.springframework.web.servlet.config.annotation.CorsRegistry;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.security.config.annotation.web.builders.HttpSecurity;
-import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
-import org.springframework.security.web.SecurityFilterChain;
 import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
 
-import java.util.List;
 
 @Configuration
@@ -34,11 +21,7 @@
 public class SecurityConfig implements WebMvcConfigurer {
     private final UserDetailsService userDetailsService;
-    private final CustomerAuthenticationEntryPoint customerAuthenticationEntryPoint;
-    private final UserAuthProvider userAuthProvider;
 
-    public SecurityConfig(UserDetailsService userDetailsService, CustomerAuthenticationEntryPoint customerAuthenticationEntryPoint, UserAuthProvider userAuthProvider) {
+    public SecurityConfig(UserDetailsService userDetailsService) {
         this.userDetailsService = userDetailsService;
-        this.customerAuthenticationEntryPoint = customerAuthenticationEntryPoint;
-        this.userAuthProvider = userAuthProvider;
     }
 
@@ -51,20 +34,32 @@
     public void addCorsMappings(CorsRegistry registry) {
         registry.addMapping("/**")
-                .allowedOrigins("http://localhost:3000")
-                .allowedMethods("GET", "POST", "PUT", "DELETE")
-                .allowedHeaders("*")
-                .allowCredentials(true)
-                .maxAge(3600L);
+                .allowedOrigins("http://localhost:3000") // Allow requests from this origin
+                .allowedMethods("GET", "POST", "PUT", "DELETE") // Allow these HTTP methods
+                .allowedHeaders("*"); // Allow all headers
     }
 
     @Bean
-    public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
+    public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception  {
+
         http
                 .csrf(AbstractHttpConfigurer::disable)
-                .authorizeHttpRequests(auth -> auth
-                        .requestMatchers("/api/auth/**").permitAll()
-                        .requestMatchers("/api/user/**", "/api/cuisineTypes", "/api/restaurants").authenticated()
+                .authorizeHttpRequests( (requests) -> requests
+                        .requestMatchers(AntPathRequestMatcher.antMatcher("/"), AntPathRequestMatcher.antMatcher("/restaurants"))
+                        .permitAll()
+                        .anyRequest()
+                        .hasAnyRole("ADMIN", "USER")
                 )
-                .sessionManagement(sess -> sess.sessionCreationPolicy(SessionCreationPolicy.STATELESS));
+                .formLogin((form) -> form
+                        .permitAll()
+                        .failureUrl("/login?error=BadCredentials")
+                        .defaultSuccessUrl("/restaurants", true)
+                )
+                .logout((logout) -> logout
+                        .logoutUrl("/logout")
+                        .clearAuthentication(true)
+                        .invalidateHttpSession(true)
+                        .deleteCookies("JSESSIONID")
+                        .logoutSuccessUrl("/")
+                );
 
         return http.build();
@@ -79,50 +74,2 @@
     }
 }
-//
-//import com.example.rezevirajmasa.demo.web.filters.JwtAuthFilter;
-//import org.springframework.context.annotation.Bean;
-//import org.springframework.context.annotation.Configuration;
-//import org.springframework.security.authentication.AuthenticationManager;
-//import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
-//import org.springframework.security.config.annotation.web.builders.HttpSecurity;
-//import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
-//import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
-//import org.springframework.security.config.http.SessionCreationPolicy;
-//import org.springframework.security.core.userdetails.UserDetailsService;
-//import org.springframework.security.web.SecurityFilterChain;
-//import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
-//
-//@Configuration
-//@EnableWebSecurity
-//public class SecurityConfig {
-//
-//    private final UserDetailsService userDetailsService;
-////    private final UserAuthProvider userAuthProvider;
-//    private final JwtAuthFilter jwtAuthFilter;
-//
-//    public SecurityConfig(UserDetailsService userDetailsService) {
-//        this.userDetailsService = userDetailsService;
-////        this.userAuthProvider = userAuthProvider;
-//        this.jwtAuthFilter = new JwtAuthFilter(userAuthProvider);
-//    }
-//
-//    @Bean
-//    public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
-//        http
-//                .csrf(AbstractHttpConfigurer::disable)
-//                .sessionManagement(sess -> sess.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
-//                .authorizeHttpRequests((requests) -> requests
-//                        .requestMatchers("/api/login", "/api/register").permitAll()
-//                        .anyRequest().authenticated())
-//                .addFilterBefore(jwtAuthFilter, UsernamePasswordAuthenticationFilter.class);
-//
-//        return http.build();
-//    }
-//
-//    @Bean
-//    public AuthenticationManager authenticationManager(HttpSecurity http) throws Exception {
-//        AuthenticationManagerBuilder authenticationManagerBuilder = http.getSharedObject(AuthenticationManagerBuilder.class);
-//        authenticationManagerBuilder.userDetailsService(userDetailsService);
-//        return authenticationManagerBuilder.build();
-//    }
-//}
Index: src/main/java/com/example/rezevirajmasa/demo/config/UserAuthProvider.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/config/UserAuthProvider.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ 	(revision )
@@ -1,80 +1,0 @@
-package com.example.rezevirajmasa.demo.config;
-
-import com.auth0.jwt.JWT;
-import com.auth0.jwt.JWTVerifier;
-import com.auth0.jwt.algorithms.Algorithm;
-import com.auth0.jwt.interfaces.DecodedJWT;
-import com.example.rezevirajmasa.demo.dto.UserDto;
-import com.example.rezevirajmasa.demo.service.UserService;
-import io.jsonwebtoken.Claims;
-import io.jsonwebtoken.Jwts;
-import jakarta.annotation.PostConstruct;
-import lombok.RequiredArgsConstructor;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
-import org.springframework.security.core.Authentication;
-import org.springframework.security.core.userdetails.UserDetails;
-import org.springframework.stereotype.Component;
-
-import java.util.*;
-import java.util.function.Function;
-
-@RequiredArgsConstructor
-@Component
-public class UserAuthProvider {
-    @Value("${security.jwt.token.secret-key:secret:value}")
-    private String secretKey;
-
-    private final UserService userService;
-
-    @PostConstruct
-    protected void init() {
-        secretKey = Base64.getEncoder().encodeToString(secretKey.getBytes());
-    }
-
-    public String generateToken(UserDetails userDetails){
-        Map<String, Object> claims = new HashMap<>();
-        return createToken(userDetails.getUsername());
-    }
-
-    public String createToken(String login) {
-        Date now = new Date();
-        Date validity = new Date(now.getTime() + 3_600_000);
-        return JWT.create()
-                .withIssuer(login)
-                .withIssuedAt(now)
-                .withExpiresAt(validity)
-                .sign(Algorithm.HMAC256(secretKey));
-    }
-
-    public Authentication validateToken(String token) {
-        JWTVerifier verifier = JWT.require(Algorithm.HMAC256(secretKey)).build();
-
-        DecodedJWT decoded = verifier.verify(token);
-
-        UserDto user = userService.findByEmail(decoded.getIssuer());
-
-        return new UsernamePasswordAuthenticationToken(user, null, Collections.emptyList());
-    }
-
-    public String extractUsername(String token) {
-        return extractClaim(token, Claims::getSubject);
-    }
-
-    public Date extractExpiration(String token) {
-        return extractClaim(token, Claims::getExpiration);
-    }
-
-    public <T> T extractClaim(String token, Function<Claims, T> claimsResolver) {
-        final Claims claims = extractAllClaims(token);
-        return claimsResolver.apply(claims);
-    }
-
-    private Claims extractAllClaims(String token) {
-        return Jwts.parser().setSigningKey(secretKey).parseClaimsJws(token).getBody();
-    }
-
-    private Boolean isTokenExpired(String token) {
-        return extractExpiration(token).before(new Date());
-    }
-}
Index: src/main/java/com/example/rezevirajmasa/demo/config/security/SecurityConstants.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/config/security/SecurityConstants.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ 	(revision )
@@ -1,9 +1,0 @@
-package com.example.rezevirajmasa.demo.config.security;
-
-public class SecurityConstants {
-    public static final String SECRET = "s3cr3tt0k3n";
-    public static final long EXPIRATION_TIME = 864_000_000; // 10 days
-    public static final String TOKEN_PREFIX = "Bearer ";
-    public static final String HEADER_STRING = "Authorization";
-
-}
Index: src/main/java/com/example/rezevirajmasa/demo/dto/CredentialsDto.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/dto/CredentialsDto.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ 	(revision )
@@ -1,15 +1,0 @@
-package com.example.rezevirajmasa.demo.dto;
-
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-@AllArgsConstructor
-@NoArgsConstructor
-@Builder
-@Data
-public class CredentialsDto {
-    private String email;
-    private char[] password;
-}
Index: src/main/java/com/example/rezevirajmasa/demo/dto/CustomerDTO.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/dto/CustomerDTO.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ src/main/java/com/example/rezevirajmasa/demo/dto/CustomerDTO.java	(revision d24f17cb212e43f94a77a44d655ba10b4b8143d2)
@@ -2,22 +2,12 @@
 
 import com.example.rezevirajmasa.demo.model.MembershipLevel;
-import com.example.rezevirajmasa.demo.model.Role;
-import lombok.Getter;
-import lombok.Setter;
 
-import java.sql.Date;
-import java.sql.Timestamp;
-
-@Setter
-@Getter
 public class CustomerDTO {
-    private Long customerId;
     private String firstName;
     private String lastName;
     private String email;
+    private String password;
     private String phone;
     private String address;
     private MembershipLevel membershipLevel;
-//    private Date registrationDate;
-    private Role role;
 }
Index: src/main/java/com/example/rezevirajmasa/demo/dto/ErrorDto.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/dto/ErrorDto.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ 	(revision )
@@ -1,12 +1,0 @@
-package com.example.rezevirajmasa.demo.dto;
-
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Data;
-
-@AllArgsConstructor
-@Builder
-@Data
-public class ErrorDto {
-    private String message;
-}
Index: src/main/java/com/example/rezevirajmasa/demo/dto/PreorderedItemDto.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/dto/PreorderedItemDto.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ 	(revision )
@@ -1,26 +1,0 @@
-package com.example.rezevirajmasa.demo.dto;
-
-import lombok.Getter;
-import lombok.Setter;
-
-import java.math.BigDecimal;
-
-@Setter
-@Getter
-public class PreorderedItemDto {
-    private String preorderedItemName;
-    private Integer quantity;
-    private BigDecimal price;
-    private Long menuID;
-
-    public PreorderedItemDto() {
-    }
-
-    public PreorderedItemDto(String preorderedItemName, Integer quantity, BigDecimal price, Long menuID) {
-        this.preorderedItemName = preorderedItemName;
-        this.quantity = quantity;
-        this.price = price;
-        this.menuID = menuID;
-    }
-
-}
Index: src/main/java/com/example/rezevirajmasa/demo/dto/ReservationDTO.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/dto/ReservationDTO.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ 	(revision )
@@ -1,119 +1,0 @@
-package com.example.rezevirajmasa.demo.dto;
-
-import com.example.rezevirajmasa.demo.model.PreorderedItem;
-import com.example.rezevirajmasa.demo.model.Reservation;
-import com.example.rezevirajmasa.demo.model.Restaurant;
-import lombok.Setter;
-
-import java.math.BigDecimal;
-import java.time.LocalDateTime;
-import java.util.List;
-import java.util.stream.Collectors;
-
-@Setter
-public class ReservationDTO {
-    private Long reservationID;
-    private String userEmail;
-    private BigDecimal rating;
-    private Long tableNumber;
-    private LocalDateTime reservationDateTime;
-    private LocalDateTime checkInTime;
-    private Long restaurantId;
-    private int partySize;
-    private String reservationStatus;
-    private String specialRequests;
-    private String paymentStatus;
-    private List<PreorderedItemDto> preOrderedItems;
-
-    public ReservationDTO() {
-    }
-
-    public ReservationDTO(Long reservationID, String userEmail, BigDecimal rating, Long tableNumber,
-                          LocalDateTime reservationDateTime, LocalDateTime checkInTime, Long restaurantId,
-                          int partySize, String reservationStatus, String specialRequests,
-                          String paymentStatus, List<PreorderedItemDto> preOrderedItems) {
-        this.reservationID = reservationID;
-        this.userEmail = userEmail;
-        this.rating = rating;
-        this.tableNumber = tableNumber;
-        this.reservationDateTime = reservationDateTime;
-        this.checkInTime = checkInTime;
-        this.restaurantId = restaurantId;
-        this.partySize = partySize;
-        this.reservationStatus = reservationStatus;
-        this.specialRequests = specialRequests;
-        this.paymentStatus = paymentStatus;
-        this.preOrderedItems = preOrderedItems;
-    }
-
-    public ReservationDTO(Reservation reservation) {
-        this.reservationID = reservation.getReservationID();
-        this.userEmail = reservation.getUser().getEmail();
-        this.rating = reservation.getRestaurant().getRating();
-        this.tableNumber = reservation.getTable().getId();
-        this.reservationDateTime = reservation.getReservationDateTime();
-        this.checkInTime = reservation.getCheckInTime();
-        this.restaurantId = reservation.getRestaurant().getRestaurantId();
-        this.partySize = reservation.getPartySize();
-        this.reservationStatus = reservation.getReservationStatus();
-        this.specialRequests = reservation.getSpecialRequests();
-        this.paymentStatus = reservation.getPaymentStatus();
-
-        this.preOrderedItems = reservation.getPreOrderedItems().stream()
-                .map(preorderedItem -> new PreorderedItemDto(
-                        preorderedItem.getPreorderedItemName(),
-                        preorderedItem.getQuantity(),
-                        preorderedItem.getPrice(),
-                        preorderedItem.getMenu().getMenuID()))
-                .collect(Collectors.toList());
-    }
-
-    public Long getReservationID() {
-        return reservationID;
-    }
-
-    public String getUserEmail() {
-        return userEmail;
-    }
-
-    public BigDecimal getRating() {
-        return rating;
-    }
-
-    public Long getTableNumber() {
-        return tableNumber;
-    }
-
-    public LocalDateTime getReservationDateTime() {
-        return reservationDateTime;
-    }
-
-    public LocalDateTime getCheckInTime() {
-        return checkInTime;
-    }
-
-    public Long getRestaurantId() {
-        return restaurantId;
-    }
-
-    public int getPartySize() {
-        return partySize;
-    }
-
-    public String getStatus() {
-        return reservationStatus;
-    }
-
-    public String getSpecialRequests() {
-        return specialRequests;
-    }
-
-    public String getPaymentStatus() {
-        return paymentStatus;
-    }
-
-    public List<PreorderedItemDto> getPreOrderedItems() {
-        return preOrderedItems;
-    }
-
-}
Index: src/main/java/com/example/rezevirajmasa/demo/dto/RestaurantDTO.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/dto/RestaurantDTO.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ 	(revision )
@@ -1,127 +1,0 @@
-package com.example.rezevirajmasa.demo.dto;
-
-import com.example.rezevirajmasa.demo.model.Restaurant;
-
-import java.util.List;
-
-public class RestaurantDTO {
-    private Long restaurantId;
-    private String name;
-    private String cuisineType;
-    private String address;
-    private String phone;
-    private String operatingHours;
-    private String website;
-    private String socialMediaLinks;
-    private Double rating;
-    private List<TableDTO> tablesList;
-
-    public RestaurantDTO() {
-    }
-
-    public RestaurantDTO(Long restaurantId, String name, String cuisineType, String address, String phone, String operatingHours, String website, String socialMediaLinks, Double rating, List<TableDTO> tablesList) {
-        this.restaurantId = restaurantId;
-        this.name = name;
-        this.cuisineType = cuisineType;
-        this.address = address;
-        this.phone = phone;
-        this.operatingHours = operatingHours;
-        this.website = website;
-        this.socialMediaLinks = socialMediaLinks;
-        this.rating = rating;
-        this.tablesList = tablesList;
-    }
-
-//    public RestaurantDTO(Restaurant restaurant) {
-//        this.restaurantId = restaurant.getRestaurantId();
-//        this.name = restaurant.getName();
-//        this.cuisineType = restaurant.getCuisineType();
-//        this.address = restaurant.getAddress();
-//        this.phone = restaurant.getPhone();
-//        this.operatingHours = restaurant.getOperatingHours();
-//        this.website = restaurant.getWebsite();
-//        this.socialMediaLinks = restaurant.getSocialMediaLinks();
-//        this.rating = restaurant.getRating().doubleValue();
-//        this.tablesList = restaurant.getTablesList();
-//    }
-
-    public Long getRestaurantId() {
-        return restaurantId;
-    }
-
-    public void setRestaurantId(Long restaurantId) {
-        this.restaurantId = restaurantId;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public String getCuisineType() {
-        return cuisineType;
-    }
-
-    public void setCuisineType(String cuisineType) {
-        this.cuisineType = cuisineType;
-    }
-
-    public String getAddress() {
-        return address;
-    }
-
-    public void setAddress(String address) {
-        this.address = address;
-    }
-
-    public String getPhone() {
-        return phone;
-    }
-
-    public void setPhone(String phone) {
-        this.phone = phone;
-    }
-
-    public String getOperatingHours() {
-        return operatingHours;
-    }
-
-    public void setOperatingHours(String operatingHours) {
-        this.operatingHours = operatingHours;
-    }
-
-    public String getWebsite() {
-        return website;
-    }
-
-    public void setWebsite(String website) {
-        this.website = website;
-    }
-
-    public String getSocialMediaLinks() {
-        return socialMediaLinks;
-    }
-
-    public void setSocialMediaLinks(String socialMediaLinks) {
-        this.socialMediaLinks = socialMediaLinks;
-    }
-
-    public Double getRating() {
-        return rating;
-    }
-
-    public void setRating(Double rating) {
-        this.rating = rating;
-    }
-
-    public List<TableDTO> getTablesList() {
-        return tablesList;
-    }
-
-    public void setTablesList(List<TableDTO> tablesList) {
-        this.tablesList = tablesList;
-    }
-}
Index: src/main/java/com/example/rezevirajmasa/demo/dto/SignUpDto.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/dto/SignUpDto.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ 	(revision )
@@ -1,20 +1,0 @@
-package com.example.rezevirajmasa.demo.dto;
-
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-@AllArgsConstructor
-@NoArgsConstructor
-@Builder
-@Data
-public class SignUpDto {
-    private String firstName;
-    private String lastName;
-    private String email;
-    private char[] password;
-    private String phone;
-    private String address;
-    private String membershipLevel;
-}
Index: src/main/java/com/example/rezevirajmasa/demo/dto/TableDTO.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/dto/TableDTO.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ 	(revision )
@@ -1,73 +1,0 @@
-package com.example.rezevirajmasa.demo.dto;
-
-import lombok.NoArgsConstructor;
-
-import java.util.List;
-
-@NoArgsConstructor
-    public class TableDTO {
-        private Long id;
-        private Integer capacity;
-        private String location;
-        private String description;
-        private Integer reservationDurationHours;
-        private List<ReservationDTO> reservations;
-
-    public TableDTO(Long id, Integer capacity, String location, String description, Integer reservationDurationHours, List<ReservationDTO> reservations) {
-        this.id = id;
-        this.capacity = capacity;
-        this.location = location;
-        this.description = description;
-        this.reservationDurationHours = reservationDurationHours;
-        this.reservations = reservations;
-    }
-
-    public Long getId() {
-        return id;
-    }
-
-    public void setId(Long id) {
-        this.id = id;
-    }
-
-    public Integer getCapacity() {
-        return capacity;
-    }
-
-    public void setCapacity(Integer capacity) {
-        this.capacity = capacity;
-    }
-
-    public String getLocation() {
-        return location;
-    }
-
-    public void setLocation(String location) {
-        this.location = location;
-    }
-
-    public String getDescription() {
-        return description;
-    }
-
-    public void setDescription(String description) {
-        this.description = description;
-    }
-
-    public Integer getReservationDurationHours() {
-        return reservationDurationHours;
-    }
-
-    public void setReservationDurationHours(Integer reservationDurationHours) {
-        this.reservationDurationHours = reservationDurationHours;
-    }
-
-    public List<ReservationDTO> getReservations() {
-        return reservations;
-    }
-
-    public void setReservations(List<ReservationDTO> reservations) {
-        this.reservations = reservations;
-    }
-}
-
Index: src/main/java/com/example/rezevirajmasa/demo/dto/UserDto.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/dto/UserDto.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ 	(revision )
@@ -1,21 +1,0 @@
-package com.example.rezevirajmasa.demo.dto;
-
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-@AllArgsConstructor
-@NoArgsConstructor
-@Builder
-@Data
-public class UserDto {
-    private Long id;
-    private String firstName;
-    private String lastName;
-    private String email;
-    private String token;
-    private String phone;
-    private String address;
-    private String membershipLevel;
-}
Index: src/main/java/com/example/rezevirajmasa/demo/mappers/UserMapper.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/mappers/UserMapper.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ 	(revision )
@@ -1,19 +1,0 @@
-package com.example.rezevirajmasa.demo.mappers;
-
-
-import com.example.rezevirajmasa.demo.dto.SignUpDto;
-import com.example.rezevirajmasa.demo.dto.UserDto;
-import com.example.rezevirajmasa.demo.model.User;
-import org.mapstruct.Mapper;
-import org.mapstruct.Mapping;
-
-@Mapper(componentModel = "spring")
-public interface UserMapper {
-    UserDto toUserDto(User user);
-
-    @Mapping(target = "password", ignore = true)
-    User signUpToUser(SignUpDto userDto);
-
-    SignUpDto toSignUpDto(UserDto userDto);
-    User toUser(UserDto userDto);
-}
Index: src/main/java/com/example/rezevirajmasa/demo/mappers/UserMapperImpl.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/mappers/UserMapperImpl.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ 	(revision )
@@ -1,77 +1,0 @@
-package com.example.rezevirajmasa.demo.mappers;
-
-import com.example.rezevirajmasa.demo.dto.SignUpDto;
-import com.example.rezevirajmasa.demo.dto.UserDto;
-import com.example.rezevirajmasa.demo.model.MembershipLevel;
-import com.example.rezevirajmasa.demo.model.User;
-import org.springframework.stereotype.Component;
-
-import java.util.Arrays;
-
-@Component
-public class UserMapperImpl implements UserMapper {
-
-    @Override
-    public UserDto toUserDto(User user) {
-        if (user == null) {
-            return null;
-        }
-
-        UserDto userDto = new UserDto();
-        userDto.setId(user.getUserId());
-        userDto.setFirstName(user.getFirstName());
-        userDto.setLastName(user.getLastName());
-        userDto.setEmail(user.getEmail());
-
-        return userDto;
-    }
-
-    @Override
-    public User signUpToUser(SignUpDto userDto) {
-        if (userDto == null) {
-            return null;
-        }
-
-        User user = new User();
-        user.setEmail(userDto.getEmail());
-        user.setFirstName(userDto.getFirstName());
-        user.setLastName(userDto.getLastName());
-        user.setPassword(Arrays.toString(userDto.getPassword()));
-
-        return user;
-    }
-
-    @Override
-    public SignUpDto toSignUpDto(UserDto userDto) {
-        if (userDto == null) {
-            return null;
-        }
-
-        SignUpDto signUpDto = new SignUpDto();
-        signUpDto.setEmail(userDto.getEmail());
-        signUpDto.setFirstName(userDto.getFirstName());
-        signUpDto.setLastName(userDto.getLastName());
-
-        signUpDto.setPassword(new char[0]);
-
-        return signUpDto;
-    }
-
-    @Override
-    public User toUser(UserDto userDto) {
-        if(userDto == null) {
-            return null;
-        }
-
-        User user = new User();
-        user.setLastName(userDto.getLastName());
-        user.setFirstName(userDto.getFirstName());
-        user.setPhone(userDto.getPhone());
-        user.setMembershipLevel(MembershipLevel.valueOf(userDto.getMembershipLevel()));
-        user.setAddress(userDto.getAddress());
-        user.setEmail(userDto.getEmail());
-        user.setUserId(userDto.getId());
-
-        return user;
-    }
-}
Index: src/main/java/com/example/rezevirajmasa/demo/model/Customer.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/model/Customer.java	(revision d24f17cb212e43f94a77a44d655ba10b4b8143d2)
+++ src/main/java/com/example/rezevirajmasa/demo/model/Customer.java	(revision d24f17cb212e43f94a77a44d655ba10b4b8143d2)
@@ -0,0 +1,155 @@
+package com.example.rezevirajmasa.demo.model;
+
+import jakarta.persistence.*;
+
+import java.util.Date;
+
+@Entity
+@Table(name = "customers")
+public class Customer {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "CustomerID")
+    private Long customerId;
+
+    @Column(name = "FirstName", length = 50)
+    private String firstName;
+
+    @Column(name = "LastName", length = 50)
+    private String lastName;
+
+    @Column(name = "Email", length = 100, unique = true)
+    private String email;
+
+    @Column(name = "Password", length = 100)
+    private String password;
+
+    @Enumerated(EnumType.STRING)
+    private Role role;
+
+    @Column(name = "Phone", length = 20)
+    private String phone;
+
+    @Column(name = "Address", columnDefinition = "TEXT")
+    private String address;
+
+    @Enumerated(EnumType.STRING)
+    @Column(name = "MembershipLevel", length = 20)
+    private MembershipLevel membershipLevel;
+
+    @Column(name = "RegistrationDate", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
+    @Temporal(TemporalType.TIMESTAMP)
+    private Date registrationDate;
+
+    public Customer(Long customerId, String firstName, String lastName, String email, String phone, String address, MembershipLevel membershipLevel, Date registrationDate, Role role) {
+        this.setCustomerId(customerId);
+        this.setFirstName(firstName);
+        this.setLastName(lastName);
+        this.setEmail(email);
+        this.setPhone(phone);
+        this.setAddress(address);
+        this.setMembershipLevel(membershipLevel);
+        this.setRegistrationDate(registrationDate);
+        this.setRole(Role.ROLE_USER);
+    }
+
+    public Customer() {
+
+    }
+
+    public Role getRole() {
+        return role;
+    }
+
+    public void setRole(Role role) {
+        this.role = role;
+    }
+
+    public String getFullName() {
+        return firstName + " " + lastName;
+    }
+    public Long getCustomerId() {
+        return customerId;
+    }
+
+    public void setCustomerId(Long customerId) {
+        this.customerId = customerId;
+    }
+
+    public String getFirstName() {
+        return firstName;
+    }
+
+    public void setFirstName(String firstName) {
+        this.firstName = firstName;
+    }
+
+    public String getLastName() {
+        return lastName;
+    }
+
+    public void setLastName(String lastName) {
+        this.lastName = lastName;
+    }
+
+    public String getEmail() {
+        return email;
+    }
+
+    public void setEmail(String email) {
+        this.email = email;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public String getPhone() {
+        return phone;
+    }
+
+    public void setPhone(String phone) {
+        this.phone = phone;
+    }
+
+    public String getAddress() {
+        return address;
+    }
+
+    public void setAddress(String address) {
+        this.address = address;
+    }
+
+    public Date getRegistrationDate() {
+        return registrationDate;
+    }
+    public MembershipLevel getMembershipLevel() {
+        return membershipLevel;
+    }
+
+    public void setMembershipLevel(MembershipLevel membershipLevel) {
+        this.membershipLevel = membershipLevel;
+    }
+    public void setRegistrationDate(Date registrationDate) {
+        this.registrationDate = registrationDate;
+    }
+
+    @Override
+    public String toString() {
+        return "Customer{" +
+                "customerId=" + customerId +
+                ", firstName='" + firstName + '\'' +
+                ", lastName='" + lastName + '\'' +
+                ", email='" + email + '\'' +
+                ", phone='" + phone + '\'' +
+                ", address='" + address + '\'' +
+                ", membershipLevel=" + membershipLevel +
+                ", registrationDate=" + registrationDate +
+                '}';
+    }
+}
Index: src/main/java/com/example/rezevirajmasa/demo/model/Menu.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/model/Menu.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ src/main/java/com/example/rezevirajmasa/demo/model/Menu.java	(revision d24f17cb212e43f94a77a44d655ba10b4b8143d2)
@@ -1,55 +1,45 @@
 package com.example.rezevirajmasa.demo.model;
 
-import com.fasterxml.jackson.annotation.JsonIgnore;
 import jakarta.persistence.*;
-import lombok.Data;
 
 import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.List;
 
 @Entity
 @Table(name = "menus")
-@Data
 public class Menu {
     @Id
     @GeneratedValue(strategy = GenerationType.IDENTITY)
-    @Column(name = "menu_id")
+    @Column(name = "MenuID")
     private Long menuID;
 
     @ManyToOne
-    @JoinColumn(name = "restaurant_id", nullable = false)
-    @JsonIgnore
+    @JoinColumn(name = "RestaurantID", nullable = false)
     private Restaurant restaurant;
 
-    @Column(name = "item_name", length = 100)
+    @Column(name = "ItemName", length = 100)
     private String itemName;
 
-    @Column(name = "menuCategory", length = 50)
-    private String menuCategory;
+    @Column(name = "Category", length = 50)
+    private String category;
 
-    @Column(name = "price", precision = 8, scale = 2)
+    @Column(name = "Price", precision = 8, scale = 2)
     private BigDecimal price;
 
-    @Column(name = "description")
+    @Column(name = "Description")
     private String description;
 
-    @OneToMany(mappedBy = "menu", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY)
-    private List<MenuTag> tags = new ArrayList<>();
-
-    @OneToMany(mappedBy = "menu", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY)
-    private List<PriceHistory> priceHistoryList = new ArrayList<>();
+    @Column(name = "DietaryInformation", columnDefinition = "JSONB")
+    private String dietaryInformation;
 
     public Menu() {
     }
 
-    public Menu(Long menuID, Restaurant restaurant, String itemName, String category, BigDecimal price, String description, List<MenuTag> tags) {
-        this.menuID = menuID;
+    public Menu(Restaurant restaurant, String itemName, String category, BigDecimal price, String description, String dietaryInformation) {
         this.restaurant = restaurant;
         this.itemName = itemName;
-        this.menuCategory = category;
+        this.category = category;
         this.price = price;
         this.description = description;
-        this.tags = tags;
+        this.dietaryInformation = dietaryInformation;
     }
 }
Index: src/main/java/com/example/rezevirajmasa/demo/model/MenuTag.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/model/MenuTag.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ 	(revision )
@@ -1,34 +1,0 @@
-package com.example.rezevirajmasa.demo.model;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import jakarta.persistence.*;
-import lombok.Data;
-
-@Entity
-@Table(name = "menu_tags")
-@Data
-public class MenuTag {
-    @Id
-    @GeneratedValue(strategy = GenerationType.IDENTITY)
-    private Long menuTagId;
-
-    @ManyToOne(fetch = FetchType.LAZY)
-    @JoinColumn(name = "menu_id", nullable = false)
-    @JsonIgnore
-    private Menu menu;
-
-    @Column(name = "tag_name", nullable = false)
-    private String tagName;
-
-    @Column(name = "tag_value", nullable = false)
-    private String tagValue;
-
-    public MenuTag() {}
-
-    public MenuTag(Menu menu, String tagName, String tagValue) {
-        this.menu = menu;
-        this.tagName = tagName;
-        this.tagValue = tagValue;
-    }
-}
-
Index: src/main/java/com/example/rezevirajmasa/demo/model/PreorderedItem.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/model/PreorderedItem.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ 	(revision )
@@ -1,39 +1,0 @@
-package com.example.rezevirajmasa.demo.model;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import jakarta.persistence.*;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-
-import java.math.BigDecimal;
-
-@Entity
-@Table(name = "reservation_preordered_items")
-@Getter
-@Setter
-@NoArgsConstructor
-@AllArgsConstructor
-public class PreorderedItem {
-
-    @Id
-    @GeneratedValue(strategy = GenerationType.IDENTITY)
-    private Long preorderedItemId;
-
-    private String preorderedItemName;
-
-    private Integer quantity;
-
-    @Column(name = "price_at_order", precision = 8, scale = 2, nullable = false)
-    private BigDecimal price;
-
-    @JsonIgnore
-    @ManyToOne
-    @JoinColumn(name = "reservation_id", nullable = false)
-    private Reservation reservation;
-
-    @ManyToOne
-    @JoinColumn(name = "menu_id", nullable = false)
-    private Menu menu;
-}
Index: src/main/java/com/example/rezevirajmasa/demo/model/PriceHistory.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/model/PriceHistory.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ 	(revision )
@@ -1,35 +1,0 @@
-package com.example.rezevirajmasa.demo.model;
-
-import jakarta.persistence.*;
-import lombok.Data;
-import java.math.BigDecimal;
-import java.time.LocalDateTime;
-
-@Entity
-@Table(name = "price_history")
-@Data
-public class PriceHistory {
-
-    @Id
-    @GeneratedValue(strategy = GenerationType.IDENTITY)
-    @Column(name = "price_history_id")
-    private Long priceHistoryID;
-
-    @ManyToOne
-    @JoinColumn(name = "menu_id", nullable = false)
-    private Menu menu;
-
-    @Column(name = "old_price", precision = 8, scale = 2, nullable = false)
-    private BigDecimal oldPrice;
-
-    @Column(name = "change_date", nullable = false)
-    private LocalDateTime changeDate;
-
-    public PriceHistory() {}
-
-    public PriceHistory(Menu menu, BigDecimal oldPrice, LocalDateTime changeDate) {
-        this.menu = menu;
-        this.oldPrice = oldPrice;
-        this.changeDate = changeDate;
-    }
-}
Index: src/main/java/com/example/rezevirajmasa/demo/model/Reservation.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/model/Reservation.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ src/main/java/com/example/rezevirajmasa/demo/model/Reservation.java	(revision d24f17cb212e43f94a77a44d655ba10b4b8143d2)
@@ -1,21 +1,11 @@
 package com.example.rezevirajmasa.demo.model;
 
-import com.example.rezevirajmasa.demo.dto.PreorderedItemDto;
-import com.fasterxml.jackson.annotation.JsonBackReference;
-import com.fasterxml.jackson.annotation.JsonManagedReference;
 import jakarta.persistence.*;
-import lombok.Data;
-import lombok.Getter;
-import lombok.Setter;
 
-import java.math.BigDecimal;
 import java.time.LocalDateTime;
 import java.time.LocalTime;
-import java.util.ArrayList;
-import java.util.List;
 
 @Entity
 @Table(name = "reservations")
-@Data
 public class Reservation {
 
@@ -26,11 +16,9 @@
 
     @ManyToOne
-    @JoinColumn(name = "UserID")
-    @JsonBackReference(value = "user-reservations")
-    private User user;
+    @JoinColumn(name = "CustomerID")
+    private Customer customer;
 
     @ManyToOne
     @JoinColumn(name = "TableNumber", nullable = false)
-    @JsonBackReference
     private TableEntity table;
 
@@ -48,18 +36,17 @@
     private String specialRequests;
 
-    @Column(name = "Status", length = 20, nullable = false)
-    private String reservationStatus;
+    @Column(name = "Status", length = 20, nullable = false, columnDefinition = "VARCHAR default 'Pending'")
+    private String status;
 
     @Column(name = "CheckInTime")
     private LocalDateTime checkInTime;
 
-    @Getter
     @Column(name = "CheckOutTime")
     private LocalDateTime checkOutTime;
 
-    @OneToMany(mappedBy = "reservation", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY)
-    private List<PreorderedItem> preOrderedItems = new ArrayList<>();
+//    @Column(name = "TotalAmount", precision = 8, scale = 2)
+//    private BigDecimal totalAmount;//rezervacija so depozit ako e
 
-    @Column(name = "PaymentStatus", length = 20, nullable = false, columnDefinition = "VARCHAR default 'Unpaid'")
+    @Column(name = "Pa`ymentStatus", length = 20, nullable = false, columnDefinition = "VARCHAR default 'Unpaid'")
     private String paymentStatus;
 
@@ -68,8 +55,11 @@
     }
 
+    // Constructors, getters, setters, and other methods...
+
     @PrePersist
     private void prePersist() {
-        if (reservationStatus == null) {
-            reservationStatus = "Pending";
+        // Set default values or perform any pre-persistence logic if needed
+        if (status == null) {
+            status = "Pending";
         }
         if (paymentStatus == null) {
@@ -78,12 +68,12 @@
     }
 
-    public Reservation(User user, TableEntity table, Restaurant restaurant, LocalDateTime reservationDateTime, int partySize, String specialRequests, String status, LocalDateTime checkInTime, LocalDateTime checkOutTime, String paymentStatus) {
+    public Reservation(Customer customer, TableEntity table, Restaurant restaurant, LocalDateTime reservationDateTime, int partySize, String specialRequests, String status, LocalDateTime checkInTime, LocalDateTime checkOutTime, String paymentStatus) {
+//        this.customer = customer;
         this.table = table;
-        this.user = user;
         this.restaurant = restaurant;
         this.reservationDateTime = reservationDateTime;
         this.partySize = partySize;
         this.specialRequests = specialRequests;
-        this.reservationStatus = status;
+        this.status = status;
         this.checkInTime = checkInTime;
         this.checkOutTime = checkOutTime;
@@ -91,4 +81,91 @@
     }
 
+    public Long getReservationID() {
+        return reservationID;
+    }
+
+    public void setReservationID(Long reservationID) {
+        this.reservationID = reservationID;
+    }
+
+    public Customer getCustomer() {
+        return customer;
+    }
+
+    public void setCustomer(Customer customer) {
+        this.customer = customer;
+    }
+
+    public TableEntity getTable() {
+        return table;
+    }
+
+    public void setTable(TableEntity table) {
+        this.table = table;
+    }
+
+    public Restaurant getRestaurant() {
+        return restaurant;
+    }
+
+    public void setRestaurant(Restaurant restaurant) {
+        this.restaurant = restaurant;
+    }
+
+    public LocalDateTime getReservationDateTime() {
+        return reservationDateTime;
+    }
+
+    public void setReservationDateTime(LocalDateTime reservationDateTime) {
+        this.reservationDateTime = reservationDateTime;
+    }
+
+    public int getPartySize() {
+        return partySize;
+    }
+
+    public void setPartySize(int partySize) {
+        this.partySize = partySize;
+    }
+
+    public String getSpecialRequests() {
+        return specialRequests;
+    }
+
+    public void setSpecialRequests(String specialRequests) {
+        this.specialRequests = specialRequests;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public LocalDateTime getCheckInTime() {
+        return checkInTime;
+    }
+
+    public void setCheckInTime(LocalDateTime checkInTime) {
+        this.checkInTime = checkInTime;
+    }
+
+    public LocalDateTime getCheckOutTime() {
+        return checkOutTime;
+    }
+
+    public void setCheckOutTime(LocalDateTime checkOutTime) {
+        this.checkOutTime = checkOutTime;
+    }
+
+    public String getPaymentStatus() {
+        return paymentStatus;
+    }
+
+    public void setPaymentStatus(String paymentStatus) {
+        this.paymentStatus = paymentStatus;
+    }
 
     @Override
@@ -96,5 +173,5 @@
         return "Reservation{" +
                 "reservationID=" + reservationID +
-                ", customer=" + user +
+                ", customer=" + customer +
                 ", table=" + table +
                 ", restaurant=" + restaurant +
@@ -102,5 +179,5 @@
                 ", partySize=" + partySize +
                 ", specialRequests='" + specialRequests + '\'' +
-                ", status='" + reservationStatus + '\'' +
+                ", status='" + status + '\'' +
                 ", checkInTime=" + checkInTime +
                 ", checkOutTime=" + checkOutTime +
Index: src/main/java/com/example/rezevirajmasa/demo/model/Restaurant.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/model/Restaurant.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ src/main/java/com/example/rezevirajmasa/demo/model/Restaurant.java	(revision d24f17cb212e43f94a77a44d655ba10b4b8143d2)
@@ -12,4 +12,5 @@
 @Table(name = "restaurants")
 public class Restaurant {
+
     @Id
     @GeneratedValue(strategy = GenerationType.IDENTITY)
@@ -42,5 +43,5 @@
 
     @JsonManagedReference
-    @OneToMany(mappedBy = "restaurant", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
+    @OneToMany(mappedBy = "restaurant", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
     private List<TableEntity> tablesList;
 
@@ -146,9 +147,9 @@
         @Id
         @GeneratedValue(strategy = GenerationType.IDENTITY)
-        private Long reservationHistoryId;
+        private Long id;
 
         @ManyToOne
         @JoinColumn(name = "customer_id")
-        private User user;
+        private Customer customer;
 
         @ManyToOne
@@ -158,5 +159,5 @@
         @ManyToOne
         @JoinColumn(name = "restaurant_id")
-        private Restaurant restaurant;
+        private Restaurant restaurant; // Add this field
 
         @Column(name = "reservation_datetime")
@@ -170,14 +171,14 @@
 
         @Column(name = "status")
-        private String reservationStatus;
+        private String status; // Completed, Canceled, etc.
 
         @Column(name = "cancellation_reason")
         private String cancellationReason;
 
-        @Column(name = "check_in_date")
+        @Column(name = "check_in_date") // Add this field
         private LocalDateTime checkInDate;
 
-        public ReservationHistory(User user, TableEntity table, Restaurant restaurant, LocalDateTime reservationDateTime, int partySize, String specialRequests, String status, String cancellationReason, LocalDateTime checkInDate) {
-            this.user = user;
+        public ReservationHistory(Customer customer, TableEntity table, Restaurant restaurant, LocalDateTime reservationDateTime, int partySize, String specialRequests, String status, String cancellationReason, LocalDateTime checkInDate) {
+            this.customer = customer;
             this.table = table;
             this.restaurant = restaurant;
@@ -185,5 +186,5 @@
             this.partySize = partySize;
             this.specialRequests = specialRequests;
-            this.reservationStatus = status;
+            this.status = status;
             this.cancellationReason = cancellationReason;
             this.checkInDate = checkInDate;
@@ -194,17 +195,17 @@
 
         public Long getId() {
-            return reservationHistoryId;
+            return id;
         }
 
         public void setId(Long id) {
-            this.reservationHistoryId = id;
-        }
-
-        public User getUser() {
-            return user;
-        }
-
-        public void setUser(User user) {
-            this.user = user;
+            this.id = id;
+        }
+
+        public Customer getCustomer() {
+            return customer;
+        }
+
+        public void setCustomer(Customer customer) {
+            this.customer = customer;
         }
 
@@ -242,9 +243,9 @@
 
         public String getStatus() {
-            return reservationStatus;
+            return status;
         }
 
         public void setStatus(String status) {
-            this.reservationStatus = status;
+            this.status = status;
         }
 
@@ -276,6 +277,6 @@
         public String toString() {
             return "ReservationHistory{" +
-                    "id=" + reservationHistoryId +
-                    ", user=" + user +
+                    "id=" + id +
+                    ", customer=" + customer +
                     ", table=" + table +
                     ", restaurant=" + restaurant +
@@ -283,5 +284,5 @@
                     ", partySize=" + partySize +
                     ", specialRequests='" + specialRequests + '\'' +
-                    ", status='" + reservationStatus + '\'' +
+                    ", status='" + status + '\'' +
                     ", cancellationReason='" + cancellationReason + '\'' +
                     ", checkInDate=" + checkInDate +
Index: src/main/java/com/example/rezevirajmasa/demo/model/RestaurantMenu.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/model/RestaurantMenu.java	(revision d24f17cb212e43f94a77a44d655ba10b4b8143d2)
+++ src/main/java/com/example/rezevirajmasa/demo/model/RestaurantMenu.java	(revision d24f17cb212e43f94a77a44d655ba10b4b8143d2)
@@ -0,0 +1,40 @@
+package com.example.rezevirajmasa.demo.model;
+
+import jakarta.persistence.*;
+
+import java.io.Serializable;
+
+@Entity
+@Table(name = "restaurantMenus")
+public class RestaurantMenu {
+    @EmbeddedId
+    private RestaurantMenuId id;
+
+    @ManyToOne
+    @MapsId("restaurantID")
+    @JoinColumn(name = "RestaurantID", nullable = false)
+    private Restaurant restaurant;
+
+    @ManyToOne
+    @MapsId("menuID")
+    @JoinColumn(name = "MenuID", nullable = false)
+    private Menu menu;
+
+    public RestaurantMenu(Restaurant restaurant, Menu menu) {
+        this.restaurant = restaurant;
+        this.menu = menu;
+    }
+
+    public RestaurantMenu() {
+    }
+
+    @Embeddable
+    public static class RestaurantMenuId implements Serializable {
+
+        @Column(name = "RestaurantID")
+        private Long restaurantID;
+
+        @Column(name = "MenuID")
+        private Long menuID;
+    }
+}
Index: src/main/java/com/example/rezevirajmasa/demo/model/TableEntity.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/model/TableEntity.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ src/main/java/com/example/rezevirajmasa/demo/model/TableEntity.java	(revision d24f17cb212e43f94a77a44d655ba10b4b8143d2)
@@ -2,9 +2,5 @@
 
 import com.fasterxml.jackson.annotation.JsonBackReference;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonManagedReference;
 import jakarta.persistence.*;
-import lombok.Getter;
-import lombok.Setter;
 import org.springframework.web.bind.annotation.ModelAttribute;
 
@@ -19,6 +15,4 @@
 
 @Entity
-@Getter
-@Setter
 @Table(name = "tables")
 public class TableEntity {
@@ -29,5 +23,5 @@
 
     @JsonBackReference
-    @ManyToOne(fetch = FetchType.LAZY)
+    @ManyToOne(fetch = FetchType.EAGER)
     @JoinColumn(name = "RestaurantID")
     private Restaurant restaurant;
@@ -36,6 +30,6 @@
     private int capacity;
 
-    @Column(name = "tableLocation")
-    private String tableLocation;
+    @Column(name = "Location")
+    private String location;
 
     @Column(name = "IsSmokingArea")
@@ -45,57 +39,98 @@
     private String description;
 
+    @ElementCollection(fetch = FetchType.EAGER)
+    @CollectionTable(name = "table_time_slots", joinColumns = @JoinColumn(name = "table_id"))
+    @Column(name = "time_slot", columnDefinition = "timestamp without time zone")
+    @OrderBy("time_slot ASC")
+    private List<LocalDateTime> timeSlots = new ArrayList<>();
+
     @Column(name = "reservation_duration_hours", nullable = true)
     private int reservationDurationHours = 2;
-
-    @OneToMany(mappedBy = "table", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
-    @JsonIgnore
-    private List<Reservation> reservations = new ArrayList<>();
-
     public void cleanUnusedTimeSlots(LocalDate threeDaysAgo) {
-        reservations.removeIf(reservation -> reservation.getReservationDateTime().toLocalDate().isBefore(threeDaysAgo));
-    }
-
-    public boolean isAvailable(LocalDateTime desiredTimeSlot, int partySize) {
-        if (this.capacity < partySize) {
-            return false;
-        }
-
-        for (Reservation reservation : reservations) {
-            LocalDateTime startTime = reservation.getReservationDateTime();
-            LocalDateTime endTime = startTime.plusHours(reservation.getTable().getReservationDurationHours());
-
-            if ((desiredTimeSlot.isEqual(startTime) || desiredTimeSlot.isAfter(startTime))
+        // Iterate over the time slots and remove those that are in the past
+        timeSlots.removeIf(timeSlot -> timeSlot.isBefore(threeDaysAgo.atStartOfDay()));
+    }
+
+    public void addTimeSlot(LocalDateTime timeSlot) {
+        this.timeSlots.add(timeSlot);
+    }
+
+
+    @Transient
+    public boolean isAvailable(LocalDateTime desiredTimeSlot) {
+        if (timeSlots == null || timeSlots.isEmpty()) {
+            return true;
+        }
+
+        for (LocalDateTime reservedTimeSlot : timeSlots) {
+            LocalDateTime endTime = reservedTimeSlot.plusHours(reservationDurationHours);
+
+            // Check if the desired time slot overlaps with any existing reservation
+            if ((desiredTimeSlot.equals(reservedTimeSlot) || desiredTimeSlot.isAfter(reservedTimeSlot))
                     && desiredTimeSlot.isBefore(endTime)) {
-                return false;
+                return false; // Table is reserved for the desired time slot
             }
         }
 
-        return true;
-    }
-
-    public void addReservation(Reservation reservation) {
-        LocalDateTime startTime = reservation.getReservationDateTime();
-        LocalDateTime endTime = startTime.plusHours(reservation.getTable().getReservationDurationHours());
-        for (LocalDateTime timeSlot = startTime; timeSlot.isBefore(endTime); timeSlot = timeSlot.plusMinutes(15)) {
-
-        }
-        this.reservations.add(reservation);
-    }
-
-    public void removeReservation(Reservation reservation) {
-        LocalDateTime startTime = reservation.getReservationDateTime();
-        LocalDateTime endTime = startTime.plusHours(reservation.getTable().getReservationDurationHours());
-        for (LocalDateTime timeSlot = startTime; timeSlot.isBefore(endTime); timeSlot = timeSlot.plusMinutes(15)) {
-
-        }
-        this.reservations.remove(reservation);
-    }
-
-    public TableEntity(Restaurant restaurant, int capacity, String location, boolean isSmokingArea, String description, int reservationDurationHours) {
+        return true; // No conflicting reservations, table is available
+    }
+
+    public boolean hasTimeSlot(LocalDateTime dateTime) {
+        // Check if the given dateTime exists in the list of time slots
+        return timeSlots.contains(dateTime);
+    }
+
+    public List<LocalDateTime> initializeTimeSlots(LocalTime startTime, LocalTime endTime, List<LocalDate> dates, List<LocalDateTime> listOfUsedCheckIns) {
+        // Check if time slots are already initialized and cover all provided dates
+        List<LocalDate> generatedDates = timeSlots.stream()
+                .map(LocalDateTime::toLocalDate)
+                .distinct()
+                .toList();
+
+        if (generatedDates.containsAll(dates) && dates.containsAll(generatedDates)) {
+            System.out.println("Time slots already cover all provided dates.");
+            return timeSlots;
+        }
+
+        // Generate time slots for the remaining dates
+        for (LocalDate date : dates) {
+            if (!generatedDates.contains(date)) {
+                LocalTime currentTime = startTime;
+                while (currentTime.isBefore(LocalTime.of(23, 0))) {
+                    LocalDateTime currentDateTime = LocalDateTime.of(date, currentTime);
+                    boolean isUsed = false;
+                    if (listOfUsedCheckIns != null) {
+                        for (LocalDateTime checkIns : listOfUsedCheckIns) {
+                            if (checkIns.isEqual(currentDateTime)) {
+                                isUsed = true;
+                                break;
+                            }
+                        }
+                    }
+                    if (!isUsed) {
+                        timeSlots.add(currentDateTime);
+                        System.out.println("Added time slot: " + currentDateTime); // Debug output
+                    } else {
+                        // Remove conflicting time slots
+                        timeSlots.removeIf(x -> x.isAfter(currentDateTime.minusHours(2)) && x.isBefore(currentDateTime.plusHours(2)));
+                    }
+                    // Increment currentTime
+                    currentTime = currentTime.plusMinutes(15);
+                }
+            }
+        }
+
+        return timeSlots;
+    }
+
+
+
+    public TableEntity(Restaurant restaurant, int capacity, String location, boolean isSmokingArea, String description, List<LocalDateTime> timeSlots, int reservationDurationHours) {
         this.restaurant = restaurant;
         this.capacity = capacity;
-        this.tableLocation = location;
+        this.location = location;
         this.isSmokingArea = isSmokingArea;
         this.description = description;
+        this.timeSlots = timeSlots;
         this.reservationDurationHours = reservationDurationHours;
     }
@@ -103,3 +138,67 @@
     public TableEntity() {
     }
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Restaurant getRestaurant() {
+        return restaurant;
+    }
+
+    public void setRestaurant(Restaurant restaurant) {
+        this.restaurant = restaurant;
+    }
+
+    public int getCapacity() {
+        return capacity;
+    }
+
+    public void setCapacity(int capacity) {
+        this.capacity = capacity;
+    }
+
+    public String getLocation() {
+        return location;
+    }
+
+    public void setLocation(String location) {
+        this.location = location;
+    }
+
+    public void setSmokingArea(Boolean isSmokingArea) {
+        this.isSmokingArea = isSmokingArea;
+    }
+
+    public void setSmokingArea(boolean smokingArea) {
+        isSmokingArea = smokingArea;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public List<LocalDateTime> getTimeSlots() {
+        return timeSlots;
+    }
+
+    public void setTimeSlots(List<LocalDateTime> timeSlots) {
+        this.timeSlots = timeSlots;
+    }
+
+    public int getReservationDurationHours() {
+        return reservationDurationHours;
+    }
+
+    public void setReservationDurationHours(int reservationDurationHours) {
+        this.reservationDurationHours = reservationDurationHours;
+    }
 }
Index: src/main/java/com/example/rezevirajmasa/demo/model/User.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/model/User.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ 	(revision )
@@ -1,52 +1,0 @@
-package com.example.rezevirajmasa.demo.model;
-
-import com.fasterxml.jackson.annotation.JsonBackReference;
-import jakarta.persistence.*;
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import org.springframework.web.bind.annotation.GetMapping;
-
-import java.util.Date;
-
-@AllArgsConstructor
-@NoArgsConstructor
-@Builder
-@Data
-@Entity
-@Table(name = "app_user")
-public class User {
-
-    @Id
-    @GeneratedValue(strategy = GenerationType.IDENTITY)
-    private Long userId;
-
-    @Column(name = "first_name")
-    private String firstName;
-
-    @Column(name = "last_name")
-    private String lastName;
-
-    @Column(nullable = false)
-    private String email;
-
-    @Column(nullable = false)
-    private String password;
-
-    @Enumerated(EnumType.STRING)
-    private Role role;
-
-    @Column(name = "Phone", length = 20)
-    private String phone;
-
-    @Column(name = "Address", columnDefinition = "TEXT")
-    private String address;
-
-    @Enumerated(EnumType.STRING)
-    @Column(name = "MembershipLevel", length = 20)
-    private MembershipLevel membershipLevel;
-
-    @Column(name = "RegistrationDate", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
-    private Date registrationDate;
-}
Index: src/main/java/com/example/rezevirajmasa/demo/model/exceptions/AppException.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/model/exceptions/AppException.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ 	(revision )
@@ -1,15 +1,0 @@
-package com.example.rezevirajmasa.demo.model.exceptions;
-
-import org.springframework.http.HttpStatus;
-
-public class AppException extends RuntimeException{
-    private final HttpStatus code;
-    public AppException(String message, HttpStatus code) {
-        super(message);
-        this.code = code;
-    }
-
-    public HttpStatus getCode() {
-        return code;
-    }
-}
Index: src/main/java/com/example/rezevirajmasa/demo/model/exceptions/CustomerAuthenticationEntryPoint.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/model/exceptions/CustomerAuthenticationEntryPoint.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ 	(revision )
@@ -1,26 +1,0 @@
-package com.example.rezevirajmasa.demo.model.exceptions;
-
-import com.example.rezevirajmasa.demo.dto.ErrorDto;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import jakarta.servlet.ServletException;
-import jakarta.servlet.http.HttpServletRequest;
-import jakarta.servlet.http.HttpServletResponse;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.MediaType;
-import org.springframework.security.web.AuthenticationEntryPoint;
-import org.springframework.stereotype.Component;
-
-import java.io.IOException;
-
-@Component
-public class CustomerAuthenticationEntryPoint implements AuthenticationEntryPoint {
-    private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
-
-    @Override
-    public void commence(HttpServletRequest request, HttpServletResponse response, org.springframework.security.core.AuthenticationException authException) throws IOException, ServletException {
-        response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
-        response.setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
-        OBJECT_MAPPER.writeValue(response.getOutputStream(), new ErrorDto("Unauthorized path"));
-    }
-
-}
Index: src/main/java/com/example/rezevirajmasa/demo/repository/CustomerRepository.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/repository/CustomerRepository.java	(revision d24f17cb212e43f94a77a44d655ba10b4b8143d2)
+++ src/main/java/com/example/rezevirajmasa/demo/repository/CustomerRepository.java	(revision d24f17cb212e43f94a77a44d655ba10b4b8143d2)
@@ -0,0 +1,8 @@
+package com.example.rezevirajmasa.demo.repository;
+
+import com.example.rezevirajmasa.demo.model.Customer;
+import org.springframework.data.jpa.repository.JpaRepository;
+
+public interface CustomerRepository extends JpaRepository<Customer, Long> {
+    Customer findByEmail(String email);
+}
Index: src/main/java/com/example/rezevirajmasa/demo/repository/MenuRepository.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/repository/MenuRepository.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ 	(revision )
@@ -1,11 +1,0 @@
-package com.example.rezevirajmasa.demo.repository;
-
-import com.example.rezevirajmasa.demo.model.Menu;
-import com.example.rezevirajmasa.demo.model.Restaurant;
-import org.springframework.data.jpa.repository.JpaRepository;
-
-import java.util.List;
-
-public interface MenuRepository extends JpaRepository<Menu, Long> {
-    List<Menu> findAllByRestaurant(Restaurant restaurant);
-}
Index: src/main/java/com/example/rezevirajmasa/demo/repository/PriceHistoryRepository.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/repository/PriceHistoryRepository.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ 	(revision )
@@ -1,7 +1,0 @@
-package com.example.rezevirajmasa.demo.repository;
-
-import com.example.rezevirajmasa.demo.model.PriceHistory;
-import org.springframework.data.jpa.repository.JpaRepository;
-
-public interface PriceHistoryRepository extends JpaRepository<PriceHistory, Long> {
-}
Index: src/main/java/com/example/rezevirajmasa/demo/repository/ReservationHistoryRepository.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/repository/ReservationHistoryRepository.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ src/main/java/com/example/rezevirajmasa/demo/repository/ReservationHistoryRepository.java	(revision d24f17cb212e43f94a77a44d655ba10b4b8143d2)
@@ -1,6 +1,8 @@
 package com.example.rezevirajmasa.demo.repository;
 
+import com.example.rezevirajmasa.demo.model.Customer;
+import com.example.rezevirajmasa.demo.model.Reservation;
 import com.example.rezevirajmasa.demo.model.Restaurant;
-import com.example.rezevirajmasa.demo.model.User;
+import org.springframework.cglib.core.Local;
 import org.springframework.data.jpa.repository.JpaRepository;
 
@@ -9,5 +11,6 @@
 
 public interface ReservationHistoryRepository extends JpaRepository<Restaurant.ReservationHistory, Long> {
-    List<Restaurant.ReservationHistory> findALlByUser(User user);
+    List<Restaurant.ReservationHistory> findAllByCustomer(Customer customer);
+    List<Restaurant.ReservationHistory> findByCheckInDateBeforeAndStatus(LocalDateTime currentTime, String scheduled);
     List<Restaurant.ReservationHistory> findAllByCheckInDateBefore(LocalDateTime currentTime);
 }
Index: src/main/java/com/example/rezevirajmasa/demo/repository/ReservationRepository.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/repository/ReservationRepository.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ src/main/java/com/example/rezevirajmasa/demo/repository/ReservationRepository.java	(revision d24f17cb212e43f94a77a44d655ba10b4b8143d2)
@@ -1,5 +1,8 @@
 package com.example.rezevirajmasa.demo.repository;
 
-import com.example.rezevirajmasa.demo.model.*;
+import com.example.rezevirajmasa.demo.model.Customer;
+import com.example.rezevirajmasa.demo.model.Reservation;
+import com.example.rezevirajmasa.demo.model.Restaurant;
+import com.example.rezevirajmasa.demo.model.TableEntity;
 import org.springframework.data.jpa.repository.JpaRepository;
 
@@ -8,5 +11,5 @@
 
 public interface ReservationRepository extends JpaRepository<Reservation, Long> {
-    List<Reservation> findALlByUserAndCheckInTimeAfter(User user, LocalDateTime now);
+    List<Reservation> findAllByCustomer(Customer customer);
     List<Reservation> findByTableAndCheckInTimeBetween(TableEntity table, LocalDateTime startTime, LocalDateTime endTime);
 
@@ -14,11 +17,3 @@
     List<Reservation> findAllByCheckInTimeBefore(LocalDateTime currentTime);
     List<Reservation> findByCheckInTimeAfterAndCheckInTimeBefore(LocalDateTime startTime, LocalDateTime endTime);
-    List<Reservation> findALlByUserAndCheckInTimeBefore(User user, LocalDateTime now);
-    List<Reservation> findAllByUser(User user);
-
-    List<Reservation> findAllByUserAndCheckInTimeAfter(User user, LocalDateTime now);
-
-    List<Reservation> findAllByUserAndCheckInTimeBefore(User user, LocalDateTime now);
-    List<Reservation> findAllByTableAndCheckInTime(TableEntity table, LocalDateTime now);
-    List<Reservation> findAllByRestaurantAndCheckInTimeAfter(Restaurant restaurant, LocalDateTime now);
 }
Index: src/main/java/com/example/rezevirajmasa/demo/repository/RestaurantRepository.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/repository/RestaurantRepository.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ src/main/java/com/example/rezevirajmasa/demo/repository/RestaurantRepository.java	(revision d24f17cb212e43f94a77a44d655ba10b4b8143d2)
@@ -4,14 +4,7 @@
 import com.example.rezevirajmasa.demo.model.TableEntity;
 import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.repository.query.Param;
 
 import java.util.List;
 
 public interface RestaurantRepository extends JpaRepository<Restaurant, Long> {
-    List<Restaurant> findAllByNameLikeIgnoreCase(String search);
-    List<Restaurant> findAllByCuisineTypeContaining(String search);
-    @Query("SELECT DISTINCT r.cuisineType FROM Restaurant r")
-    List<String> findAllCuisineTypes();
-    List<Restaurant> findAllByCuisineType(String cuisine);
 }
Index: src/main/java/com/example/rezevirajmasa/demo/repository/TableRepository.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/repository/TableRepository.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ src/main/java/com/example/rezevirajmasa/demo/repository/TableRepository.java	(revision d24f17cb212e43f94a77a44d655ba10b4b8143d2)
@@ -7,14 +7,9 @@
 import org.springframework.data.repository.query.Param;
 
-import java.time.LocalDateTime;
 import java.util.List;
 
 public interface TableRepository extends JpaRepository<TableEntity, Long> {
     List<TableEntity> findByRestaurant(Restaurant restaurant);
-    List<TableEntity> findAllByCapacityGreaterThanEqual(int capacity);
-    @Query("SELECT t FROM TableEntity t WHERE t.capacity >= :capacity AND NOT EXISTS (" +
-            "SELECT r FROM t.reservations r WHERE r.checkInTime <= :checkOutTime AND r.checkOutTime >= :checkInTime)")
-    List<TableEntity> findAvailableTables(@Param("checkInTime") LocalDateTime checkInTime,
-                                          @Param("checkOutTime") LocalDateTime checkOutTime,
-                                          @Param("capacity") int capacity);
+//    @Query("SELECT t FROM TableEntity t JOIN FETCH t.restaurant WHERE t.id = :id")
+//    TableEntity findTableEntityByIdWithRestaurant(@Param("id") Long id);
 }
Index: src/main/java/com/example/rezevirajmasa/demo/repository/UserRepository.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/repository/UserRepository.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ 	(revision )
@@ -1,10 +1,0 @@
-package com.example.rezevirajmasa.demo.repository;
-
-import com.example.rezevirajmasa.demo.model.User;
-import org.springframework.data.jpa.repository.JpaRepository;
-
-import java.util.Optional;
-
-public interface UserRepository extends JpaRepository<User, Long> {
-    public Optional<User> findByEmail(String email);
-}
Index: src/main/java/com/example/rezevirajmasa/demo/service/CustomerService.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/service/CustomerService.java	(revision d24f17cb212e43f94a77a44d655ba10b4b8143d2)
+++ src/main/java/com/example/rezevirajmasa/demo/service/CustomerService.java	(revision d24f17cb212e43f94a77a44d655ba10b4b8143d2)
@@ -0,0 +1,21 @@
+package com.example.rezevirajmasa.demo.service;
+
+import ch.qos.logback.core.net.server.Client;
+import com.example.rezevirajmasa.demo.model.Customer;
+import com.example.rezevirajmasa.demo.model.MembershipLevel;
+import com.example.rezevirajmasa.demo.model.Reservation;
+import com.example.rezevirajmasa.demo.model.Role;
+
+import java.util.Date;
+import java.util.List;
+
+
+public interface CustomerService {
+    Customer registration(String firstName, String lastName, String email, String password, String phone, String address, MembershipLevel membershipLevel, Role role);
+    List<Customer> listAll();
+    Customer findByEmail(String email);
+    Customer findById(Long id);
+    Customer updateCustomer(Long id, String firstName, String lastName, String email, String password, String phone, String address, MembershipLevel membershipLevel);
+    Customer registration(Customer customer);
+    boolean deleteById(Long customerId);
+}
Index: src/main/java/com/example/rezevirajmasa/demo/service/MenuService.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/service/MenuService.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ 	(revision )
@@ -1,12 +1,0 @@
-package com.example.rezevirajmasa.demo.service;
-
-import com.example.rezevirajmasa.demo.model.Menu;
-
-import java.math.BigDecimal;
-import java.util.List;
-
-public interface MenuService {
-    public List<Menu> getMenuByRestaurantId(Long restaurantId);
-    public void updateMenuPrice(Long menuId, BigDecimal newPrice);
-    public Menu getMenuById(Long id);
-}
Index: src/main/java/com/example/rezevirajmasa/demo/service/ReservationHistoryService.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/service/ReservationHistoryService.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ src/main/java/com/example/rezevirajmasa/demo/service/ReservationHistoryService.java	(revision d24f17cb212e43f94a77a44d655ba10b4b8143d2)
@@ -1,7 +1,7 @@
 package com.example.rezevirajmasa.demo.service;
 
+import com.example.rezevirajmasa.demo.model.Customer;
 import com.example.rezevirajmasa.demo.model.Reservation;
 import com.example.rezevirajmasa.demo.model.Restaurant;
-import com.example.rezevirajmasa.demo.model.User;
 
 import java.time.LocalDateTime;
@@ -10,7 +10,6 @@
 public interface ReservationHistoryService {
     public void moveReservationToHistory(Reservation reservation, String status, String cancellationReason);
-//    public void moveReservationToCancelled(Reservation reservation, String status, String cancellationReason);
     public void moveReservationsToPast(List<Restaurant.ReservationHistory> reservationsToMove);
-    List<Restaurant.ReservationHistory> findByUser(User user);
+    List<Restaurant.ReservationHistory> findByCustomer(Customer customer);
     List<Restaurant.ReservationHistory> findAll();
     List<Restaurant.ReservationHistory> findReservationsToMove(LocalDateTime currentTime);
Index: src/main/java/com/example/rezevirajmasa/demo/service/ReservationSchedulerService.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/service/ReservationSchedulerService.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ 	(revision )
@@ -1,34 +1,0 @@
-package com.example.rezevirajmasa.demo.service;
-
-import com.example.rezevirajmasa.demo.model.Reservation;
-import com.example.rezevirajmasa.demo.repository.ReservationRepository;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Service;
-
-import java.time.LocalDateTime;
-import java.util.List;
-
-@Service
-public class ReservationSchedulerService {
-
-    private final ReservationRepository reservationRepository;
-    private final ReservationHistoryService reservationHistoryService;
-
-    public ReservationSchedulerService(
-            ReservationRepository reservationRepository,
-            ReservationHistoryService reservationHistoryService) {
-        this.reservationRepository = reservationRepository;
-        this.reservationHistoryService = reservationHistoryService;
-    }
-
-    @Scheduled(cron = "0 0 0 * * ?")
-    public void archivePastReservations() {
-        LocalDateTime now = LocalDateTime.now();
-        List<Reservation> pastReservations = reservationRepository.findAllByCheckInTimeBefore(now);
-
-        for (Reservation reservation : pastReservations) {
-            reservationHistoryService.moveReservationToHistory(reservation, "Past", null);
-            reservationRepository.delete(reservation);
-        }
-    }
-}
Index: src/main/java/com/example/rezevirajmasa/demo/service/ReservationService.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/service/ReservationService.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ src/main/java/com/example/rezevirajmasa/demo/service/ReservationService.java	(revision d24f17cb212e43f94a77a44d655ba10b4b8143d2)
@@ -1,9 +1,8 @@
 package com.example.rezevirajmasa.demo.service;
 
-import com.example.rezevirajmasa.demo.dto.ReservationDTO;
-import com.example.rezevirajmasa.demo.dto.RestaurantDTO;
-import com.example.rezevirajmasa.demo.model.*;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.security.core.userdetails.UserDetails;
+import com.example.rezevirajmasa.demo.model.Customer;
+import com.example.rezevirajmasa.demo.model.Reservation;
+import com.example.rezevirajmasa.demo.model.Restaurant;
+import com.example.rezevirajmasa.demo.model.TableEntity;
 
 import java.time.LocalDateTime;
@@ -11,19 +10,13 @@
 
 public interface ReservationService {
-    public Reservation makeReservationRest(ReservationDTO reservation, User user, Restaurant restaurant);
+    public void makeReservation(Customer customer, TableEntity table, Restaurant restaurant, LocalDateTime localDateTime, LocalDateTime checkInTime, int partySize, String specialRequests);
+    public Reservation makeReservationRest(Reservation reservation);
     public List<Reservation> listAll();
-    public Reservation updateReservation(Long reservationId, ReservationDTO reservationDTO, User user);
-    public List<Reservation> reservationsForTable(TableEntity table);
     public Reservation findById(Long id);
     public Reservation getReservationById(Long reservationId);
     public boolean cancelReservation(Long reservationId);
-    public List<Reservation> findReservationByUser(User user);
-    public List<Reservation> findAllByUser(User user);
-    public List<Reservation> findReservationsByUserPast(User user);
+    public List<Reservation> findReservationByCustomer(Customer customer);
     public List<Reservation> findReservationsByTableAndDateRange(TableEntity table, LocalDateTime startDateTime, LocalDateTime endDateTime);
-    @Scheduled(cron = "0 0 0 * * ?")
-    void findReservationsToMove();
+    List<Reservation> findReservationsToMove(LocalDateTime currentTime);
     void deleteReservation(Long reservationID);
-
-    List<Reservation> findAllByRestaurant(Restaurant restaurant);
 }
Index: src/main/java/com/example/rezevirajmasa/demo/service/RestaurantService.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/service/RestaurantService.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ src/main/java/com/example/rezevirajmasa/demo/service/RestaurantService.java	(revision d24f17cb212e43f94a77a44d655ba10b4b8143d2)
@@ -1,29 +1,20 @@
 package com.example.rezevirajmasa.demo.service;
 
-import com.example.rezevirajmasa.demo.dto.RestaurantDTO;
 import com.example.rezevirajmasa.demo.model.Restaurant;
-import com.example.rezevirajmasa.demo.model.TableEntity;
 
 import java.math.BigDecimal;
 import java.time.LocalDate;
-import java.time.LocalDateTime;
 import java.util.List;
 
 public interface RestaurantService {
-    List<RestaurantDTO> listall();
-    List<Restaurant> listAll();
-    //    void save(String name, String cuisineType, String address, String phone, String operatingHours, String website, String socialMediaLinks, BigDecimal rating, List<Long> tablesList);
+    List<Restaurant> listall();
+//    void save(String name, String cuisineType, String address, String phone, String operatingHours, String website, String socialMediaLinks, BigDecimal rating, List<Long> tablesList);
 //    void save(String name, String cuisineType, String address, String phone, String operatingHours, String website, String socialMediaLinks, BigDecimal rating, int numberOfTables, int tableCapacity, String location, Boolean isSmokingArea, String description);
     void save(Restaurant restaurant, int numberOfTables, List<Integer> tableCapacities, List<String> tableLocations, List<String> tableSmokingAreas, List<String> tableDescriptions);
     Restaurant updateRestaurant(Long restaurantId, String name, String cuisineType, String address, String phone, String operatingHours, String website, String socialMediaLinks, BigDecimal rating, List<Long> tablesList);
     Restaurant deleteRestaurant(Long restaurantId);
-    RestaurantDTO findById(Long restaurantId);
-    Restaurant findByIdRestaurant(Long restaurantId);
+
+    Restaurant findById(Long restaurantId);
     List<Restaurant> listRestaurantBy(String search);
     List<Restaurant> getRestaurantsWithAvailableTimeSlotsForToday();
-    public List<Restaurant> findRestaurantsByDateTimeAndPartySize(LocalDateTime dateTime, int partySize, String search);
-//    public List<Restaurant> findRestaurantsBySearchParams(LocalDateTime dateTime, int partySize, String search);
-    public List<String> findALlCuisineTypes();
-    List<RestaurantDTO> findRestaurantsByCuisineType(String param);
-    public List<RestaurantDTO> findRestaurantsBySearchParams(LocalDateTime dateTime, int partySize, String search);
 }
Index: src/main/java/com/example/rezevirajmasa/demo/service/TableService.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/service/TableService.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ src/main/java/com/example/rezevirajmasa/demo/service/TableService.java	(revision d24f17cb212e43f94a77a44d655ba10b4b8143d2)
@@ -1,5 +1,4 @@
 package com.example.rezevirajmasa.demo.service;
 
-import com.example.rezevirajmasa.demo.dto.TableDTO;
 import com.example.rezevirajmasa.demo.model.Restaurant;
 import com.example.rezevirajmasa.demo.model.TableEntity;
@@ -13,7 +12,6 @@
 public interface TableService {
     List<TableEntity> listall();
-    TableDTO findById(Long id);
-    TableEntity findByIdTable(Long id);
-    void save(int numberOfTables, List<Integer> tableCapacities, List<String> tableLocations, List<String> tableSmokingAreas, List<String> tableDescriptions, Restaurant restaurant);
+    TableEntity findById(Long id);
+//    void save(int numberOfTables, List<Integer> tableCapacities, List<String> tableLocations, List<String> tableSmokingAreas, List<String> tableDescriptions, Restaurant restaurant);
     void deleteTimeSlotsForReservation(Long tableId, LocalDateTime reservationTime);
     void canceledTimeSlots(Long tableId, LocalDateTime reservationTime);
Index: src/main/java/com/example/rezevirajmasa/demo/service/UserService.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/service/UserService.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ 	(revision )
@@ -1,16 +1,0 @@
-package com.example.rezevirajmasa.demo.service;
-
-import com.example.rezevirajmasa.demo.dto.CredentialsDto;
-import com.example.rezevirajmasa.demo.dto.SignUpDto;
-import com.example.rezevirajmasa.demo.dto.UserDto;
-import com.example.rezevirajmasa.demo.model.User;
-import lombok.RequiredArgsConstructor;
-
-
-public interface UserService {
-    public UserDto findByEmail(String email);
-    public User findByMail(String email);
-    public UserDto login(CredentialsDto credentialsDto);
-    public UserDto register(SignUpDto userDto);
-    public User findUserById(Long userId);
-}
Index: src/main/java/com/example/rezevirajmasa/demo/service/impl/CustomerServiceImpl.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/service/impl/CustomerServiceImpl.java	(revision d24f17cb212e43f94a77a44d655ba10b4b8143d2)
+++ src/main/java/com/example/rezevirajmasa/demo/service/impl/CustomerServiceImpl.java	(revision d24f17cb212e43f94a77a44d655ba10b4b8143d2)
@@ -0,0 +1,105 @@
+package com.example.rezevirajmasa.demo.service.impl;
+
+import com.example.rezevirajmasa.demo.model.Customer;
+import com.example.rezevirajmasa.demo.model.MembershipLevel;
+import com.example.rezevirajmasa.demo.model.Reservation;
+import com.example.rezevirajmasa.demo.model.Role;
+import com.example.rezevirajmasa.demo.model.exceptions.InvalidCustomerIdException;
+import com.example.rezevirajmasa.demo.repository.CustomerRepository;
+import com.example.rezevirajmasa.demo.service.CustomerService;
+import org.springframework.security.core.parameters.P;
+import org.springframework.security.core.userdetails.User;
+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;
+
+import javax.swing.text.html.Option;
+import java.time.Instant;
+import java.time.LocalDateTime;
+import java.util.*;
+
+@Service
+public class CustomerServiceImpl implements CustomerService, UserDetailsService {
+    private final CustomerRepository customerRepository;
+
+    private final PasswordEncoder passwordEncoder;
+    public CustomerServiceImpl(CustomerRepository customerRepository, PasswordEncoder passwordEncoder) {
+        this.customerRepository = customerRepository;
+        this.passwordEncoder = passwordEncoder;
+    }
+
+    @Override
+    public Customer registration(String firstName, String lastName, String email, String password, String phone, String address, MembershipLevel membershipLevel, Role role) {
+        Customer customer = new Customer();
+        customer.setFirstName(firstName);
+        customer.setLastName(lastName);
+        customer.setEmail(email);
+        customer.setPassword(passwordEncoder.encode(password));
+        customer.setAddress(address);
+        customer.setPhone(phone);
+        customer.setMembershipLevel(membershipLevel);
+        customer.setRole(role);
+        customer.setRegistrationDate(Date.from(Instant.now()));
+        return customerRepository.save(customer);
+    }
+
+    @Override
+    public List<Customer> listAll() {
+        return customerRepository.findAll();
+    }
+
+    @Override
+    public UserDetails loadUserByUsername(String email) throws UsernameNotFoundException {
+        Customer customer = customerRepository.findByEmail(email);
+        if (customer == null) {
+            throw new UsernameNotFoundException("User not found with email: " + email);
+        }
+        return new org.springframework.security.core.userdetails.User(
+                customer.getEmail(),
+                customer.getPassword(),
+                Collections.singletonList(customer.getRole())
+        );
+    }
+
+    @Override
+    public Customer updateCustomer(Long id, String firstName, String lastName, String email, String password, String phone, String address, MembershipLevel membershipLevel) {
+        Customer customer = findById(id);
+        customer.setFirstName(firstName);
+        customer.setLastName(lastName);
+        customer.setEmail(email);
+        customer.setPassword(passwordEncoder.encode(password));
+        customer.setPhone(phone);
+        customer.setMembershipLevel(membershipLevel);
+        customer.setAddress(address);
+        return customerRepository.save(customer);
+    }
+
+    @Override
+    public Customer findByEmail(String email) {
+        return customerRepository.findByEmail(email);
+    }
+
+    @Override
+    public Customer findById(Long id) {
+        return customerRepository.findById(id).orElseThrow(InvalidCustomerIdException::new);
+    }
+
+    @Override
+    public Customer registration(Customer customer) {
+        return customerRepository.save(customer);
+    }
+
+    @Override
+    public boolean deleteById(Long customerId) {
+        Optional<Customer> optionalCustomer = customerRepository.findById(customerId);
+        if(optionalCustomer.isPresent()) {
+            Customer customer = optionalCustomer.get();
+            customerRepository.delete(customer);
+            return true;
+        } else {
+            return false;
+        }
+    }
+}
Index: src/main/java/com/example/rezevirajmasa/demo/service/impl/MenuServiceImpl.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/service/impl/MenuServiceImpl.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ 	(revision )
@@ -1,55 +1,0 @@
-package com.example.rezevirajmasa.demo.service.impl;
-
-import com.example.rezevirajmasa.demo.model.Menu;
-import com.example.rezevirajmasa.demo.model.PriceHistory;
-import com.example.rezevirajmasa.demo.model.Restaurant;
-import com.example.rezevirajmasa.demo.repository.MenuRepository;
-import com.example.rezevirajmasa.demo.repository.PriceHistoryRepository;
-import com.example.rezevirajmasa.demo.service.MenuService;
-import com.example.rezevirajmasa.demo.service.RestaurantService;
-import org.openqa.selenium.InvalidArgumentException;
-import org.springframework.stereotype.Service;
-
-import java.math.BigDecimal;
-import java.time.LocalDateTime;
-import java.util.List;
-
-@Service
-public class MenuServiceImpl implements MenuService {
-    private final MenuRepository menuRepository;
-    private final RestaurantService restaurantService;
-
-    private final PriceHistoryRepository priceHistoryRepository;
-
-    public MenuServiceImpl(MenuRepository menuRepository, RestaurantService restaurantService, PriceHistoryRepository priceHistoryRepository) {
-        this.menuRepository = menuRepository;
-        this.restaurantService = restaurantService;
-        this.priceHistoryRepository = priceHistoryRepository;
-    }
-
-    @Override
-    public List<Menu> getMenuByRestaurantId(Long restaurantId) {
-        Restaurant restaurant = restaurantService.findByIdRestaurant(restaurantId);
-        return menuRepository.findAllByRestaurant(restaurant);
-    }
-
-    @Override
-    public void updateMenuPrice(Long menuId, BigDecimal newPrice) {
-        Menu menu = menuRepository.findById(menuId)
-                .orElseThrow(() -> new IllegalArgumentException("Menu not found"));
-
-        if (menu.getPrice() != null && !menu.getPrice().equals(newPrice)) {
-            PriceHistory priceHistory = new PriceHistory(menu, menu.getPrice(), LocalDateTime.now());
-            priceHistoryRepository.save(priceHistory);
-        }
-
-        menu.setPrice(newPrice);
-        menuRepository.save(menu);
-    }
-
-    @Override
-    public Menu getMenuById(Long id) {
-        return menuRepository.findById(id)
-                .orElseThrow(()->new InvalidArgumentException("Invalid id sent: " + id));
-    }
-}
Index: src/main/java/com/example/rezevirajmasa/demo/service/impl/ReservationHistoryServiceImpl.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/service/impl/ReservationHistoryServiceImpl.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ src/main/java/com/example/rezevirajmasa/demo/service/impl/ReservationHistoryServiceImpl.java	(revision d24f17cb212e43f94a77a44d655ba10b4b8143d2)
@@ -1,7 +1,7 @@
 package com.example.rezevirajmasa.demo.service.impl;
 
+import com.example.rezevirajmasa.demo.model.Customer;
 import com.example.rezevirajmasa.demo.model.Reservation;
 import com.example.rezevirajmasa.demo.model.Restaurant;
-import com.example.rezevirajmasa.demo.model.User;
 import com.example.rezevirajmasa.demo.repository.ReservationHistoryRepository;
 import com.example.rezevirajmasa.demo.service.ReservationHistoryService;
@@ -22,5 +22,5 @@
     public void moveReservationToHistory(Reservation reservation, String status, String cancellationReason) {
         Restaurant.ReservationHistory history = new Restaurant.ReservationHistory();
-        history.setUser(reservation.getUser());
+        history.setCustomer(reservation.getCustomer());
         history.setTable(reservation.getTable());
         history.setReservationDateTime(reservation.getReservationDateTime());
@@ -42,14 +42,16 @@
 
     @Override
-    public List<Restaurant.ReservationHistory> findByUser(User user) {
-        return reservationHistoryRepository.findALlByUser(user);
+    public List<Restaurant.ReservationHistory> findByCustomer(Customer customer) {
+        return reservationHistoryRepository.findAllByCustomer(customer);
     }
 
     @Override
     public void moveReservationsToPast(List<Restaurant.ReservationHistory> reservationsToMove) {
+        // Update the status of reservations to "Past"
         for (Restaurant.ReservationHistory reservation : reservationsToMove) {
             reservation.setStatus("Past");
         }
 
+        // Save the updated reservations
         reservationHistoryRepository.saveAll(reservationsToMove);
     }
Index: src/main/java/com/example/rezevirajmasa/demo/service/impl/ReservationImpl.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/service/impl/ReservationImpl.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ src/main/java/com/example/rezevirajmasa/demo/service/impl/ReservationImpl.java	(revision d24f17cb212e43f94a77a44d655ba10b4b8143d2)
@@ -1,22 +1,22 @@
 package com.example.rezevirajmasa.demo.service.impl;
 
-import com.example.rezevirajmasa.demo.dto.PreorderedItemDto;
-import com.example.rezevirajmasa.demo.dto.ReservationDTO;
-import com.example.rezevirajmasa.demo.mappers.UserMapper;
-import com.example.rezevirajmasa.demo.model.*;
+import com.example.rezevirajmasa.demo.model.Customer;
+import com.example.rezevirajmasa.demo.model.Reservation;
+import com.example.rezevirajmasa.demo.model.Restaurant;
+import com.example.rezevirajmasa.demo.model.TableEntity;
 import com.example.rezevirajmasa.demo.model.exceptions.InvalidReservationException;
 import com.example.rezevirajmasa.demo.model.exceptions.InvalidReservationIdException;
+import com.example.rezevirajmasa.demo.repository.CustomerRepository;
 import com.example.rezevirajmasa.demo.repository.ReservationRepository;
+import com.example.rezevirajmasa.demo.repository.RestaurantRepository;
 import com.example.rezevirajmasa.demo.repository.TableRepository;
-import com.example.rezevirajmasa.demo.service.MenuService;
-import com.example.rezevirajmasa.demo.service.ReservationHistoryService;
 import com.example.rezevirajmasa.demo.service.ReservationService;
-import com.example.rezevirajmasa.demo.service.UserService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 
+import javax.swing.text.html.Option;
 import java.time.LocalDateTime;
-import java.util.ArrayList;
+import java.time.LocalTime;
+import java.time.format.DateTimeFormatter;
 import java.util.List;
 import java.util.Optional;
@@ -24,21 +24,12 @@
 @Service
 public class ReservationImpl implements ReservationService {
-
     @Autowired
     private TableRepository tableRepository;
     @Autowired
-    private ReservationHistoryService reservationHistoryService;
-    private final UserMapper userMapper;
+    private RestaurantRepository restaurantRepository;
     @Autowired
-    private UserService userService;
+    private CustomerRepository customerRepository;
     @Autowired
     private ReservationRepository reservationRepository;
-    @Autowired
-    @Lazy
-    private MenuService menuService;
-
-    public ReservationImpl(UserMapper userMapper) {
-        this.userMapper = userMapper;
-    }
 
     @Override
@@ -48,98 +39,37 @@
 
     @Override
-    public Reservation makeReservationRest(ReservationDTO reservationDTO, User user, Restaurant restaurant) {
-        Reservation reservation = new Reservation();
+    public void makeReservation(Customer customer, TableEntity table, Restaurant restaurant, LocalDateTime localDateTime, LocalDateTime checkInTime, int partySize, String specialRequests) {
+        if (!table.isAvailable(checkInTime)) {
+            // Handle unavailability (throw an exception, return a specific response, etc.)
+            throw new RuntimeException("Table not available for the specified time slot");
+        }
 
-        Optional<TableEntity> optionalTable = tableRepository.findById(reservationDTO.getTableNumber());
+        Reservation reservation =
+                new Reservation(customer, table, restaurant, LocalDateTime.now(), partySize, specialRequests, "Reserved", checkInTime, checkInTime.plusHours(2), null);
 
-        if (optionalTable.isPresent()) {
+//        // Update table status or perform additional logic if needed
+//        tableRepository.save(table);
+
+        // Save the reservation
+        reservationRepository.save(reservation);
+    }
+
+    @Override
+    public Reservation makeReservationRest(Reservation reservation) {
+        Optional<TableEntity> optionalTable = tableRepository.findById(reservation.getTable().getId());
+        if(optionalTable.isPresent()) {
             TableEntity table = optionalTable.get();
 
-            LocalDateTime startTime = reservationDTO.getReservationDateTime().plusHours(1);
-            LocalDateTime endTime = reservationDTO.getReservationDateTime().plusHours(3);
+            LocalDateTime startTime = reservation.getCheckInTime().minusHours(2);
+            LocalDateTime endTime = reservation.getCheckInTime().plusHours(2);
 
-            boolean hasConflict = table.getReservations().stream()
-                    .anyMatch(existingReservation -> {
-                        LocalDateTime existingStartTime = existingReservation.getCheckInTime();
-                        LocalDateTime existingEndTime = existingReservation.getCheckOutTime();
-
-                        boolean scenario1 = existingStartTime.isBefore(startTime) && existingEndTime.isAfter(startTime);
-
-                        boolean scenario2 = existingStartTime.isBefore(endTime) && existingEndTime.isAfter(startTime);
-
-                        boolean scenario3 = existingStartTime.isAfter(startTime) && existingEndTime.isBefore(endTime);
-
-                        boolean scenario4 = existingStartTime.isBefore(startTime) && existingEndTime.isAfter(endTime);
-
-                        return scenario1 || scenario2 || scenario3 || scenario4;
-                    });
-            if (hasConflict) {
-                throw new InvalidReservationException("Unsuccessful reservation -> time slot not available");
-            }
-
-            reservation.setTable(table);
-            reservation.setReservationDateTime(LocalDateTime.now());
-            reservation.setSpecialRequests(reservationDTO.getSpecialRequests());
-            reservation.setPartySize(reservationDTO.getPartySize());
-            reservation.setReservationStatus(reservationDTO.getStatus() != null ? reservationDTO.getStatus() : "Pending");
-            reservation.setPaymentStatus(reservationDTO.getPaymentStatus() != null ? reservationDTO.getPaymentStatus() : "Unpaid");
-            reservation.setUser(user);
-
-            List<PreorderedItem> preOrderedItems = new ArrayList<>();
-
-            for (PreorderedItemDto dtoItem : reservationDTO.getPreOrderedItems()) {
-                PreorderedItem item = new PreorderedItem();
-                item.setPreorderedItemName(dtoItem.getPreorderedItemName());
-                item.setQuantity(dtoItem.getQuantity());
-                item.setPrice(dtoItem.getPrice());
-                item.setReservation(reservation);
-
-                Menu menu = menuService.getMenuById(dtoItem.getMenuID());
-                item.setMenu(menu);
-
-                preOrderedItems.add(item);
-            }
-
-            reservation.setPreOrderedItems(preOrderedItems);
-            reservation.setRestaurant(restaurant);
-            reservation.setCheckInTime(reservationDTO.getReservationDateTime().plusHours(1));
-            reservation.setReservationDateTime(LocalDateTime.now());
-            reservation.setCheckOutTime(reservationDTO.getReservationDateTime().plusHours(3));
+            table.getTimeSlots().removeIf(
+                    x -> x.isAfter(startTime) && x.isBefore(endTime)
+            );
 
             return reservationRepository.save(reservation);
         } else {
-            throw new InvalidReservationException("Invalid table number -> table not found");
+            throw new InvalidReservationException("Unsuccessful reservation -> time slot not avalaible");
         }
-    }
-
-    @Override
-    public Reservation updateReservation(Long reservationId, ReservationDTO reservationDTO, User user) {
-        Reservation existingReservation = findById(reservationId);
-
-        if (!existingReservation.getCheckInTime().equals(reservationDTO.getReservationDateTime())) {
-            TableEntity table = existingReservation.getTable();
-            table.removeReservation(existingReservation);
-
-            LocalDateTime newStartTime = reservationDTO.getReservationDateTime().minusHours(2);
-            LocalDateTime newEndTime = reservationDTO.getReservationDateTime().plusHours(2);
-            boolean hasConflict = table.getReservations().stream()
-                    .anyMatch(r -> r.getCheckInTime().isAfter(newStartTime) && r.getCheckInTime().isBefore(newEndTime));
-
-            if (hasConflict) {
-                throw new InvalidReservationException("New time slot is not available.");
-            }
-
-            table.addReservation(existingReservation);
-        }
-
-        existingReservation.setCheckInTime(reservationDTO.getReservationDateTime());
-        existingReservation.setCheckOutTime(reservationDTO.getReservationDateTime().plusHours(2));
-        existingReservation.setReservationDateTime(LocalDateTime.now());
-        existingReservation.setPartySize(reservationDTO.getPartySize());
-        existingReservation.setSpecialRequests(reservationDTO.getSpecialRequests());
-        existingReservation.setReservationStatus(reservationDTO.getStatus() != null ? reservationDTO.getStatus() : existingReservation.getReservationStatus());
-        existingReservation.setPaymentStatus(reservationDTO.getPaymentStatus() != null ? reservationDTO.getPaymentStatus() : existingReservation.getPaymentStatus());
-
-        return reservationRepository.save(existingReservation);
     }
 
@@ -147,9 +77,4 @@
     public List<Reservation> listAll() {
         return reservationRepository.findAll();
-    }
-
-    @Override
-    public List<Reservation> reservationsForTable(TableEntity table) {
-        return reservationRepository.findAllByTableAndCheckInTime(table, LocalDateTime.now());
     }
 
@@ -166,30 +91,33 @@
             TableEntity table = reservation.getTable();
 
-            table.removeReservation(reservation);
+            LocalDateTime from = reservation.getCheckInTime().minusHours(2);
+            LocalDateTime till = reservation.getCheckInTime().plusHours(2);
 
-            reservationHistoryService.moveReservationToHistory(reservation, "Canceled", "Canceled by user");
+            String[] hours = table.getRestaurant().getOperatingHours().split("-");
+            LocalTime openingHourTime = LocalTime.parse(hours[0], DateTimeFormatter.ofPattern("HH:mm"));
+            LocalDateTime openingDateTime = openingHourTime.atDate(from.toLocalDate());
+            LocalTime closingHourTime = LocalTime.of(22,45);
+            LocalDateTime closingDateTime = closingHourTime.atDate(till.toLocalDate());
+            if(from.isBefore(openingDateTime)) {
+                from = openingDateTime;
+            }
+            if(till.isAfter(closingDateTime)) {
+                till = closingDateTime;
+            }
+            while (from.isBefore(reservation.getCheckInTime().plusHours(2))) {
+                table.addTimeSlot(from);
+                from = from.plusMinutes(15);
+            }
             reservationRepository.delete(reservation);
-
-            return true;
+            return true; // Return true indicating successful cancellation
         } else {
-            return false;
+            return false; // Return false indicating reservation with the given ID not found
         }
     }
 
-    @Override
-    public List<Reservation> findReservationByUser(User user) {
-        LocalDateTime now = LocalDateTime.now();
-        return reservationRepository.findAllByUserAndCheckInTimeAfter(user, now);
-    }
 
     @Override
-    public List<Reservation> findAllByUser(User user) {
-        return reservationRepository.findAllByUser(user);
-    }
-
-    @Override
-    public List<Reservation> findReservationsByUserPast(User user) {
-        LocalDateTime now = LocalDateTime.now();
-        return reservationRepository.findAllByUserAndCheckInTimeBefore(user, now);
+    public List<Reservation> findReservationByCustomer(Customer customer) {
+        return reservationRepository.findAllByCustomer(customer);
     }
 
@@ -200,10 +128,6 @@
 
     @Override
-    public void findReservationsToMove() {
-        List<Reservation> pastReservations = reservationRepository.findAllByCheckInTimeBefore(LocalDateTime.now());
-        for(Reservation reservation : pastReservations) {
-            reservationHistoryService.moveReservationToHistory(reservation, "successful", "/");
-            reservationRepository.delete(reservation);
-        }
+    public List<Reservation> findReservationsToMove(LocalDateTime currentTime) {
+        return reservationRepository.findAllByCheckInTimeBefore(currentTime);
     }
 
@@ -213,8 +137,3 @@
         reservationRepository.delete(reservation);
     }
-
-    @Override
-    public List<Reservation> findAllByRestaurant(Restaurant restaurant) {
-        return reservationRepository.findAllByRestaurantAndCheckInTimeAfter(restaurant, LocalDateTime.now());
-    }
 }
Index: src/main/java/com/example/rezevirajmasa/demo/service/impl/RestaurantServiceImpl.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/service/impl/RestaurantServiceImpl.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ src/main/java/com/example/rezevirajmasa/demo/service/impl/RestaurantServiceImpl.java	(revision d24f17cb212e43f94a77a44d655ba10b4b8143d2)
@@ -1,22 +1,15 @@
 package com.example.rezevirajmasa.demo.service.impl;
 
-import com.example.rezevirajmasa.demo.dto.ReservationDTO;
-import com.example.rezevirajmasa.demo.dto.RestaurantDTO;
-import com.example.rezevirajmasa.demo.dto.TableDTO;
-import com.example.rezevirajmasa.demo.model.Reservation;
 import com.example.rezevirajmasa.demo.model.Restaurant;
 import com.example.rezevirajmasa.demo.model.TableEntity;
-import com.example.rezevirajmasa.demo.model.User;
 import com.example.rezevirajmasa.demo.model.exceptions.InvalidRestaurantIdException;
 import com.example.rezevirajmasa.demo.repository.RestaurantRepository;
 import com.example.rezevirajmasa.demo.repository.TableRepository;
-import com.example.rezevirajmasa.demo.service.ReservationService;
 import com.example.rezevirajmasa.demo.service.RestaurantService;
 import com.example.rezevirajmasa.demo.service.TableService;
 import com.sun.tools.jconsole.JConsoleContext;
 import jakarta.transaction.Transactional;
-import org.openqa.selenium.InvalidArgumentException;
 import org.springframework.stereotype.Service;
-import org.modelmapper.ModelMapper;
+
 import java.time.LocalDate;
 import java.time.LocalDateTime;
@@ -38,42 +31,13 @@
     private final TableRepository tableRepository;
     private final TableService tableService;
-    private final ReservationService reservationService;
-    private ModelMapper modelMapper = new ModelMapper();
 
-    public RestaurantServiceImpl(RestaurantRepository restaurantRepository, TableRepository tableRepository, TableService tableService, ReservationService reservationService) {
+    public RestaurantServiceImpl(RestaurantRepository restaurantRepository, TableRepository tableRepository, TableService tableService) {
         this.restaurantRepository = restaurantRepository;
         this.tableRepository = tableRepository;
         this.tableService = tableService;
-        this.reservationService = reservationService;
     }
 
     @Override
-    public List<RestaurantDTO> listall() {
-        List<Restaurant> restaurants = restaurantRepository.findAll();
-
-        List<RestaurantDTO> restaurantDTOS = new ArrayList<>();
-
-        for (Restaurant restaurant : restaurants) {
-            RestaurantDTO restaurantDTO = modelMapper.map(restaurant, RestaurantDTO.class);
-            List<TableDTO> tableDTOS = new ArrayList<>();
-            for (TableEntity table : restaurant.getTablesList()) {
-                TableDTO tableDTO = modelMapper.map(table, TableDTO.class);
-                List<ReservationDTO> reservationDTOS = new ArrayList<>();
-                for (Reservation reservation : table.getReservations()) {
-                    ReservationDTO reservationDTO = modelMapper.map(reservation, ReservationDTO.class);
-
-                    reservationDTOS.add(reservationDTO);
-                }
-                tableDTO.setReservations(reservationDTOS);
-                tableDTOS.add(tableDTO);
-            }
-            restaurantDTO.setTablesList(tableDTOS);
-            restaurantDTOS.add(restaurantDTO);
-        }
-        return restaurantDTOS;
-    }
-
-    @Override
-    public List<Restaurant> listAll() {
+    public List<Restaurant> listall() {
         return restaurantRepository.findAll();
     }
@@ -87,8 +51,4 @@
     @Override
     public void save(Restaurant restaurant, int numberOfTables, List<Integer> tableCapacities, List<String> tableLocations, List<String> tableSmokingAreas, List<String> tableDescriptions) {
-        if (numberOfTables != tableCapacities.size() || numberOfTables != tableLocations.size() || numberOfTables != tableSmokingAreas.size() || numberOfTables != tableDescriptions.size()) {
-            throw new IllegalArgumentException("Mismatched table data. Number of tables does not match the size of the input lists.");
-        }
-
         restaurantRepository.save(restaurant);
         String[] hours = restaurant.getOperatingHours().split("-");
@@ -100,12 +60,19 @@
             LocalTime startTime = LocalTime.parse(hours[0], DateTimeFormatter.ofPattern("HH:mm"));
             LocalTime endTime = LocalTime.parse(hours[1], DateTimeFormatter.ofPattern("HH:mm"));
+            System.out.println("IsBefore: " + startTime.isBefore(endTime) + " and equals: " + startTime.equals(endTime));
 
             for (int i = 0; i < numberOfTables; i++) {
                 TableEntity table = new TableEntity();
+
+//                table.initializeTimeSlots(startTime, endTime);
+
                 table.setCapacity(tableCapacities.get(i));
-                table.setTableLocation(tableLocations.get(i));
-                table.setSmokingArea(tableSmokingAreas.get(i).equalsIgnoreCase("on"));
+                table.setLocation(tableLocations.get(i));
+
+                String smokingAreaString = tableSmokingAreas.get(i);
+                table.setSmokingArea(smokingAreaString.equalsIgnoreCase("on"));
                 table.setDescription(tableDescriptions.get(i));
                 table.setRestaurant(restaurant);
+
                 tableRepository.save(table);
             }
@@ -117,34 +84,7 @@
     }
     @Override
-    public RestaurantDTO findById(Long restaurantId) {
-        Restaurant restaurant = restaurantRepository.findById(restaurantId)
-                .orElseThrow(InvalidRestaurantIdException::new);
-
-        RestaurantDTO restaurantDTO = modelMapper.map(restaurant, RestaurantDTO.class);
-
-        List<TableDTO> tableDTOS = new ArrayList<>();
-        for (TableEntity table : restaurant.getTablesList()) {
-            TableDTO tableDTO = modelMapper.map(table, TableDTO.class);
-
-            List<ReservationDTO> reservationDTOS = new ArrayList<>();
-            for (Reservation reservation : table.getReservations()) {
-                ReservationDTO reservationDTO = modelMapper.map(reservation, ReservationDTO.class);
-                reservationDTOS.add(reservationDTO);
-            }
-
-            tableDTO.setReservations(reservationDTOS);
-            tableDTOS.add(tableDTO);
-        }
-
-        restaurantDTO.setTablesList(tableDTOS);
-
-        return restaurantDTO;
+    public Restaurant findById(Long restaurantId) {
+        return restaurantRepository.findById(restaurantId).orElseThrow(InvalidRestaurantIdException::new);
     }
-
-    @Override
-    public Restaurant findByIdRestaurant(Long restaurantId) {
-        return restaurantRepository.findById(restaurantId).orElseThrow(()-> new InvalidArgumentException("No restaurant with provided id"));
-    }
-
 
     @Override
@@ -175,4 +115,5 @@
     @Override
     public List<Restaurant> listRestaurantBy(String search) {
+        // Get all restaurants from the repository
         List<Restaurant> allRestaurants = restaurantRepository.findAll();
 
@@ -193,4 +134,5 @@
 
         for (Restaurant restaurant : restaurants) {
+            // Check if the restaurant has available time slots for today
             boolean hasAvailableTimeSlots = tableService.hasAvailableTimeSlotsForRestaurantAndDate(restaurant, today);
             if (hasAvailableTimeSlots) {
@@ -201,72 +143,3 @@
         return restaurantsWithAvailableTimeSlots;
     }
-
-    @Override
-    public List<Restaurant> findRestaurantsByDateTimeAndPartySize(LocalDateTime dateTime, int partySize, String search) {
-        LocalDateTime checkOutTime = dateTime.plusHours(2);
-        List<Restaurant> allRestaurants = restaurantRepository.findAll();
-
-        return allRestaurants.stream()
-                .filter(restaurant -> restaurant.getTablesList().stream()
-                        .anyMatch(table -> tableRepository.findAvailableTables(dateTime, checkOutTime, partySize)
-                                .contains(table)))
-                .filter(restaurant -> isMatch(restaurant, search))
-                .collect(Collectors.toList());
-    }
-
-    private boolean isMatch(Restaurant restaurant, String name) {
-        return name == null || name.isEmpty() || restaurant.getName().contains(name);
-    }
-
-    @Override
-    public List<RestaurantDTO> findRestaurantsBySearchParams(LocalDateTime dateTime, int partySize, String search) {
-        List<Restaurant> availableRestaurants = new ArrayList<>();
-
-        List<Restaurant> restaurantList;
-        if (search == null || search.isEmpty()) {
-            restaurantList = restaurantRepository.findAll();
-        } else {
-            String searchTerm = "%" + search + "%";
-            restaurantList = restaurantRepository.findAllByNameLikeIgnoreCase(searchTerm);
-
-            if (restaurantList.isEmpty()) {
-                restaurantList = restaurantRepository.findAllByCuisineTypeContaining(search);
-            }
-        }
-
-        for (Restaurant restaurant : restaurantList) {
-            boolean hasAvailableTable = restaurant.getTablesList().stream()
-                    .anyMatch(table -> table.isAvailable(dateTime, partySize));
-
-            if (hasAvailableTable) {
-                availableRestaurants.add(restaurant);
-            }
-        }
-
-        List<RestaurantDTO> restaurantDTOS = availableRestaurants.stream().map(this::convertToDto).toList();
-        return restaurantDTOS;
-    }
-
-    @Override
-    public List<String> findALlCuisineTypes() {
-        return restaurantRepository.findAllCuisineTypes();
-    }
-
-    @Override
-    public List<RestaurantDTO> findRestaurantsByCuisineType(String param) {
-        List<Restaurant> restaurants = restaurantRepository.findAllByCuisineType(param);
-        return restaurants.stream().map(this::convertToDto).toList();
-    }
-
-    public RestaurantDTO convertToDto(Restaurant restaurant) {
-        return modelMapper.map(restaurant, RestaurantDTO.class);
-    }
-
-    public TableDTO convertToDto(TableEntity table) {
-        return modelMapper.map(table, TableDTO.class);
-    }
-
-    public ReservationDTO convertToDto(Reservation reservation) {
-        return modelMapper.map(reservation, ReservationDTO.class);
-    }
 }
Index: src/main/java/com/example/rezevirajmasa/demo/service/impl/TableServiceImpl.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/service/impl/TableServiceImpl.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ src/main/java/com/example/rezevirajmasa/demo/service/impl/TableServiceImpl.java	(revision d24f17cb212e43f94a77a44d655ba10b4b8143d2)
@@ -1,18 +1,11 @@
 package com.example.rezevirajmasa.demo.service.impl;
 
-import com.example.rezevirajmasa.demo.dto.ReservationDTO;
-import com.example.rezevirajmasa.demo.dto.RestaurantDTO;
-import com.example.rezevirajmasa.demo.dto.TableDTO;
-import com.example.rezevirajmasa.demo.model.Reservation;
 import com.example.rezevirajmasa.demo.model.Restaurant;
 import com.example.rezevirajmasa.demo.model.TableEntity;
+import com.example.rezevirajmasa.demo.model.exceptions.InvalidRestaurantIdException;
 import com.example.rezevirajmasa.demo.model.exceptions.InvalidTableNumberException;
-import com.example.rezevirajmasa.demo.repository.ReservationRepository;
 import com.example.rezevirajmasa.demo.repository.RestaurantRepository;
 import com.example.rezevirajmasa.demo.repository.TableRepository;
 import com.example.rezevirajmasa.demo.service.TableService;
-import jakarta.persistence.Table;
-import org.modelmapper.ModelMapper;
-import org.openqa.selenium.InvalidArgumentException;
 import org.springframework.cglib.core.Local;
 import org.springframework.stereotype.Service;
@@ -25,5 +18,4 @@
 import java.time.chrono.ChronoLocalDateTime;
 import java.time.format.DateTimeFormatter;
-import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
@@ -33,11 +25,13 @@
     private final TableRepository tableRepository;
     private final RestaurantRepository restaurantRepository;
-    private final ReservationRepository reservationRepository;
-    private ModelMapper modelMapper = new ModelMapper();
 
-    public TableServiceImpl(TableRepository tableRepository, RestaurantRepository restaurantRepository, ReservationRepository reservationRepository) {
+    public TableServiceImpl(TableRepository tableRepository, RestaurantRepository restaurantRepository) {
         this.tableRepository = tableRepository;
         this.restaurantRepository = restaurantRepository;
-        this.reservationRepository = reservationRepository;
+    }
+
+    @Override
+    public TableEntity findById(Long id) {
+        return tableRepository.findById(id).orElseThrow(InvalidTableNumberException::new);
     }
 
@@ -47,34 +41,9 @@
     }
 
-    @Override
-    public TableDTO findById(Long id) {
-        TableEntity table = tableRepository.findById(id)
-                .orElseThrow(InvalidTableNumberException::new);
-
-        TableDTO tableDTO = modelMapper.map(table, TableDTO.class);
-
-        List<ReservationDTO> reservationDTOS = new ArrayList<>();
-        for (Reservation reservation : table.getReservations()) {
-            ReservationDTO reservationDTO = modelMapper.map(reservation, ReservationDTO.class);
-            reservationDTOS.add(reservationDTO);
-        }
-
-        tableDTO.setReservations(reservationDTOS);
-
-        return tableDTO;
-    }
-
-    @Override
-    public TableEntity findByIdTable(Long id) {
-        return tableRepository.findById(id).orElseThrow(() -> new InvalidArgumentException("Invalid table id"));
-    }
-
-
-    @Override
     public void save(int numberOfTables, List<Integer> tableCapacities, List<String> tableLocations, List<String> tableSmokingAreas, List<String> tableDescriptions, Restaurant restaurant) {
         for (int i = 0; i < numberOfTables; i++) {
             TableEntity table = new TableEntity();
             table.setCapacity(tableCapacities.get(i));
-            table.setTableLocation(tableLocations.get(i));
+            table.setLocation(tableLocations.get(i));
             table.setSmokingArea(Boolean.valueOf(tableSmokingAreas.get(i)));
             table.setDescription(tableDescriptions.get(i));
@@ -86,8 +55,13 @@
     @Override
     public void deleteTimeSlotsForReservation(Long tableId, LocalDateTime reservationTime) {
-        TableDTO tableDTO = findById(tableId);
-        TableEntity table = convertFromDTO(tableDTO);
-        LocalDate threeDaysAgo = LocalDate.now().minusDays(3);
-        table.cleanUnusedTimeSlots(threeDaysAgo);
+        LocalDateTime startTime = reservationTime.minusHours(2);
+        LocalDateTime endTime = reservationTime.plusHours(2);
+
+        TableEntity table = findById(tableId);
+        List<LocalDateTime> timeSlots = table.getTimeSlots();
+
+        timeSlots.removeIf(timeSlot -> timeSlot.isAfter(startTime) && timeSlot.isBefore(endTime));
+
+        table.setTimeSlots(timeSlots);
 
         tableRepository.saveAndFlush(table);
@@ -96,31 +70,27 @@
     @Override
     public void canceledTimeSlots(Long tableId, LocalDateTime reservationTime) {
-        TableDTO tableDTO = findById(tableId);
-        TableEntity table = convertFromDTO(tableDTO);
+        TableEntity table = findById(tableId);
+        List<LocalDateTime> timeSlots = table.getTimeSlots();
         LocalDateTime startTime = reservationTime.minusHours(1).minusMinutes(45);
         LocalDateTime endTime = reservationTime.plusHours(1).plusMinutes(45);
 
+        LocalDate localDate = reservationTime.toLocalDate();
+
         String[] hours = table.getRestaurant().getOperatingHours().split("-");
         LocalTime openingHourTime = LocalTime.parse(hours[0], DateTimeFormatter.ofPattern("HH:mm"));
-        LocalDateTime openingHour = openingHourTime.atDate(reservationTime.toLocalDate());
-        LocalDateTime closingHour = LocalTime.of(23, 45).atDate(reservationTime.toLocalDate());
 
-        if (startTime.isBefore(openingHour)) {
-            startTime = openingHour;
+        LocalDateTime openingHour = openingHourTime.atDate(localDate);
+        LocalDateTime closingHour = LocalTime.of(23, 45).atDate(localDate);
+        if(startTime.isBefore(openingHour)) {
+            startTime = LocalDateTime.from(openingHour);
         }
-
-        while (startTime.isBefore(endTime) || startTime.equals(endTime)) {
-            if (startTime.isAfter(closingHour) || startTime.equals(closingHour)) {
+        while(startTime.isBefore(endTime) || startTime.equals(endTime)) {
+            timeSlots.add(startTime);
+            startTime = startTime.plusMinutes(15);
+            if(startTime.isAfter(closingHour) || startTime.equals(closingHour)) {
                 break;
             }
-
-            Reservation reservation = new Reservation();
-            reservation.setReservationDateTime(startTime);
-            reservation.setTable(table);
-            reservationRepository.save(reservation);
-
-            startTime = startTime.plusMinutes(15);
         }
-
+        table.setTimeSlots(timeSlots);
         tableRepository.saveAndFlush(table);
     }
@@ -135,5 +105,4 @@
         return tableRepository.findById(number).orElseThrow(InvalidTableNumberException::new);
     }
-
     @Override
     public TableEntity deleteTable(Long number) {
@@ -147,8 +116,9 @@
         List<TableEntity> tables = tableRepository.findByRestaurant(restaurant);
 
+        // Iterate through each table to check for available time slots
         for (TableEntity table : tables) {
             boolean hasAvailableTimeSlots = hasAvailableTimeSlotsForTableAndDate(table, today);
             if (hasAvailableTimeSlots) {
-                return true;
+                return true; // If any table has available time slots, return true
             }
         }
@@ -158,29 +128,13 @@
 
     public boolean hasAvailableTimeSlotsForTableAndDate(TableEntity table, LocalDate date) {
-        for (Reservation reservation : table.getReservations()) {
-            LocalDateTime startTime = reservation.getReservationDateTime();
-            LocalDateTime endTime = startTime.plusHours(reservation.getTable().getReservationDurationHours());
+        List<LocalDateTime> timeSlots = table.getTimeSlots();
 
-            if (startTime.toLocalDate().equals(date) || endTime.toLocalDate().equals(date)) {
-                return false;
-            }
-        }
-        return true;
+        // Implement your logic to check if the table has available time slots for the given date
+        // This could involve querying the database for reservations for the given table and date,
+        // and checking if there are any open time slots.
+        // You may need to consider factors such as operating hours, existing reservations, etc.
+        // Return true if there are available time slots, false otherwise.
+        return false;
     }
 
-    public RestaurantDTO convertToDto(Restaurant restaurant) {
-        return modelMapper.map(restaurant, RestaurantDTO.class);
-    }
-
-    public TableDTO convertToDto(TableEntity table) {
-        return modelMapper.map(table, TableDTO.class);
-    }
-
-    public ReservationDTO convertToDto(Reservation reservation) {
-        return modelMapper.map(reservation, ReservationDTO.class);
-    }
-
-    public TableEntity convertFromDTO(TableDTO tableDTO) {
-        return modelMapper.map(tableDTO, TableEntity.class);
-    }
 }
Index: src/main/java/com/example/rezevirajmasa/demo/service/impl/TokenService.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/service/impl/TokenService.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ 	(revision )
@@ -1,34 +1,0 @@
-package com.example.rezevirajmasa.demo.service.impl;
-
-import com.example.rezevirajmasa.demo.config.security.SecurityConstants;
-import io.jsonwebtoken.Claims;
-import io.jsonwebtoken.ExpiredJwtException;
-import io.jsonwebtoken.Jwts;
-import io.jsonwebtoken.SignatureException;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Service;
-
-@Service
-public class TokenService {
-
-    public String getUserIdFromToken(String token) {
-        try {
-            String jwtToken = token.substring(7);
-
-            Claims claims = Jwts.parser()
-                    .setSigningKey(SecurityConstants.SECRET)
-                    .parseClaimsJws(jwtToken)
-                    .getBody();
-
-            return claims.getSubject();  // Assumes 'sub' claim contains user ID
-        } catch (ExpiredJwtException e) {
-            throw new RuntimeException("Token has expired", e);
-        } catch (SignatureException e) {
-            throw new RuntimeException("Invalid token signature", e);
-        } catch (IllegalArgumentException e) {
-            throw new RuntimeException("Invalid token format", e);
-        } catch (Exception e) {
-            throw new RuntimeException("Could not extract user ID from token", e);
-        }
-    }
-}
Index: src/main/java/com/example/rezevirajmasa/demo/service/impl/UserServiceImpl.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/service/impl/UserServiceImpl.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ 	(revision )
@@ -1,94 +1,0 @@
-package com.example.rezevirajmasa.demo.service.impl;
-
-import com.example.rezevirajmasa.demo.dto.CredentialsDto;
-import com.example.rezevirajmasa.demo.dto.SignUpDto;
-import com.example.rezevirajmasa.demo.dto.UserDto;
-import com.example.rezevirajmasa.demo.mappers.UserMapper;
-import com.example.rezevirajmasa.demo.mappers.UserMapperImpl;
-import com.example.rezevirajmasa.demo.model.MembershipLevel;
-import com.example.rezevirajmasa.demo.model.Role;
-import com.example.rezevirajmasa.demo.model.User;
-import com.example.rezevirajmasa.demo.model.exceptions.AppException;
-import com.example.rezevirajmasa.demo.repository.UserRepository;
-import com.example.rezevirajmasa.demo.service.UserService;
-import lombok.RequiredArgsConstructor;
-import org.mapstruct.control.MappingControl;
-import org.openqa.selenium.InvalidArgumentException;
-import org.springframework.http.HttpStatus;
-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;
-import java.nio.CharBuffer;
-import java.sql.Date;
-import java.time.LocalDate;
-import java.util.Optional;
-
-@RequiredArgsConstructor
-@Service
-public class UserServiceImpl implements UserService, UserDetailsService {
-    private final UserRepository userRepository;
-    private final UserMapperImpl userMapper;
-    private final PasswordEncoder passwordEncoder;
-    @Override
-    public UserDto findByEmail(String email) {
-        User user = userRepository.findByEmail(email).orElseThrow(() -> new AppException(("Unknown user"), HttpStatus.NOT_FOUND));
-        return userMapper.toUserDto(user);
-    }
-
-    @Override
-    public User findByMail(String email) {
-        return userRepository.findByEmail(email).orElseThrow(() -> new AppException(("Unknown user"), HttpStatus.NOT_FOUND));
-    }
-
-    public UserDto login(CredentialsDto credentialsDto) {
-        User user = userRepository.findByEmail(credentialsDto.getEmail())
-                .orElseThrow(() -> new AppException("Unknown user", HttpStatus.NOT_FOUND));
-
-        if(passwordEncoder.matches(CharBuffer.wrap(credentialsDto.getPassword()), user.getPassword())) {
-            return userMapper.toUserDto(user);
-        }
-
-        throw new AppException("Invalid password", HttpStatus.BAD_REQUEST);
-    }
-
-    public UserDto register(SignUpDto userDto) {
-        Optional<User> optionalUser = userRepository.findByEmail(userDto.getEmail());
-        if(optionalUser.isPresent()) {
-            throw new AppException("Login already exists", HttpStatus.BAD_REQUEST);
-        }
-
-        User user = userMapper.signUpToUser(userDto);
-
-        user.setPassword(passwordEncoder.encode(CharBuffer.wrap(userDto.getPassword())));
-
-        user.setFirstName(userDto.getFirstName());
-        user.setLastName(userDto.getLastName());
-        user.setAddress(userDto.getAddress());
-        user.setPhone(userDto.getPhone());
-        user.setMembershipLevel(MembershipLevel.valueOf(userDto.getMembershipLevel()));
-        user.setRegistrationDate(Date.valueOf(LocalDate.now()));
-        user.setRole(Role.ROLE_USER);
-
-        User savedUser = userRepository.save(user);
-
-        return userMapper.toUserDto(savedUser);
-    }
-
-    @Override
-    public User findUserById(Long userId) {
-        return userRepository.findById(userId).orElseThrow(()->new InvalidArgumentException("Invalid user Id"));
-    }
-
-    @Override
-    public UserDetails loadUserByUsername(String email) throws UsernameNotFoundException {
-        User user = userRepository.findByEmail(email)
-                .orElseThrow(()-> new UsernameNotFoundException("User not found"));
-        return org.springframework.security.core.userdetails.User
-                .withUsername(user.getEmail())
-                .password(user.getPassword())
-                .authorities(user.getRole().name()) // adjust if needed
-                .build();
-    }
-}
Index: src/main/java/com/example/rezevirajmasa/demo/web/controller/CustomerController.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/web/controller/CustomerController.java	(revision d24f17cb212e43f94a77a44d655ba10b4b8143d2)
+++ src/main/java/com/example/rezevirajmasa/demo/web/controller/CustomerController.java	(revision d24f17cb212e43f94a77a44d655ba10b4b8143d2)
@@ -0,0 +1,47 @@
+package com.example.rezevirajmasa.demo.web.controller;
+
+import com.example.rezevirajmasa.demo.model.MembershipLevel;
+import com.example.rezevirajmasa.demo.model.Role;
+import com.example.rezevirajmasa.demo.service.CustomerService;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+@Controller
+public class CustomerController {
+    private final CustomerService customerService;
+
+    public CustomerController(CustomerService customerService) {
+        this.customerService = customerService;
+    }
+
+    @GetMapping("/customers")
+    public String showCustomers(Model model) {
+        model.addAttribute("bodyContent", "customers");
+        model.addAttribute("customers", customerService.listAll());
+        model.addAttribute("memberships", MembershipLevel.values());
+        model.addAttribute("roles", Role.values());
+        return "index";
+    }
+    @GetMapping("/customers/add")
+    public String showAddForm(Model model) {
+        model.addAttribute("bodyContent", "CustomersForm");
+        model.addAttribute("memberships", MembershipLevel.values());
+        model.addAttribute("roles", Role.values());
+        return "index";
+    }
+    @PostMapping("/customers/add")
+    public String createCustomer(@RequestParam String firstName,
+                                 @RequestParam String lastName,
+                                 @RequestParam String email,
+                                 @RequestParam String password,
+                                 @RequestParam String phone,
+                                 @RequestParam String address,
+                                 @RequestParam MembershipLevel membershipLevel,
+                                 @RequestParam Role role) {
+        customerService.registration(firstName, lastName, email, password, phone, address, membershipLevel, role);
+        return "redirect:/customers";
+    }
+}
Index: src/main/java/com/example/rezevirajmasa/demo/web/controller/ReservationController.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/web/controller/ReservationController.java	(revision d24f17cb212e43f94a77a44d655ba10b4b8143d2)
+++ src/main/java/com/example/rezevirajmasa/demo/web/controller/ReservationController.java	(revision d24f17cb212e43f94a77a44d655ba10b4b8143d2)
@@ -0,0 +1,95 @@
+package com.example.rezevirajmasa.demo.web.controller;
+
+import com.example.rezevirajmasa.demo.model.*;
+import com.example.rezevirajmasa.demo.model.exceptions.ExpiredReservationException;
+import com.example.rezevirajmasa.demo.service.*;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.springframework.security.core.Authentication;
+import org.springframework.stereotype.Controller;
+import org.springframework.transaction.annotation.RestrictedTransactionalEventListenerFactory;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.util.List;
+import java.util.stream.Collectors;
+
+@Controller
+public class ReservationController {
+    private final ReservationService reservationService;
+    private final CustomerService customerService;
+    private final TableService tableService;
+    private final ReservationHistoryService reservationHistoryService;
+
+    public ReservationController(ReservationService reservationService, CustomerService customerService, TableService tableService, ReservationHistoryService reservationHistoryService) {
+        this.reservationService = reservationService;
+        this.customerService = customerService;
+        this.tableService = tableService;
+        this.reservationHistoryService = reservationHistoryService;
+    }
+
+    @GetMapping("/reservations")
+    public String showReservations(Model model, Authentication authentication) {
+        Customer customer = customerService.findByEmail(authentication.getName());
+        List<Reservation> reservationList;
+        if(customer.getRole().equals(Role.ROLE_ADMIN)) {
+            reservationList = reservationService.listAll();
+        } else {
+            reservationList = reservationService.findReservationByCustomer(customer);
+        }
+        model.addAttribute("bodyContent", "reservationList");
+        model.addAttribute("reservations", reservationList);
+        return "index";
+    }
+
+    @GetMapping("/reservations/edit/{reservationId}")
+    public String showEditReservation(@PathVariable Long reservationId, Model model) {
+        Reservation reservation = reservationService.findById(reservationId);
+        tableService.canceledTimeSlots(reservation.getTable().getId(), reservation.getCheckInTime());
+        model.addAttribute("reservation", reservation);
+        model.addAttribute("bodyContent", "reservationsEditForm");
+        return "index";
+    }
+
+    @PostMapping("/restaurants/{tableNumber}")
+    public String saveReservation(@PathVariable Long tableNumber,
+                                  @RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime reservationDateTime,
+                                  @RequestParam int partySize,
+                                  @RequestParam String specialRequests,
+                                  Authentication authentication){
+        TableEntity table = tableService.findById(tableNumber);
+        Restaurant restaurant = table.getRestaurant();
+
+        Customer customer = customerService.findByEmail(authentication.getName());
+
+        if(!table.isAvailable(reservationDateTime)) {
+            System.out.println("The slot is taken sorry, pick another :D");
+        }
+        tableService.deleteTimeSlotsForReservation(tableNumber, reservationDateTime);
+        reservationService.makeReservation(customer, table, restaurant, LocalDateTime.now(), reservationDateTime, partySize, specialRequests);
+        return "redirect:/reservations";
+    }
+
+    @RequestMapping("/reservations/edit/{reservationId}")
+    public String updateReservation(@PathVariable Long reservationId,
+                                    @RequestParam int partySize,
+                                    @RequestParam String specialRequests,
+                                    @RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime reservationDateTime) {
+        Reservation reservation = reservationService.findById(reservationId);
+        reservation.setPartySize(partySize);
+        reservation.setSpecialRequests(specialRequests);
+        reservation.setCheckInTime(reservationDateTime);
+        tableService.deleteTimeSlotsForReservation(reservation.getTable().getId(), reservationDateTime);
+        return "redirect:/reservations";
+    }
+
+    @PostMapping("/reservations/delete/{reservationId}")
+    public String deleteReservation(@PathVariable Long reservationId, @RequestParam String reason) {
+        Reservation reservation = reservationService.findById(reservationId);
+        tableService.canceledTimeSlots(reservation.getTable().getId(), reservation.getCheckInTime());
+        reservationService.cancelReservation(reservationId);
+        reservationHistoryService.moveReservationToHistory(reservation, "canceled", reason);
+        return "redirect:/reservation-history";
+    }
+}
Index: src/main/java/com/example/rezevirajmasa/demo/web/controller/ReservationHistoryController.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/web/controller/ReservationHistoryController.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ src/main/java/com/example/rezevirajmasa/demo/web/controller/ReservationHistoryController.java	(revision d24f17cb212e43f94a77a44d655ba10b4b8143d2)
@@ -1,11 +1,9 @@
 package com.example.rezevirajmasa.demo.web.controller;
 
-import com.example.rezevirajmasa.demo.dto.SignUpDto;
-import com.example.rezevirajmasa.demo.dto.UserDto;
-import com.example.rezevirajmasa.demo.mappers.UserMapper;
+import com.example.rezevirajmasa.demo.model.Customer;
 import com.example.rezevirajmasa.demo.model.Restaurant;
-import com.example.rezevirajmasa.demo.model.User;
+import com.example.rezevirajmasa.demo.model.Role;
+import com.example.rezevirajmasa.demo.service.CustomerService;
 import com.example.rezevirajmasa.demo.service.ReservationHistoryService;
-import com.example.rezevirajmasa.demo.service.UserService;
 import org.springframework.security.core.Authentication;
 import org.springframework.stereotype.Controller;
@@ -20,11 +18,9 @@
 public class ReservationHistoryController {
     private final ReservationHistoryService reservationHistoryService;
-    private final UserService userService;
-    private final UserMapper userMapper;
+    private final CustomerService customerService;
 
-    public ReservationHistoryController(ReservationHistoryService reservationHistoryService, UserService userService, UserMapper userMapper) {
+    public ReservationHistoryController(ReservationHistoryService reservationHistoryService, CustomerService customerService) {
         this.reservationHistoryService = reservationHistoryService;
-        this.userService = userService;
-        this.userMapper = userMapper;
+        this.customerService = customerService;
     }
 
@@ -32,16 +28,10 @@
     public String showPastReservations(Authentication authentication, Model model) {
         List<Restaurant.ReservationHistory> reservationHistoryList;
-        UserDto userDto = userService.findByEmail(authentication.getName());
-
-        SignUpDto signUpDto = userMapper.toSignUpDto(userDto);
-
-        User user = userMapper.signUpToUser(signUpDto);
-
-        reservationHistoryList = reservationHistoryService.findByUser(user);
-//        if(customer.getRole().equals(Role.ROLE_ADMIN)) {
-//            reservationHistoryList = reservationHistoryService.findAll();
-//        } else {
-//            reservationHistoryList = reservationHistoryService.findByUser(User user);
-//        }
+        Customer customer = customerService.findByEmail(authentication.getName());
+        if(customer.getRole().equals(Role.ROLE_ADMIN)) {
+            reservationHistoryList = reservationHistoryService.findAll();
+        } else {
+            reservationHistoryList = reservationHistoryService.findByCustomer(customer);
+        }
         model.addAttribute("historyReservations", reservationHistoryList);
         model.addAttribute("bodyContent", "pastReservations");
Index: src/main/java/com/example/rezevirajmasa/demo/web/controller/RestaurantController.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/web/controller/RestaurantController.java	(revision d24f17cb212e43f94a77a44d655ba10b4b8143d2)
+++ src/main/java/com/example/rezevirajmasa/demo/web/controller/RestaurantController.java	(revision d24f17cb212e43f94a77a44d655ba10b4b8143d2)
@@ -0,0 +1,109 @@
+package com.example.rezevirajmasa.demo.web.controller;
+
+import com.example.rezevirajmasa.demo.model.Customer;
+import com.example.rezevirajmasa.demo.model.Restaurant;
+import com.example.rezevirajmasa.demo.model.TableEntity;
+import com.example.rezevirajmasa.demo.service.CustomerService;
+import com.example.rezevirajmasa.demo.service.ReservationService;
+import com.example.rezevirajmasa.demo.service.RestaurantService;
+import com.example.rezevirajmasa.demo.service.TableService;
+import net.sourceforge.htmlunit.xpath.operations.Mod;
+import org.springframework.boot.Banner;
+import org.springframework.security.core.Authentication;
+import org.springframework.ui.Model;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.ui.Model;
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+@Controller
+public class RestaurantController {
+    private final RestaurantService restaurantService;
+    private final TableService tableService;
+
+    public RestaurantController(RestaurantService restaurantService, TableService tableService) {
+        this.restaurantService = restaurantService;
+        this.tableService = tableService;
+    }
+
+    @GetMapping("/restaurants")
+    public String showRestaurants(@RequestParam(required = false) String search, Model model) {
+        List<Restaurant> restaurantList;
+        if(search == null) {
+            restaurantList = this.restaurantService.listall();
+        } else {
+            restaurantList = restaurantService.listRestaurantBy(search);
+        }
+
+        for (Restaurant restaurant : restaurantList) {
+            // Initialize a set to store unique capacities for this restaurant
+            Set<Integer> uniqueCapacities = new HashSet<>();
+
+            // Populate uniqueCapacities with unique capacity values for tables in this restaurant
+            for (TableEntity table : restaurant.getTablesList()) {
+                uniqueCapacities.add(table.getCapacity());
+            }
+
+            // Add uniqueCapacities to the model for this restaurant
+            model.addAttribute("uniqueCapacities_" + restaurant.getRestaurantId(), uniqueCapacities);
+        }
+        model.addAttribute("bodyContent", "restaurants");
+        model.addAttribute("restaurants", restaurantList);
+        return "index";
+    }
+
+    @GetMapping("/restaurants/{tableNumber}")
+    public String reserveTable(@PathVariable Long tableNumber, Model model) {
+        TableEntity tableEntity = tableService.findById(tableNumber);
+        Restaurant restaurant = tableEntity.getRestaurant();
+
+        model.addAttribute("table", tableEntity);
+        model.addAttribute("restaurant", restaurant);
+
+        model.addAttribute("bodyContent", "reservationConfirmation.html");
+
+        return "index";
+    }
+
+    @GetMapping("/restaurants/add")
+    public String showAddRestaurantForm(Model model) {
+        model.addAttribute("bodyContent", "restaurantForm");
+        return "index";
+    }
+
+    @PostMapping("/register-restaurant")
+    public String saveRestaurant(@RequestParam String name,
+                                 @RequestParam String cuisineType,
+                                 @RequestParam String address,
+                                 @RequestParam String phone,
+                                 @RequestParam String operatingHours,
+                                 @RequestParam BigDecimal rating,
+                                 @RequestParam int numberOfTables,
+                                 @RequestParam List<Integer> tableCapacities,
+                                 @RequestParam List<String> tableLocations,
+                                 @RequestParam List<String> tableSmokingAreas,
+                                 @RequestParam List<String> tableDescriptions,
+                                 @RequestParam String socialMediaLinks,
+                                 @RequestParam String website,
+                                 Model model) {
+
+        Restaurant restaurant = new Restaurant();
+        restaurant.setName(name);
+        restaurant.setCuisineType(cuisineType);
+        restaurant.setAddress(address);
+        restaurant.setPhone(phone);
+        restaurant.setOperatingHours(operatingHours);
+        restaurant.setRating(rating);
+        restaurant.setSocialMediaLinks(socialMediaLinks);
+        restaurant.setWebsite(website);
+
+        restaurantService.save(restaurant, numberOfTables, tableCapacities, tableLocations, tableSmokingAreas, tableDescriptions);
+        model.addAttribute("bodyContent", "restaurants");
+        return "redirect:/restaurants";
+    }
+
+}
Index: src/main/java/com/example/rezevirajmasa/demo/web/filters/JwtAuthFilter.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/web/filters/JwtAuthFilter.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ 	(revision )
@@ -1,72 +1,0 @@
-package com.example.rezevirajmasa.demo.web.filters;
-
-import com.example.rezevirajmasa.demo.config.UserAuthProvider;
-import io.jsonwebtoken.ExpiredJwtException;
-import jakarta.servlet.FilterChain;
-import jakarta.servlet.ServletException;
-import jakarta.servlet.http.HttpServletRequest;
-import jakarta.servlet.http.HttpServletResponse;
-import lombok.RequiredArgsConstructor;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpHeaders;
-import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
-import org.springframework.security.core.context.SecurityContextHolder;
-import org.springframework.web.filter.OncePerRequestFilter;
-
-import java.io.IOException;
-
-@RequiredArgsConstructor
-public class JwtAuthFilter extends OncePerRequestFilter {
-
-    private final UserAuthProvider userAuthProvider;
-
-    @Override
-    protected void doFilterInternal(
-            HttpServletRequest request,
-            HttpServletResponse response,
-            FilterChain filterChain) throws ServletException, IOException {
-        String header = request.getHeader(HttpHeaders.AUTHORIZATION);
-
-        String username = null;
-        String jwt = null;
-
-        if(header != null) {
-            jwt = header.substring(7);
-            String[] elements = header.split(" ");
-
-            if(elements.length == 2 && "Bearer".equals(elements[0])) {
-                try {
-                    username = userAuthProvider.extractUsername(jwt); // logikata vidi ja
-                    SecurityContextHolder.getContext().setAuthentication(
-                            userAuthProvider.validateToken(elements[1])
-                    );
-                    if (username != null) {
-                        System.out.println("Authenticated user: " + username); // Debug log
-                        SecurityContextHolder.getContext().setAuthentication(
-                                userAuthProvider.validateToken(jwt) // Ensure token validation works properly
-                        );
-                    }
-                } catch (ExpiredJwtException e) {
-                    String isRefreshToken = request.getHeader("isRefreshToken");
-                    String requestURL = request.getRequestURL().toString();
-                    if (isRefreshToken != null && isRefreshToken.equals("true") && requestURL.contains("refresh-token")) {
-                        allowForRefreshToken(e, request);
-                    } else
-                        request.setAttribute("exception", e);
-
-                } catch (RuntimeException e) {
-                    SecurityContextHolder.clearContext();
-                    throw e;
-                }
-            }
-        }
-        filterChain.doFilter(request, response);
-    }
-
-    private void allowForRefreshToken(ExpiredJwtException ex, HttpServletRequest request) {
-        UsernamePasswordAuthenticationToken usernamePasswordAuthenticationToken = new UsernamePasswordAuthenticationToken(
-                null, null, null);
-        SecurityContextHolder.getContext().setAuthentication(usernamePasswordAuthenticationToken);
-        request.setAttribute("claims", ex.getClaims());
-    }
-}
Index: src/main/java/com/example/rezevirajmasa/demo/web/rest/AuthController.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/web/rest/AuthController.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ src/main/java/com/example/rezevirajmasa/demo/web/rest/AuthController.java	(revision d24f17cb212e43f94a77a44d655ba10b4b8143d2)
@@ -1,36 +1,9 @@
 package com.example.rezevirajmasa.demo.web.rest;
 
-import com.example.rezevirajmasa.demo.config.UserAuthProvider;
-import com.example.rezevirajmasa.demo.dto.CredentialsDto;
-import com.example.rezevirajmasa.demo.dto.SignUpDto;
-import com.example.rezevirajmasa.demo.dto.UserDto;
-import com.example.rezevirajmasa.demo.service.UserService;
-import lombok.RequiredArgsConstructor;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.authentication.AuthenticationManager;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.net.URI;
-
-@RequiredArgsConstructor
 @RestController
 public class AuthController {
-    private final UserService userService;
-    private final UserAuthProvider userAuthProvider;
-    @PostMapping("/api/login")
-    public ResponseEntity<UserDto> login(@RequestBody CredentialsDto credentialsDto) {
-        UserDto user = userService.login(credentialsDto);
-        String token = userAuthProvider.createToken(user.getEmail());
-        user.setToken(token);
-
-        return ResponseEntity.ok(user);
-    }
-
-    @PostMapping("/api/register")
-    public ResponseEntity<UserDto> register(@RequestBody SignUpDto signUpDto) {
-        UserDto user = userService.register(signUpDto);
-        user.setToken(userAuthProvider.createToken(user.getEmail()));
-        return ResponseEntity.created(URI.create("/users/" + user.getId())).body(user);
-    }
 }
Index: src/main/java/com/example/rezevirajmasa/demo/web/rest/testController.java
===================================================================
--- src/main/java/com/example/rezevirajmasa/demo/web/rest/testController.java	(revision e48199adf103ea72701a91722bdbf8cfb9732731)
+++ src/main/java/com/example/rezevirajmasa/demo/web/rest/testController.java	(revision d24f17cb212e43f94a77a44d655ba10b4b8143d2)
@@ -1,30 +1,16 @@
 package com.example.rezevirajmasa.demo.web.rest;
 
-import com.example.rezevirajmasa.demo.dto.*;
-import com.example.rezevirajmasa.demo.mappers.UserMapper;
 import com.example.rezevirajmasa.demo.model.*;
-import com.example.rezevirajmasa.demo.model.exceptions.InvalidReservationException;
-import com.example.rezevirajmasa.demo.service.*;
-import com.example.rezevirajmasa.demo.service.impl.TokenService;
-import jakarta.servlet.http.HttpServletRequest;
-import jdk.jfr.consumer.RecordingStream;
+import com.example.rezevirajmasa.demo.service.CustomerService;
+import com.example.rezevirajmasa.demo.service.ReservationService;
+import com.example.rezevirajmasa.demo.service.RestaurantService;
+import com.example.rezevirajmasa.demo.service.TableService;
 import org.apache.coyote.Response;
-import org.apache.http.protocol.HTTP;
-import org.springframework.format.annotation.DateTimeFormat;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
-import org.springframework.security.core.Authentication;
-import org.springframework.security.core.annotation.AuthenticationPrincipal;
-import org.springframework.security.core.context.SecurityContextHolder;
-import org.springframework.security.core.parameters.P;
-import org.springframework.security.core.userdetails.UserDetails;
 import org.springframework.web.bind.annotation.*;
 
-import java.nio.file.attribute.UserPrincipal;
-import java.security.Principal;
 import java.time.LocalDateTime;
-import java.time.format.DateTimeFormatter;
-import java.util.*;
-import java.util.stream.Collectors;
+import java.util.List;
 
 @CrossOrigin(origins = "http://localhost:3000/")
@@ -32,20 +18,13 @@
 public class testController {
     private final RestaurantService restaurantService;
-    private final UserService userService;
+    private final CustomerService customerService;
     private final ReservationService reservationService;
-    private final ReservationHistoryService reservationHistoryService;
     private final TableService tableService;
-    private final MenuService menuService;
-    private final UserMapper userMapper;
-    private final TokenService tokenService;
-    public testController(RestaurantService restaurantService, UserService userService, ReservationService reservationService, ReservationHistoryService reservationHistoryService, TableService tableService, MenuService menuService, UserMapper userMapper, TokenService tokenService) {
+
+    public testController(RestaurantService restaurantService, CustomerService customerService, ReservationService reservationService, TableService tableService) {
         this.restaurantService = restaurantService;
-        this.userService = userService;
+        this.customerService = customerService;
         this.reservationService = reservationService;
-        this.reservationHistoryService = reservationHistoryService;
         this.tableService = tableService;
-        this.menuService = menuService;
-        this.userMapper = userMapper;
-        this.tokenService = tokenService;
     }
 
@@ -55,97 +34,49 @@
     }
 
-    //restaurants calls
-
-    @GetMapping("/api/restaurants")
-    public ResponseEntity<List<RestaurantDTO>> getAllRestaurants() {
-            return new ResponseEntity<List<RestaurantDTO>>(restaurantService.listall(), HttpStatus.OK);
+    @RequestMapping("/api/restaurants")
+    public ResponseEntity<List<Restaurant>> getAllRestaurants() {
+        return new ResponseEntity<List<Restaurant>>(restaurantService.listall(), HttpStatus.OK);
     }
 
-    @GetMapping("/api/restaurants/{restaurantId}")
-    public ResponseEntity<RestaurantDTO> getRestaurantById(@PathVariable Long restaurantId) {
-        RestaurantDTO restaurantDTO = restaurantService.findById(restaurantId);
-        return new ResponseEntity<>(restaurantDTO, HttpStatus.OK);
+    @RequestMapping("/api/restaurants/{restaurantId}")
+    public ResponseEntity<Restaurant> getRestaurantById(@PathVariable Long restaurantId) {
+        return new ResponseEntity<Restaurant>(restaurantService.findById(restaurantId), HttpStatus.OK);
     }
 
-    @PostMapping("/api/search")
-    public ResponseEntity<List<RestaurantDTO>> searchRestaurants(@RequestBody Map<String, Object> requestData) {
-        Optional<String> dateTimeOptional = Optional.ofNullable((String) requestData.get("dateTime"));
-        int partySize = Integer.parseInt(requestData.get("partySize").toString());
-        Optional<String> searchOptional = Optional.ofNullable((String) requestData.get("search"));
+//    Customer CALLS
 
-        String dateTime = dateTimeOptional.orElse(null);
-        String search = searchOptional.orElse(null);
-
-        LocalDateTime parsedDateTime = null;
-        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
-        if (dateTime != null) {
-            parsedDateTime = LocalDateTime.parse(dateTime, formatter);
-        }
-
-        List<RestaurantDTO> filteredRestaurants = restaurantService.findRestaurantsBySearchParams(parsedDateTime, partySize, search);
-
-        return new ResponseEntity<>(filteredRestaurants, HttpStatus.OK);
+    @RequestMapping("/api/customers")
+    public ResponseEntity<List<Customer>> getAllCustomers() {
+        return new ResponseEntity<List<Customer>>(customerService.listAll(), HttpStatus.OK);
     }
 
-    @PostMapping("/api/search/shortcut/{param}")
-    public ResponseEntity<List<RestaurantDTO>> searchByCuisineTypeShortcut(@PathVariable String param) {
-        List<RestaurantDTO> filteredRestaurants;
-        if(param != null && !param.isEmpty()) {
-            filteredRestaurants = restaurantService.findRestaurantsByCuisineType(param);
-        } else {
-            filteredRestaurants = restaurantService.listall();
-        }
-        return new ResponseEntity<List<RestaurantDTO>>(filteredRestaurants, HttpStatus.OK);
+    @RequestMapping("/api/customers/{id}")
+    public ResponseEntity<Customer> getCustomerById(@PathVariable Long id) {
+        return new ResponseEntity<Customer>(customerService.findById(id), HttpStatus.OK);
     }
 
-    @GetMapping("/api/cuisineTypes")
-    public ResponseEntity<List<String>> getAllCuisineTypes() {
-        List<String> cuisineTypes = restaurantService.findALlCuisineTypes();
-        return new ResponseEntity<>(cuisineTypes, HttpStatus.OK);
+    @PutMapping("/api/customers/edit/{id}")
+    public ResponseEntity<Customer> editCustomerById(@PathVariable Long id, @RequestBody Customer customer) {
+        return new ResponseEntity<Customer>(
+                customerService.updateCustomer(id, customer.getFirstName(), customer.getLastName(), customer.getEmail(), customer.getPassword(), customer.getPhone(), customer.getAddress(), customer.getMembershipLevel()),
+                HttpStatus.OK
+        );
     }
 
-    // User calls
-
-    @GetMapping("/api/user/{email}")
-    public ResponseEntity<User> getUserByEmail(@PathVariable String email)
-    {
-        User user = userService.findByMail(email);
-        return ResponseEntity.ok(user);
+    @PostMapping("/api/customers")
+    public ResponseEntity<Customer> saveCustomer(@RequestBody Customer customer) {
+        // Ensure that the role is set to ROLE_USER by default
+        customer.setRole(Role.ROLE_USER);
+        return new ResponseEntity<Customer>(
+                customerService.registration(customer),
+                HttpStatus.OK
+        );
     }
 
-//    Reservation Calls
-
-    @GetMapping("/api/reservations/by/{email}")
-    public ResponseEntity<List<ReservationDTO>> getReservations(@PathVariable String email) {
-        if (email == null || email.isEmpty()) {
-            return ResponseEntity.badRequest().build();
-        }
-        User user = userService.findByMail(email);
-        if (user == null) {
-            return ResponseEntity.notFound().build();
-        }
-
-        List<Reservation> reservations = reservationService.findReservationByUser(user);
-        List<ReservationDTO> reservationDTOs = reservations.stream()
-                .map(ReservationDTO::new)
-                .collect(Collectors.toList());
-
-        return ResponseEntity.ok(reservationDTOs);
-    }
-
-    @PostMapping("/api/reservations")
-    public ResponseEntity<?> createReservation(@RequestBody ReservationDTO reservation){
-    User user = userService.findByMail(reservation.getUserEmail());
-    Restaurant restaurant = restaurantService.findByIdRestaurant(reservation.getRestaurantId());
-        Reservation savedReservation = reservationService.makeReservationRest(reservation, user, restaurant);
-
-        return new ResponseEntity<>(savedReservation, HttpStatus.CREATED);
-    }
-
-    @GetMapping("/api/reservations/{reservationId}")
-    public ResponseEntity<ReservationDTO> getReservation(@PathVariable Long reservationId) {
-        Reservation reservation = reservationService.findById(reservationId);
-        if (reservation != null) {
-            return ResponseEntity.ok(new ReservationDTO(reservation));
+    @DeleteMapping("/api/customers/delete/{customerId}")
+    public ResponseEntity<Response> deleteCustomer(@PathVariable Long customerId) {
+        boolean deleted = customerService.deleteById(customerId);
+        if(deleted) {
+            return ResponseEntity.ok().build();
         } else {
             return ResponseEntity.notFound().build();
@@ -153,49 +84,54 @@
     }
 
-//    @GetMapping("/api/reservations/{restaurantId}")
-//    public ResponseEntity<List<Reservation>> getReservationsByRestaurant(@PathVariable Long restaurantId)
-//    {
-//        Restaurant restaurant = restaurantService.findByIdRestaurant(restaurantId);
-//        List<Reservation> reservations = reservationService.findAllByRestaurant(restaurant);
-//        return ResponseEntity.ok(reservations);
-//    }
+//    Reservation Calls
 
-    @GetMapping("/api/table-reservations/{tableId}")
-    public ResponseEntity<List<LocalDateTime>> tableReservations(@PathVariable Long tableId) {
-        TableEntity table = tableService.findByIdTable(tableId);
-        if (table == null) {
+    @GetMapping("/api/reservations")
+    public ResponseEntity<List<Reservation>> getReservations() {
+        return new ResponseEntity<List<Reservation>>(reservationService.listAll(), HttpStatus.OK);
+    }
+
+    @PostMapping("/api/reservations")
+    public ResponseEntity<Reservation> createReservation(@RequestBody Reservation reservation) {
+        reservation.setReservationDateTime(LocalDateTime.now());
+        Reservation savedReservation = reservationService.makeReservationRest(reservation);
+        return new ResponseEntity<>(savedReservation, HttpStatus.CREATED);
+    }
+
+    @GetMapping("/api/reservations/{reservationId}")
+    public ResponseEntity<Reservation> getReservation(@PathVariable Long reservationId) {
+        Reservation reservation = reservationService.findById(reservationId);
+        if (reservation != null) {
+            return ResponseEntity.ok(reservation);
+        } else {
             return ResponseEntity.notFound().build();
         }
-
-        List<Reservation> reservations = reservationService.reservationsForTable(table);
-        List<LocalDateTime> reservedTimes = reservations.stream()
-                .map(Reservation::getReservationDateTime)
-                .collect(Collectors.toList());
-
-        return ResponseEntity.ok(reservedTimes);
     }
 
-
-    @PostMapping("/api/reservations/{reservationId}/{email}")
+    @PostMapping("/api/reservations/{reservationId}")
     public ResponseEntity<Reservation> editReservation(@PathVariable Long reservationId,
-                                                       @RequestBody ReservationDTO reservationDTO,
-                                                       @PathVariable String email) {
-        User user = userService.findByMail(email);
-        Restaurant restaurant = restaurantService.findByIdRestaurant(reservationDTO.getRestaurantId());
-        if (!reservationDTO.getReservationID().equals(reservationId)) {
+                                                       @RequestBody Reservation reservation) {
+        if (!reservation.getReservationID().equals(reservationId)) {
             return ResponseEntity.badRequest().build();
         }
 
-        try {
-            Reservation updatedReservation = reservationService.updateReservation(reservationId, reservationDTO, user);
-            return ResponseEntity.ok(updatedReservation);
-        } catch (InvalidReservationException e) {
-            return ResponseEntity.status(409).body(null);
-        } catch (Exception e) {
-            return ResponseEntity.status(500).build();
+        Reservation savedReservation = reservationService.findById(reservationId);
+        if(!reservation.getCheckInTime().equals(savedReservation.getCheckInTime())) {
+            tableService.canceledTimeSlots(savedReservation.getTable().getId(), savedReservation.getCheckInTime());
         }
+
+        savedReservation.setReservationDateTime(LocalDateTime.now());
+        savedReservation.setCheckInTime(reservation.getCheckInTime());
+        savedReservation.setCheckOutTime(reservation.getCheckInTime().plusHours(2));
+        savedReservation.setPartySize(reservation.getPartySize());
+        savedReservation.setSpecialRequests(reservation.getSpecialRequests());
+        tableService.deleteTimeSlotsForReservation(reservation.getTable().getId(), reservation.getCheckInTime());
+
+        //moze da se vovede sistem za ako od 4ca doagjaat samo 2ca da se najde pomala masa po moznost ako ima u toj moment
+        //listaj samo slotovi za taa masa vo toj moment ili da ima da odbere od novo ama taka bolje nova rezevacij
+
+        Reservation updatedReservation = reservationService.makeReservationRest(savedReservation);
+        System.out.println("Saved reservation time: " + savedReservation.getCheckInTime());
+        return ResponseEntity.ok(updatedReservation);
     }
-
-
 
     @DeleteMapping("/api/reservations/delete/{reservationId}")
@@ -209,29 +145,10 @@
     }
 
-    @GetMapping("/api/reservations/past/{email}")
-    public ResponseEntity<List<Restaurant.ReservationHistory>> pastReservations(@PathVariable String email) {
-        User user = userService.findByMail(email);
-        return null;
+//    TableEntity Calls
+
+    @GetMapping("/api/tables/{tableId}")
+    public ResponseEntity<TableEntity> findTableById(@PathVariable Long tableId) {
+        return new ResponseEntity<TableEntity>(tableService.findById(tableId), HttpStatus.OK);
     }
 
-    // TableEntity Calls
-    @GetMapping("/api/tables/{tableId}")
-    public ResponseEntity<TableDTO> findTableById(@PathVariable Long tableId) {
-        TableDTO tableDTO = tableService.findById(tableId);
-        return new ResponseEntity<>(tableDTO, HttpStatus.OK);
-    }
-
-    // past reservation calls
-    @GetMapping("/api/past-reservations/{email}")
-    public ResponseEntity<List<Restaurant.ReservationHistory>> findPastReservationsByUser(@PathVariable String email) {
-        User user = userService.findByMail(email);
-        List<Restaurant.ReservationHistory> reservations = reservationHistoryService.findByUser(user);
-        return new ResponseEntity<>(reservations, HttpStatus.OK);
-    }
-
-    // menu calls
-    @GetMapping("/api/restaurant-menu/{restaurantId}")
-    public List<Menu> getMenuByRestaurantId(@PathVariable Long restaurantId) {
-        return menuService.getMenuByRestaurantId(restaurantId);
-    }
 }
