Skip to content

Commit

Permalink
Merge pull request #120 from Shimpyo-House/feature/favorite
Browse files Browse the repository at this point in the history
refactor: 즐겨찾기 응답 시 isLast 필드 제외
  • Loading branch information
JeongUijeong authored Dec 13, 2023
2 parents ddd8b08 + 9d228d6 commit a6405db
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@
public class FavoritesResponseDto {

private int pageCount;
private Boolean isLast;
private List<ProductResponse> products;

@Builder
public FavoritesResponseDto(int pageCount, Boolean isLast, List<ProductResponse> products) {
public FavoritesResponseDto(int pageCount, List<ProductResponse> products) {
this.pageCount = pageCount;
this.isLast = isLast;
this.products = products;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public FavoritesResponseDto getFavorites(long memberId, Pageable pageable) {
}
return FavoritesResponseDto.builder()
.pageCount(favorites.getTotalPages())
.isLast(favorites.isLast())
.products(productResponses)
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ void getFavorites() throws Exception {
// given
FavoritesResponseDto favoritesResponseDto = FavoritesResponseDto.builder()
.pageCount(10)
.isLast(true)
.products(List.of(ProductResponse.builder()
.productId(1L)
.productName("OO 호텔")
Expand Down Expand Up @@ -103,8 +102,6 @@ void getFavorites() throws Exception {
fieldWithPath("data").type(JsonFieldType.OBJECT).description("응답 데이터"),
fieldWithPath("data.pageCount").type(JsonFieldType.NUMBER)
.description("총 페이지 개수"),
fieldWithPath("data.isLast").type(JsonFieldType.BOOLEAN)
.description("마지막 페이지 여부"),
fieldWithPath("data.products").type(JsonFieldType.ARRAY)
.description("숙소 응답 데이터 배열"),
fieldWithPath("data.products[].productId").type(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ void _willSuccess() throws Exception {
// given
FavoritesResponseDto favoritesResponseDto = FavoritesResponseDto.builder()
.pageCount(10)
.isLast(true)
.products(List.of(ProductResponse.builder()
.productId(1L)
.productName("OO 호텔")
Expand Down Expand Up @@ -130,7 +129,6 @@ void _willSuccess() throws Exception {
.andExpect(jsonPath("$.message").isString())
.andExpect(jsonPath("$.data").isMap())
.andExpect(jsonPath("$.data.pageCount").isNumber())
.andExpect(jsonPath("$.data.isLast").isBoolean())
.andExpect(jsonPath("$.data.products[0].productId").isNumber())
.andExpect(jsonPath("$.data.products[0].productName").isString())
.andExpect(jsonPath("$.data.products[0].category").isString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ void _willSuccess() {
// then
assertThat(result.isEmpty()).isFalse();
assertThat(result.getTotalPages()).isEqualTo(1);
assertThat(result.isLast()).isTrue();
assertThat(result.get().toList().get(0).getId()).isNotNull();
assertThat(result.get().toList().get(0).getMember().getId()).isEqualTo(member.getId());
assertThat(result.get().toList().get(0).getProduct().getId()).isEqualTo(
Expand Down

0 comments on commit a6405db

Please sign in to comment.