Skip to content

Commit

Permalink
Merge pull request #166 from nhnacademy-be5-T3Team/feature/book_crud
Browse files Browse the repository at this point in the history
Feature/book crud
  • Loading branch information
Yujin-nKim authored May 10, 2024
2 parents bac99e2 + 20d7de1 commit 22da8f5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public class BookRegisterRequest {
private List<MultipartFile> bookImageList; // 도서 미리보기 이미지

@Size(max = 10, message = "최대 10개의 카테고리를 선택할 수 있습니다.")
@NotEmpty(message = "카테고리를 선택해주세요.")
private List<Integer> categoryList; // 카테고리 id 리스트

@Size(max = 10, message = "최대 10개의 태그를 선택할 수 있습니다.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.querydsl.core.types.dsl.BooleanExpression;
import com.querydsl.jpa.impl.JPAQueryFactory;
import com.t3t.bookstoreapi.book.enums.TableStatus;
import com.t3t.bookstoreapi.book.exception.BookNotFoundException;
import com.t3t.bookstoreapi.book.model.dto.CategoryDto;
import com.t3t.bookstoreapi.book.model.dto.ParticipantRoleRegistrationDto;
import com.t3t.bookstoreapi.book.model.dto.ParticipantRoleRegistrationDtoByBookId;
Expand Down Expand Up @@ -82,9 +83,13 @@ public BookDetailResponse getBookDetailsById(Long bookId) {
book.bookPackage.as("packagingAvailableStatus")))
.from(book)
.leftJoin(bookThumbnail).on(book.bookId.eq(bookThumbnail.book.bookId))
.where(book.bookId.eq(bookId))
.where(book.bookId.eq(bookId).and(book.isDeleted.eq(TableStatus.FALSE)))
.fetchOne();

if (bookDetailResponse == null) {
throw new BookNotFoundException();
}

bookDetailResponse.setBookImageUrlList(getBookImageDtoListById(bookId));
bookDetailResponse.setTagList(getBookTagDtoListById(bookId));
bookDetailResponse.setCategoryList(getBookCategoryDtoListById(bookId));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,6 @@ public BookDetailResponse getBookDetailsById(Long bookId) {

BookDetailResponse bookDetails = bookRepository.getBookDetailsById(bookId);

// 존재하지 않는 도서의 식별자로 조회시 예외 발생
if(bookDetails == null) {
throw new BookNotFoundForIdException(bookId);
}

bookDetails.setImageUrlPrefix(objectStorageProperties.getStorageUrl()+"/t3team/");
bookDetails.setDiscountedPrice();
bookDetails.setBookStock();
Expand Down

0 comments on commit 22da8f5

Please sign in to comment.