Ignore:
Timestamp:
02/10/22 13:28:00 (3 years ago)
Author:
Test <matonikolov77@…>
Branches:
main
Children:
980eeda
Parents:
6f91f99
Message:

Changed DiscussionRepository and DiscussionServiceImpl for fetching likes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/com/wediscussmovies/project/repository/DiscussionRepository.java

    r6f91f99 r8f1b7e9  
    1919     List<Discussion> findAllByPerson (Person person);
    2020
    21      @Query(value = "select new com.wediscussmovies.project.querymodels.DiscussionLikesQM(d.discussionId, count(dl.id.userId)) from Discussion d" +
     21     @Query(value = "select new com.wediscussmovies.project.querymodels.DiscussionLikesQM(d.discussionId, count (dl.user) ) from Discussion d" +
    2222             " left join DiscussionLikes dl on dl.id.discussionId = d.discussionId" +
    23              " where :discussionId = d.discussionId" +
    24              " group by d.discussionId"+
    25              " order by count(dl.id.userId) desc")
     23             " where :id = d.discussionId" +
     24             " group by d.discussionId")
    2625     @Transactional
    27      DiscussionLikesQM findDiscussionWithLikes(@Param("discussionId") Integer discussionId);
     26     DiscussionLikesQM findDiscussionWithLikes(@Param("id") Integer discussionId);
    2827
    29      @Query(value = "select new com.wediscussmovies.project.querymodels.DiscussionLikesQM(d.discussionId, count(dl.id.userId)) from Discussion d" +
     28     @Query(value = "select new com.wediscussmovies.project.querymodels.DiscussionLikesQM (d.discussionId, count(dl.user)) from Discussion d" +
    3029             " left join DiscussionLikes dl on dl.id.discussionId = d.discussionId" +
    3130             " group by d.discussionId"+
    32              " order by count(dl.id.userId) desc")
     31               " order by d.discussionId asc")
    3332     @Transactional
    34      List<DiscussionLikesQM> findAllDiscussionsWithLikes();
     33     List<DiscussionLikesQM
     34             > findAllDiscussionsWithLikes();
    3535}
Note: See TracChangeset for help on using the changeset viewer.