diff --git a/hotel-service/src/main/java/org/microarchitecturovisco/hotelservice/controllers/HotelsController.java b/hotel-service/src/main/java/org/microarchitecturovisco/hotelservice/controllers/HotelsController.java index 6f71f24..dd207ea 100644 --- a/hotel-service/src/main/java/org/microarchitecturovisco/hotelservice/controllers/HotelsController.java +++ b/hotel-service/src/main/java/org/microarchitecturovisco/hotelservice/controllers/HotelsController.java @@ -7,6 +7,7 @@ import org.microarchitecturovisco.hotelservice.model.cqrs.commands.CreateRoomReservationCommand; import org.microarchitecturovisco.hotelservice.model.cqrs.commands.DeleteRoomReservationCommand; import org.microarchitecturovisco.hotelservice.model.dto.RoomReservationDto; +import org.microarchitecturovisco.hotelservice.model.dto.request.CheckHotelAvailabilityQueryRequestDto; import org.microarchitecturovisco.hotelservice.model.dto.request.GetHotelDetailsRequestDto; import org.microarchitecturovisco.hotelservice.model.dto.request.GetHotelsBySearchQueryRequestDto; import org.microarchitecturovisco.hotelservice.model.dto.response.CheckHotelAvailabilityResponseDto; @@ -68,10 +69,17 @@ public String consumeMessageCheckHotelAvailability(String requestJson) { CheckHotelAvailabilityRequest request = JsonReader.readCheckHotelAvailabilityRequestCommand(requestJson); System.out.println("Converted message received from queue: " + request); - // todo: here logic (RSWW-102) + CheckHotelAvailabilityQueryRequestDto query = CheckHotelAvailabilityQueryRequestDto.builder() + .dateFrom(request.getHotelTimeFrom()) + .dateTo(request.getHotelTimeTo()) + .hotelId(request.getHotelId()) + .roomReservationsIds(request.getRoomReservationsIds()) + .build(); + + boolean availability = hotelsService.CheckHotelAvailability(query); CheckHotelAvailabilityResponseDto response = CheckHotelAvailabilityResponseDto.builder() - .ifAvailable(true) // todo adjust + .ifAvailable(availability) .build(); System.out.println("Response to convert:" +response ); diff --git a/hotel-service/src/main/java/org/microarchitecturovisco/hotelservice/model/dto/request/CheckHotelAvailabilityQueryRequestDto.java b/hotel-service/src/main/java/org/microarchitecturovisco/hotelservice/model/dto/request/CheckHotelAvailabilityQueryRequestDto.java index 54dae77..beadfc0 100644 --- a/hotel-service/src/main/java/org/microarchitecturovisco/hotelservice/model/dto/request/CheckHotelAvailabilityQueryRequestDto.java +++ b/hotel-service/src/main/java/org/microarchitecturovisco/hotelservice/model/dto/request/CheckHotelAvailabilityQueryRequestDto.java @@ -19,11 +19,6 @@ public class CheckHotelAvailabilityQueryRequestDto implements Serializable { private LocalDateTime dateFrom; private LocalDateTime dateTo; - private Integer adults; - private Integer childrenUnderThree; - private Integer childrenUnderTen; - private Integer childrenUnderEighteen; - private UUID hotelId; private List roomReservationsIds;