Interface ReviewRepository

All Superinterfaces:
org.springframework.data.repository.CrudRepository<Review,Long>, org.springframework.data.repository.Repository<Review,Long>

@Repository public interface ReviewRepository extends org.springframework.data.repository.CrudRepository<Review,Long>
The ReviewRepository is a repository for Review entities
  • Method Details

    • findByReviewer

      Iterable<Review> findByReviewer(User user)
      Parameters:
      user -
      Returns:
      all reviews that have come from a single reviewer, ex say this user has made a few reviews over the past year well then this method will return only the reviews that this user has sent
    • findByStatus

      Iterable<Review> findByStatus(ModerationStatus moderationStatus)
    • findByItemAndStatus

      Iterable<Review> findByItemAndStatus(MenuItem item, ModerationStatus approved)
    • countByStatus

      @Query("SELECT COUNT(r) FROM reviews r WHERE r.status = :status") long countByStatus(@Param("status") ModerationStatus status)
    • countDistinctItemsByStatus

      @Query("SELECT COUNT(DISTINCT r.item.id) FROM reviews r WHERE r.status = :status") long countDistinctItemsByStatus(@Param("status") ModerationStatus status)
    • countDistinctCommonsByStatus

      @Query("SELECT COUNT(DISTINCT r.item.diningCommonsCode) FROM reviews r WHERE r.status = :status") long countDistinctCommonsByStatus(@Param("status") ModerationStatus status)
    • findMaxDateEditedByStatus

      @Query("SELECT MAX(r.dateEdited) FROM reviews r WHERE r.status = :status") LocalDateTime findMaxDateEditedByStatus(@Param("status") ModerationStatus status)