Configuration changes

This commit is contained in:
indx0
2025-11-25 11:08:35 +03:00
parent 92450eae24
commit fa5ad7d63e
2 changed files with 6 additions and 1 deletions

View File

@@ -10,6 +10,7 @@ import com.example.nto.repository.EmployeeRepository;
import com.example.nto.repository.PlaceRepository;
import com.example.nto.service.BookingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
@@ -34,12 +35,15 @@ public class BookingServiceImpl implements BookingService {
@Autowired
EmployeeRepository employeeRepository;
@Value("${booking.days-ahead}")
private long daysAhead;
@Override
public Map<LocalDate, List<Place>> getAvailablePlaces(String code) {
employeeService.codeExists(code);
LocalDate startDate = LocalDate.now();
LocalDate endDate = startDate.plusDays(3);
LocalDate endDate = startDate.plusDays(daysAhead);
List<Place> allPlaces = placeRepository.findAll();
List<Booking> allBookings = bookingRepository.findByDateBetween(startDate, endDate);

View File

@@ -20,6 +20,7 @@ public class EmployeeServiceImpl implements EmployeeService {
@Autowired
EmployeeRepository employeeRepository;
@Override
public boolean codeExists(String code) {
boolean codeExists = employeeRepository.existsByCode(code);