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 @@ -80,6 +80,11 @@ public MyBookRes addMyBook(UUID memberId, MyBookReq dto) {
.build());
}

// 한 사용자가 책장에 같은 책을 중복으로 저장할 수 없음
if(myBookRepository.existsMyBookByMemberIdAndBook(memberId, book)) {
throw new BaseException(MY_BOOK_ALREADY_EXISTS);
}

MyBook myBook = MyBook.builder()
.memberId(memberId)
.book(book)
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/ikdaman/global/exception/ErrorCode.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public enum ErrorCode {
CONFLICT_NICKNAME(HttpStatus.CONFLICT.value(), 4090201, "사용중인 닉네임입니다."),
// MyBook(03)
NOT_FOUND_MY_BOOK(HttpStatus.NOT_FOUND.value(), 4040301,"해당 MyBook을 찾을 수 없습니다."),
MY_BOOK_ALREADY_EXISTS(HttpStatus.CONFLICT.value(), 4090302, "이미 책장에 추가된 책입니다."),
MY_BOOK_ALREADY_EXISTS(HttpStatus.CONFLICT.value(), 4090302, "이미 가지고 있는 책이에요!"),

// Notice(04)

Expand Down