diff --git a/src/main/java/com/dailyon/auctionservice/document/AuctionHistory.java b/src/main/java/com/dailyon/auctionservice/document/AuctionHistory.java index 5ce3ae5..5e92026 100644 --- a/src/main/java/com/dailyon/auctionservice/document/AuctionHistory.java +++ b/src/main/java/com/dailyon/auctionservice/document/AuctionHistory.java @@ -31,6 +31,9 @@ public class AuctionHistory implements Comparable { ) private String auctionId; + @DynamoDBAttribute(attributeName = "auction_name") + private String auctionName; + @DynamoDBAttribute(attributeName = "auction_product_id") private Long auctionProductId; @@ -77,6 +80,7 @@ public class AuctionHistory implements Comparable { public static AuctionHistory create( String memberId, String auctionId, + String auctionName, Long auctionProductId, String auctionProductImg, String auctionProductName, @@ -90,6 +94,7 @@ public static AuctionHistory create( return AuctionHistory.builder() .memberId(memberId) .auctionId(auctionId) + .auctionName(auctionName) .auctionProductId(auctionProductId) .auctionProductImg(auctionProductImg) .auctionProductName(auctionProductName) diff --git a/src/main/java/com/dailyon/auctionservice/dto/response/ReadAuctionHistoryPageResponse.java b/src/main/java/com/dailyon/auctionservice/dto/response/ReadAuctionHistoryPageResponse.java index 872756c..10c928e 100644 --- a/src/main/java/com/dailyon/auctionservice/dto/response/ReadAuctionHistoryPageResponse.java +++ b/src/main/java/com/dailyon/auctionservice/dto/response/ReadAuctionHistoryPageResponse.java @@ -8,7 +8,6 @@ import org.springframework.data.domain.Page; import java.util.List; -import java.util.stream.Collectors; @Getter @Builder @@ -17,51 +16,13 @@ public class ReadAuctionHistoryPageResponse { private long totalElements; private int totalPages; - private List responses; + private List responses; public static ReadAuctionHistoryPageResponse of(Page histories) { return ReadAuctionHistoryPageResponse.builder() .totalPages(histories.getTotalPages()) .totalPages(histories.getTotalPages()) - .responses(histories.stream() - .map(ReadAuctionHistoryResponse::of) - .collect(Collectors.toList())) + .responses(histories.toList()) .build(); } - - @Getter - @Builder - @NoArgsConstructor - @AllArgsConstructor - public static class ReadAuctionHistoryResponse { - private String id; - private String auctionId; - private Long auctionProductId; - private String auctionProductImg; - private String auctionProductName; - private Long auctionProductSizeId; - private String auctionProductSizeName; - private boolean isWinner; - private boolean isPaid; - private Long amountToPay; - private Long memberHighestBid; - private Long auctionWinnerBid; - - public static ReadAuctionHistoryResponse of(AuctionHistory auctionHistory) { - return ReadAuctionHistoryResponse.builder() - .id(auctionHistory.getId()) - .auctionId(auctionHistory.getAuctionId()) - .auctionProductId(auctionHistory.getAuctionProductId()) - .auctionProductImg(auctionHistory.getAuctionProductImg()) - .auctionProductName(auctionHistory.getAuctionProductName()) - .auctionProductSizeId(auctionHistory.getAuctionProductSizeId()) - .auctionProductSizeName(auctionHistory.getAuctionProductSizeName()) - .isWinner(auctionHistory.isWinner()) - .isPaid(auctionHistory.isPaid()) - .amountToPay(auctionHistory.getAmountToPay()) - .memberHighestBid(auctionHistory.getMemberHighestBid()) - .auctionWinnerBid(auctionHistory.getAuctionWinnerBid()) - .build(); - } - } } diff --git a/src/test/java/com/dailyon/auctionservice/repository/AuctionHistoryRepositoryTests.java b/src/test/java/com/dailyon/auctionservice/repository/AuctionHistoryRepositoryTests.java index 9c85a83..2257554 100644 --- a/src/test/java/com/dailyon/auctionservice/repository/AuctionHistoryRepositoryTests.java +++ b/src/test/java/com/dailyon/auctionservice/repository/AuctionHistoryRepositoryTests.java @@ -53,6 +53,7 @@ void auctionHistoryCreateTest() { AuctionHistory history = AuctionHistory.create( "1", "TEST", + "", 1L, "img.png", "name", @@ -72,23 +73,23 @@ void auctionHistoryCreateTest() { void findAuctionHistoryListTests() { List histories = List.of( AuctionHistory.create( - "1", "TEST", 1L, "img.png", "name", 1L, + "1", "TEST", "", 1L, "img.png", "name", 1L, "size", true, 10000L, 1000L, 1000L ), AuctionHistory.create( - "1", "TEST2", 2L, "img.png", "name", 1L, + "1", "TEST2", "",2L, "img.png", "name", 1L, "size", false, 0L, 100L, 10000L ), AuctionHistory.create( - "1", "TEST3", 3L, "img.png", "name", 1L, + "1", "TEST3", "",3L, "img.png", "name", 1L, "size", false, 0L, 1000L, 10000L ), AuctionHistory.create( - "2", "TEST", 1L, "img.png", "name", 1L, + "2", "TEST", "",1L, "img.png", "name", 1L, "size", true, 10000L, 1000L, 1000L ), AuctionHistory.create( - "2", "TEST2", 2L, "img.png", "name", 1L, + "2", "TEST2", "",2L, "img.png", "name", 1L, "size", false, 0L, 100L, 10000L ) );