Index: src/main/java/com/wediscussmovies/project/repository/DiscussionLikesRepository.java
===================================================================
--- src/main/java/com/wediscussmovies/project/repository/DiscussionLikesRepository.java	(revision c02189fa25621ce1d654581cba8f42042572979c)
+++ src/main/java/com/wediscussmovies/project/repository/DiscussionLikesRepository.java	(revision c02189fa25621ce1d654581cba8f42042572979c)
@@ -0,0 +1,17 @@
+package com.wediscussmovies.project.repository;
+
+import com.wediscussmovies.project.model.User;
+import com.wediscussmovies.project.model.primarykeys.DiscussionLikesPK;
+import com.wediscussmovies.project.model.primarykeys.UserGenresPK;
+import com.wediscussmovies.project.model.relation.DiscussionLikes;
+import com.wediscussmovies.project.model.relation.MovieLikes;
+import com.wediscussmovies.project.model.relation.UserGenres;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface DiscussionLikesRepository extends JpaRepository<DiscussionLikes, DiscussionLikesPK> {
+    List<DiscussionLikes> findAllByUser(User user);
+}
Index: src/main/java/com/wediscussmovies/project/repository/DiscussionRepository.java
===================================================================
--- src/main/java/com/wediscussmovies/project/repository/DiscussionRepository.java	(revision 3c0f9a97ce7897bbdf19cc016cc2edaede3e204c)
+++ src/main/java/com/wediscussmovies/project/repository/DiscussionRepository.java	(revision c02189fa25621ce1d654581cba8f42042572979c)
@@ -4,7 +4,11 @@
 import com.wediscussmovies.project.model.Movie;
 import com.wediscussmovies.project.model.Person;
+import com.wediscussmovies.project.querymodels.DiscussionLikes;
+import com.wediscussmovies.project.querymodels.GenreLikes;
 import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
 import org.springframework.stereotype.Repository;
 
+import javax.transaction.Transactional;
 import java.util.List;
 
@@ -14,3 +18,10 @@
      List<Discussion> findAllByMovie(Movie movie);
      List<Discussion> findAllByPerson (Person person);
+
+     @Query(value = "select new com.wediscussmovies.project.querymodels.DiscussionLikes(d.discussionId, count(dl.id.userId)) from Discussion d" +
+             " left join DiscussionLikes dl on dl.id.discussionId = d.discussionId" +
+             " group by d.discussionId" +
+             " order by count(dl.id.userId) desc")
+     @Transactional
+     List<DiscussionLikes> findAllWithLikes();
 }
Index: src/main/java/com/wediscussmovies/project/repository/GenreRepository.java
===================================================================
--- src/main/java/com/wediscussmovies/project/repository/GenreRepository.java	(revision 3c0f9a97ce7897bbdf19cc016cc2edaede3e204c)
+++ src/main/java/com/wediscussmovies/project/repository/GenreRepository.java	(revision c02189fa25621ce1d654581cba8f42042572979c)
@@ -28,3 +28,7 @@
      @Transactional
      void insertInto(@Param("user_id")Integer userId, @Param("genre_id")Integer genreId);
+
+     @Query(value = "select new com.wediscussmovies.project.model.Genre (g.genreId, g.genreType) from Genre g" +
+     " ORDER BY g.genreType DESC")
+     List<Genre> findAllSorted();
 }
Index: src/main/java/com/wediscussmovies/project/repository/MovieRepository.java
===================================================================
--- src/main/java/com/wediscussmovies/project/repository/MovieRepository.java	(revision 3c0f9a97ce7897bbdf19cc016cc2edaede3e204c)
+++ src/main/java/com/wediscussmovies/project/repository/MovieRepository.java	(revision c02189fa25621ce1d654581cba8f42042572979c)
@@ -3,9 +3,14 @@
 import com.wediscussmovies.project.model.Movie;
 import com.wediscussmovies.project.model.Person;
+import com.wediscussmovies.project.querymodels.GenreLikes;
+import com.wediscussmovies.project.querymodels.MovieLikesQM;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
 import org.springframework.stereotype.Repository;
 
+import javax.transaction.Transactional;
 import java.util.List;
+import java.util.Optional;
 
 @Repository
@@ -16,3 +21,24 @@
      @Query(value="select m.movieId from Movie m")
      List<Integer> findAllMovieIds();
+
+     @Query(value="select new com.wediscussmovies.project.model.Movie(m.movieId, m.title, m.imdbRating, m.imageUrl) from Movie m" +
+               " where m.movieId = :index")
+     Optional<Movie> findBasicById(@Param("index")Integer index);
+
+
+     @Query(value = "select new com.wediscussmovies.project.querymodels.MovieLikesQM(m.movieId, count(ml.id.userId)) from Movie m" +
+             " left join MovieLikes ml on ml.id.movieId = m.movieId" +
+             " group by m.movieId" +
+             " order by count(ml.id.userId) desc")
+     @Transactional
+     List<MovieLikesQM> findAllWithLikes();
+
+     @Query(value = "select new com.wediscussmovies.project.querymodels.MovieLikesQM(m.movieId, count(ml.id.userId)) from Movie m" +
+             " left join MovieLikes ml on ml.id.movieId = m.movieId" +
+             " group by m.movieId" +
+             " having m.movieId = :id")
+     @Transactional
+     List<MovieLikesQM> findLikesForMovie(@Param("id") Integer movie_id);
+
+
 }
