diff --git a/src/main/java/com/zerozero/review/application/ReadStoreReviewUseCase.java b/src/main/java/com/zerozero/review/application/ReadStoreReviewUseCase.java index 087eba4..c815580 100644 --- a/src/main/java/com/zerozero/review/application/ReadStoreReviewUseCase.java +++ b/src/main/java/com/zerozero/review/application/ReadStoreReviewUseCase.java @@ -8,9 +8,11 @@ import com.zerozero.core.domain.infra.repository.ReviewJPARepository; import com.zerozero.core.domain.infra.repository.ReviewLikeJPARepository; import com.zerozero.core.domain.infra.repository.UserJPARepository; +import com.zerozero.core.domain.vo.AccessToken; import com.zerozero.core.domain.vo.User; import com.zerozero.core.exception.DomainException; import com.zerozero.core.exception.error.BaseErrorCode; +import com.zerozero.core.util.JwtUtil; import com.zerozero.review.application.ReadStoreReviewUseCase.ReadStoreReviewRequest; import com.zerozero.review.application.ReadStoreReviewUseCase.ReadStoreReviewResponse; import java.util.Arrays; @@ -43,14 +45,25 @@ public class ReadStoreReviewUseCase implements BaseUseCase reviews = reviewJPARepository.findAllByStoreIdAndDeleted(request.getStoreId(), false); List reviewsCount = reviews.stream() .map(review -> reviewLikeJPARepository.countByReviewId(review.getId())) @@ -74,7 +87,8 @@ private ReadStoreReviewResponse.Review[] convertReviewResponse(com.zerozero.core @Getter @RequiredArgsConstructor public enum ReadStoreReviewErrorCode implements BaseErrorCode { - NOT_EXIST_REQUEST_CONDITION(HttpStatus.BAD_REQUEST, "요청 조건이 올바르지 않습니다."); + NOT_EXIST_REQUEST_CONDITION(HttpStatus.BAD_REQUEST, "요청 조건이 올바르지 않습니다."), + EXPIRED_TOKEN(HttpStatus.UNAUTHORIZED, "만료된 토큰입니다."); private final HttpStatus httpStatus; @@ -122,9 +136,11 @@ public static class ReadStoreReviewRequest implements BaseRequest { private Filter filter; + private AccessToken accessToken; + @Override public boolean isValid() { - return storeId != null; + return storeId != null && accessToken != null; } } diff --git a/src/main/java/com/zerozero/store/presentation/ReadStoreInfoController.java b/src/main/java/com/zerozero/store/presentation/ReadStoreInfoController.java index 8520052..7062180 100644 --- a/src/main/java/com/zerozero/store/presentation/ReadStoreInfoController.java +++ b/src/main/java/com/zerozero/store/presentation/ReadStoreInfoController.java @@ -72,6 +72,7 @@ public ResponseEntity readStoreInfo(@ParameterObject Read ReadStoreReviewResponse readStoreReviewResponse = readStoreReviewUseCase.execute(ReadStoreReviewRequest.builder() .storeId(request.getStoreId()) .filter(request.getFilter()) + .accessToken(accessToken) .build()); if (readStoreReviewResponse == null || !readStoreReviewResponse.isSuccess()) { Optional.ofNullable(readStoreReviewResponse)