Ignore:
Timestamp:
01/18/22 17:18:17 (3 years ago)
Author:
Test <matonikolov77@…>
Branches:
main
Children:
e0ef1b1
Parents:
7fafead
Message:

Model-database resolved bugs for mapping

File:
1 edited

Legend:

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

    r7fafead r3ded84d  
    22
    33import com.wediscussmovies.project.model.*;
    4 import com.wediscussmovies.project.model.enumerations.DiscussionType;
     4
    55import com.wediscussmovies.project.service.DiscussionService;
    66import com.wediscussmovies.project.service.MovieService;
     
    1414import java.sql.Date;
    1515import java.time.LocalDate;
    16 import java.util.ArrayList;
    1716import java.util.List;
    1817import java.util.Optional;
     
    8079        if(discussion.isEmpty())
    8180            return "redirect:/discussions";
    82         Reply reply = new Reply(discussion.get(), user, date, text);
    83         replyService.save(reply);
     81        //Reply reply = new Reply(discussion.get(), user, date, text);
     82       // replyService.save(reply);
    8483        return "redirect:/discussions/"+id;
    8584    }
     
    103102            return "redirect:/login";
    104103        }
    105         Long movie_id = (Long) request.getSession().getAttribute("movieId");
     104        Integer movie_id = (Integer) request.getSession().getAttribute("movieId");
    106105        request.getSession().setAttribute("movieId", null);
    107106        Optional<Movie> movieOp = movieService.findById(movie_id);
    108107        if(movieOp.isEmpty())
    109108            return "redirect:/movies";
    110         Discussion discussion = new Discussion(DiscussionType.M,text, title, Date.valueOf(LocalDate.now()),user,movieOp.get(),null,new ArrayList<>());
    111         discussionService.save(discussion);
     109      //  Discussion discussion = new Discussion('M',text, title, Date.valueOf(LocalDate.now()),user,movieOp.get(),null);
     110       // discussionService.save(discussion);
    112111        return "redirect:/discussions";
    113112    }
     
    137136        if(personOp.isEmpty())
    138137            return "redirect:/discussions";
    139         Discussion discussion = new Discussion(DiscussionType.P,title, text,Date.valueOf(LocalDate.now()),user,null,personOp.get(),new ArrayList<>());
    140         discussionService.save(discussion);
     138
     139      //  Discussion discussion = new Discussion('P',title, text,Date.valueOf(LocalDate.now()),user,null,personOp.get());
     140      //  discussionService.save(discussion);
    141141        return "redirect:/discussions";
    142142    }
Note: See TracChangeset for help on using the changeset viewer.