Skip to content

Commit

Permalink
fix : #39 모델적합도 다중반환 버그 수정 (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
j2noo authored Mar 9, 2024
1 parent 5857747 commit ccee0d6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,7 @@ public interface ProductModelRepository extends JpaRepository<ProductModel, Long
+ "ORDER BY p.searchTime DESC")
List<RecentModelResponse> getRecentModels(@Param("productId") Long productId);

Optional<ProductModel> findByProductAndModel(Product product, Model model);
// Optional<ProductModel> findByProductAndModel(Product product, Model model);
ProductModel findTopByProductAndModelOrderByIdDesc(Product product, Model model);

}
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,8 @@ public ModelFitnessResponse getModelFitness(ModelFitnessRequest request) {
Product product = productRepository.findById(request.productId())
.orElseThrow(() -> new NotFoundUserException("해당 Product를 찾을 수 없습니다")); //커스텀에러

ProductModel productModel = productModelRepository.findByProductAndModel(product, model)
.orElseThrow(() -> new NotFoundUserException(
String.format("product : %d, model : %s의 상품모델을 찾을 수 없습니다", product.getId(), model.getModelName())
)
); //커스텀에러
ProductModel productModel = productModelRepository.findTopByProductAndModelOrderByIdDesc(product, model);


ModelFitness modelFitness = modelFitnessRepository.findById(productModel.getId())
.orElseThrow(() -> new NotFoundUserException("모델적합도를 찾을수없습니다")); //커스텀에러
Expand Down

0 comments on commit ccee0d6

Please sign in to comment.