Ignore:
Timestamp:
02/09/22 15:46:58 (3 years ago)
Author:
Test <matonikolov77@…>
Branches:
main
Children:
8f1b7e9
Parents:
967b414
Message:

Refactored reply repository and discussion repository

Location:
src/main/java/com/wediscussmovies/project/web/controller
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/com/wediscussmovies/project/web/controller/DiscussionController.java

    r967b414 r6f91f99  
    66import com.wediscussmovies.project.model.User;
    77import com.wediscussmovies.project.model.relation.DiscussionLikes;
     8import com.wediscussmovies.project.querymodels.DiscussionLikesQM;
    89import com.wediscussmovies.project.service.DiscussionService;
    910import com.wediscussmovies.project.service.MovieService;
     
    6263        try {
    6364            Discussion disc = discussionService.findById(id);
     65            disc.setLikes(discussionService.findLikesForDiscussionWithId(disc.getDiscussionId()).getLikes());
    6466            model.addAttribute("disc", disc);
    6567            model.addAttribute("contentTemplate", "discussion");
    66             model.addAttribute("user",LoggedUser.getLoggedUser());
    6768            model.addAttribute("replies",this.replyService.findAllByDiscussion(disc));
    68             addModelPropertiesLikes(model, disc, null);
    6969            addModelPropertiesForUser(model);
    7070
     
    183183    }
    184184    private void addModelPropertiesLikes(Model model, Discussion discussion, List<Discussion> discussions){
     185        // ispagja kompliciran kod vaka, podobro da dodademe i svojstvo u diskusijata i koga ke se dodade lajk
     186        // soodvetno da se zgoleme i obratno
    185187        if(discussion==null){
    186             List<com.wediscussmovies.project.querymodels.DiscussionLikes> discussionLikes = new ArrayList<>();
     188            List<DiscussionLikesQM> discussionLikes = new ArrayList<>();
    187189            for(Discussion d: discussions){
    188190                discussionLikes.add(discussionService.findLikesForDiscussionWithId(d.getDiscussionId()));
  • src/main/java/com/wediscussmovies/project/web/controller/GenreController.java

    r967b414 r6f91f99  
    55import com.wediscussmovies.project.model.User;
    66import com.wediscussmovies.project.model.relation.UserGenres;
    7 import com.wediscussmovies.project.querymodels.GenreLikes;
    87import com.wediscussmovies.project.repository.GenreLikesRepository;
    98import com.wediscussmovies.project.service.GenreService;
Note: See TracChangeset for help on using the changeset viewer.