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

File:
1 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()));
Note: See TracChangeset for help on using the changeset viewer.