Skip to content

Commit 937b30e

Browse files
authored
Merge pull request #92 from Decodeat/fix/81-user-based
.
2 parents b7de423 + c5c04d6 commit 937b30e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/main/java/com/DecodEat/domain/products/repository/ProductRepository.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Slice<Product> findCompletedProductsByCursor(@Param("cursorId") Long cursorId,
3030
Page<Product> findByUserId(Long userId, Pageable pageable);
3131

3232
@Query(value = "SELECT p.product_id FROM product p JOIN user_behavior ub ON p.product_id = ub.product_id WHERE ub.user_id = :userId AND ub.behavior = :behavior ORDER BY RAND() LIMIT 1", nativeQuery = true)
33-
Optional<Long> findRandomProductIdByUserIdAndBehavior(@Param("userId") Long userId, @Param("behavior") Behavior behavior);
33+
Optional<Long> findRandomProductIdByUserIdAndBehavior(@Param("userId") Long userId, @Param("behavior") String behavior);
3434

3535
@Query("SELECT pl.product FROM ProductLike pl WHERE pl.user.id = :userId")
3636
Page<Product> findLikedProductsByUserId(@Param("userId") Long userId, Pageable pageable);

src/main/java/com/DecodEat/domain/products/service/ProductService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ public UserBasedRecommendationResponseDto getUserBasedRecommendation(User user)
245245

246246
}
247247

248-
Long standardProductId = productRepository.findRandomProductIdByUserIdAndBehavior(userId,selectedBehavior)
248+
Long standardProductId = productRepository.findRandomProductIdByUserIdAndBehavior(userId,selectedBehavior.name())
249249
.orElseThrow(()-> new GeneralException(NO_USER_BEHAVIOR_EXISTED));
250250
Product standardProduct = productRepository.findById(standardProductId).orElseThrow(()->new GeneralException(NO_RESULT));
251251

0 commit comments

Comments
 (0)