Skip to content

Commit

Permalink
RSWW-103 implement logic for checking hotel availability based on res…
Browse files Browse the repository at this point in the history
…ervations
  • Loading branch information
Danzigerrr committed May 21, 2024
1 parent f850358 commit 6d710c7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<UUID> roomReservationsIds;
Expand Down

0 comments on commit 6d710c7

Please sign in to comment.