Configuration changes
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -20,6 +20,7 @@ public class EmployeeServiceImpl implements EmployeeService {
|
||||
@Autowired
|
||||
EmployeeRepository employeeRepository;
|
||||
|
||||
|
||||
@Override
|
||||
public boolean codeExists(String code) {
|
||||
boolean codeExists = employeeRepository.existsByCode(code);
|
||||
|
||||
Reference in New Issue
Block a user