Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,6 @@ public List<SearchRes> search(String keyword, BookFilterReq req, Member member)
Set<Long> bookmarkedSet = new HashSet<>(bookmarkedIsbns);


if (req == null || req.getGenres() == null || req.getGenres().isEmpty()) {
return response.item().stream()
.map(item -> SearchRes.from(
item,
bookmarkedSet.contains(Long.parseLong(item.isbn13()))
))
.toList();
}

List<BookGenre> filters = req.getGenres();

return response.item().stream()
.filter(item -> item.isbn13() != null && !item.isbn13().isBlank()) // ISBN 없는 책 제외
.map(item -> SearchRes.from(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@

import com.fasterxml.jackson.annotation.JsonFormat;
import com.hansung.leafly.domain.bookreview.entity.BookReview;
import com.hansung.leafly.domain.bookreview.entity.BookTag;

import java.time.LocalDateTime;
import java.util.List;

public record ReviewRes (
Long reviewId,
String title,
String thumbnail,
List<String> tags,
int rating,
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm")
LocalDateTime createAt
Expand All @@ -18,6 +21,9 @@ public static ReviewRes from(BookReview review) {
review.getId(),
review.getTitle(),
review.getThumbnail(),
review.getTags().stream()
.map(BookTag::getTag)
.toList(),
review.getRating(),
review.getCreatedAt()
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.hansung.leafly.domain.book.service;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.transaction.annotation.Transactional;

import static org.junit.jupiter.api.Assertions.*;

@SpringBootTest
@Transactional
class BookServiceImplTest {

@Autowired
private BookService bookService;

@Test
@DisplayName("검색 테스트")
void search() {
// bookService.search("", null, )
}
}