Skip to content

Commit

Permalink
#25 refactor: 로직 개선
Browse files Browse the repository at this point in the history
  • Loading branch information
wjdwlghks committed May 3, 2024
1 parent eed6458 commit 7373146
Showing 1 changed file with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,9 @@ public void createContent(String userId, ContentCreateRequest request, Long club
() -> new MemberException(MEMBER_NOT_FOUND)
);

Book book;
if (bookRepository.findBookByIsbn(request.addBookRequest().isbn()).isEmpty()) {
book = bookRepository.save(new Book(request.addBookRequest()));
}
else {
book = bookRepository.findBookByIsbn(request.addBookRequest().isbn()).orElseThrow(
() -> new BookException(BOOK_NOT_FOUND)
);
}
Book book = bookRepository.findBookByIsbn(request.addBookRequest().isbn()).orElseGet(
() -> bookRepository.save(new Book(request.addBookRequest()))
);

Club club;
if (clubId == null) {
Expand Down

0 comments on commit 7373146

Please sign in to comment.