-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feature/get-rooms
- Loading branch information
Showing
20 changed files
with
603 additions
and
434 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
src/main/java/com/fc/shimpyo_be/domain/reservation/dto/CheckAvailableRoomsResultDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 6 additions & 1 deletion
7
...in/java/com/fc/shimpyo_be/domain/reservation/dto/response/ReservationInfoResponseDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,24 @@ | ||
package com.fc.shimpyo_be.domain.reservation.dto.response; | ||
|
||
import lombok.Builder; | ||
|
||
@Builder | ||
public record ReservationInfoResponseDto( | ||
Long reservationId, | ||
Long reservationProductId, | ||
Long productId, | ||
String productName, | ||
String productImageUrl, | ||
String productAddress, | ||
String productDetailAddress, | ||
Long roomId, | ||
String roomName, | ||
String startDate, | ||
String endDate, | ||
String checkIn, | ||
String checkOut, | ||
Integer price, | ||
String payMethod | ||
String payMethod, | ||
String createdAt | ||
) { | ||
} |
16 changes: 4 additions & 12 deletions
16
...in/java/com/fc/shimpyo_be/domain/reservation/dto/response/SaveReservationResponseDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,17 @@ | ||
package com.fc.shimpyo_be.domain.reservation.dto.response; | ||
|
||
import com.fc.shimpyo_be.domain.reservation.dto.request.SaveReservationRequestDto; | ||
import com.fc.shimpyo_be.domain.reservation.entity.PayMethod; | ||
import com.fc.shimpyo_be.domain.reservationproduct.dto.response.ReservationProductResponseDto; | ||
import lombok.Builder; | ||
|
||
import java.util.List; | ||
|
||
@Builder | ||
public record SaveReservationResponseDto( | ||
Long reservationId, | ||
List<ReservationProductResponseDto> reservationProducts, | ||
PayMethod payMethod, | ||
Integer totalPrice | ||
Integer totalPrice, | ||
String createdAt | ||
) { | ||
public SaveReservationResponseDto(Long reservationId, SaveReservationRequestDto requestDto) { | ||
this( | ||
reservationId, | ||
requestDto.reservationProducts() | ||
.stream() | ||
.map(ReservationProductResponseDto::new).toList(), | ||
requestDto.payMethod(), | ||
requestDto.totalPrice() | ||
); | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
...n/java/com/fc/shimpyo_be/domain/reservation/dto/response/ValidationResultResponseDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
src/main/java/com/fc/shimpyo_be/domain/reservation/util/ReservationMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package com.fc.shimpyo_be.domain.reservation.util; | ||
|
||
import com.fc.shimpyo_be.domain.product.entity.Product; | ||
import com.fc.shimpyo_be.domain.reservation.dto.response.ReservationInfoResponseDto; | ||
import com.fc.shimpyo_be.domain.reservation.dto.response.SaveReservationResponseDto; | ||
import com.fc.shimpyo_be.domain.reservation.entity.Reservation; | ||
import com.fc.shimpyo_be.domain.reservationproduct.dto.response.ReservationProductResponseDto; | ||
import com.fc.shimpyo_be.domain.reservationproduct.entity.ReservationProduct; | ||
import com.fc.shimpyo_be.domain.room.entity.Room; | ||
import com.fc.shimpyo_be.global.util.DateTimeUtil; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class ReservationMapper { | ||
|
||
public static ReservationInfoResponseDto from(ReservationProduct reservationProduct) { | ||
Reservation reservation = reservationProduct.getReservation(); | ||
Room room = reservationProduct.getRoom(); | ||
Product product = room.getProduct(); | ||
|
||
return ReservationInfoResponseDto.builder() | ||
.reservationId(reservation.getId()) | ||
.reservationProductId(reservationProduct.getId()) | ||
.productId(product.getId()) | ||
.productName(product.getName()) | ||
.productImageUrl(product.getThumbnail()) | ||
.productAddress(product.getAddress().getAddress()) | ||
.productDetailAddress(product.getAddress().getDetailAddress()) | ||
.roomId(room.getId()) | ||
.roomName(room.getName()) | ||
.startDate(DateTimeUtil.toString(reservationProduct.getStartDate())) | ||
.endDate(DateTimeUtil.toString(reservationProduct.getEndDate())) | ||
.checkIn(DateTimeUtil.toString(room.getCheckIn())) | ||
.checkOut(DateTimeUtil.toString(room.getCheckOut())) | ||
.price(reservationProduct.getPrice()) | ||
.payMethod(reservation.getPayMethod().name()) | ||
.createdAt(DateTimeUtil.toString(reservation.getCreatedAt())) | ||
.build(); | ||
} | ||
|
||
public static SaveReservationResponseDto from(Reservation reservation) { | ||
List<ReservationProductResponseDto> reservationProductDtos = new ArrayList<>(); | ||
for (ReservationProduct reservationProduct : reservation.getReservationProducts()) { | ||
|
||
Room room = reservationProduct.getRoom(); | ||
Product product = room.getProduct(); | ||
|
||
reservationProductDtos.add( | ||
ReservationProductResponseDto.builder() | ||
.productName(product.getName()) | ||
.roomId(room.getId()) | ||
.roomName(room.getName()) | ||
.standard(room.getStandard()) | ||
.capacity(room.getCapacity()) | ||
.startDate(DateTimeUtil.toString(reservationProduct.getStartDate())) | ||
.endDate(DateTimeUtil.toString(reservationProduct.getEndDate())) | ||
.checkIn(DateTimeUtil.toString(room.getCheckIn())) | ||
.checkOut(DateTimeUtil.toString(room.getCheckOut())) | ||
.visitorName(reservationProduct.getVisitorName()) | ||
.visitorPhone(reservationProduct.getVisitorPhone()) | ||
.price(reservationProduct.getPrice()) | ||
.build() | ||
); | ||
} | ||
|
||
return SaveReservationResponseDto.builder() | ||
.reservationId(reservation.getId()) | ||
.reservationProducts(reservationProductDtos) | ||
.payMethod(reservation.getPayMethod()) | ||
.totalPrice(reservation.getTotalPrice()) | ||
.createdAt(DateTimeUtil.toString(reservation.getCreatedAt())) | ||
.build(); | ||
} | ||
} |
15 changes: 2 additions & 13 deletions
15
...com/fc/shimpyo_be/domain/reservationproduct/dto/request/ReservationProductRequestDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.