Skip to content

Commit 3e55afc

Browse files
authored
Merge pull request #38 from Leafly-app/refact/#34
♻️ refact : 독후감 리스트 태그 반환 및 검색 버그 수정
2 parents 477bd2c + 7056043 commit 3e55afc

File tree

3 files changed

+29
-11
lines changed

3 files changed

+29
-11
lines changed

src/main/java/com/hansung/leafly/domain/book/service/BookServiceImpl.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,6 @@ public List<SearchRes> search(String keyword, BookFilterReq req, Member member)
4646
Set<Long> bookmarkedSet = new HashSet<>(bookmarkedIsbns);
4747

4848

49-
if (req == null || req.getGenres() == null || req.getGenres().isEmpty()) {
50-
return response.item().stream()
51-
.map(item -> SearchRes.from(
52-
item,
53-
bookmarkedSet.contains(Long.parseLong(item.isbn13()))
54-
))
55-
.toList();
56-
}
57-
58-
List<BookGenre> filters = req.getGenres();
59-
6049
return response.item().stream()
6150
.filter(item -> item.isbn13() != null && !item.isbn13().isBlank()) // ISBN 없는 책 제외
6251
.map(item -> SearchRes.from(

src/main/java/com/hansung/leafly/domain/bookreview/web/dto/ReviewRes.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
22

33
import com.fasterxml.jackson.annotation.JsonFormat;
44
import com.hansung.leafly.domain.bookreview.entity.BookReview;
5+
import com.hansung.leafly.domain.bookreview.entity.BookTag;
56

67
import java.time.LocalDateTime;
8+
import java.util.List;
79

810
public record ReviewRes (
911
Long reviewId,
1012
String title,
1113
String thumbnail,
14+
List<String> tags,
1215
int rating,
1316
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm")
1417
LocalDateTime createAt
@@ -18,6 +21,9 @@ public static ReviewRes from(BookReview review) {
1821
review.getId(),
1922
review.getTitle(),
2023
review.getThumbnail(),
24+
review.getTags().stream()
25+
.map(BookTag::getTag)
26+
.toList(),
2127
review.getRating(),
2228
review.getCreatedAt()
2329
);
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.hansung.leafly.domain.book.service;
2+
3+
import org.junit.jupiter.api.DisplayName;
4+
import org.junit.jupiter.api.Test;
5+
import org.springframework.beans.factory.annotation.Autowired;
6+
import org.springframework.boot.test.context.SpringBootTest;
7+
import org.springframework.transaction.annotation.Transactional;
8+
9+
import static org.junit.jupiter.api.Assertions.*;
10+
11+
@SpringBootTest
12+
@Transactional
13+
class BookServiceImplTest {
14+
15+
@Autowired
16+
private BookService bookService;
17+
18+
@Test
19+
@DisplayName("검색 테스트")
20+
void search() {
21+
// bookService.search("", null, )
22+
}
23+
}

0 commit comments

Comments
 (0)