Index: dea/libraries/Maven__com_jcraft_jsch_0_1_55.xml
===================================================================
--- .idea/libraries/Maven__com_jcraft_jsch_0_1_55.xml	(revision 2d57cad1a18953bc47becb4f96114a908ecbf03d)
+++ 	(revision )
@@ -1,13 +1,0 @@
-<component name="libraryTable">
-  <library name="Maven: com.jcraft:jsch:0.1.55">
-    <CLASSES>
-      <root url="jar://$MAVEN_REPOSITORY$/com/jcraft/jsch/0.1.55/jsch-0.1.55.jar!/" />
-    </CLASSES>
-    <JAVADOC>
-      <root url="jar://$MAVEN_REPOSITORY$/com/jcraft/jsch/0.1.55/jsch-0.1.55-javadoc.jar!/" />
-    </JAVADOC>
-    <SOURCES>
-      <root url="jar://$MAVEN_REPOSITORY$/com/jcraft/jsch/0.1.55/jsch-0.1.55-sources.jar!/" />
-    </SOURCES>
-  </library>
-</component>
Index: .idea/vcs.xml
===================================================================
--- .idea/vcs.xml	(revision 2d57cad1a18953bc47becb4f96114a908ecbf03d)
+++ .idea/vcs.xml	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -3,4 +3,5 @@
   <component name="VcsDirectoryMappings">
     <mapping directory="" vcs="Git" />
+    <mapping directory="$PROJECT_DIR$/WeDiscussMovies" vcs="Git" />
   </component>
 </project>
Index: README.md
===================================================================
--- README.md	(revision 2d57cad1a18953bc47becb4f96114a908ecbf03d)
+++ README.md	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -3,6 +3,6 @@
 <div style="float: left; width: 60%;">
 
-<img src="/img/logo.png" style="display: block; float:left; height: auto; width: 30%;" align="right">
-<h4 style="display: block; font-weight: normal; text-align: justify; float: right">Предмет: Бази на податоци 2021/2022/Зимски</h2><br>
+<img src="/img/logo.png" style="display: block; float:left; height: auto; width: 30%;" align="right" alt="q">
+<h4 style="display: block; font-weight: normal; text-align: justify; float: right">Предмет: Бази на податоци 2021/2022/Зимски</h4><br>
 <h4 style="display: block; font-weight: normal; text-align: justify; float: right">Под менторство на вонр. проф. д-р Вангел Ајановски и демонстр. м-р Ненад Анчев</h4><br>
 <h4 style="display: block; font-weight: normal; text-align: justify; float: right">Започнат: Ноември 2021</h4><br><br>
@@ -23,2 +23,3 @@
 	<li>Мартин Николов (193113)</li>
 </ol>
+</div>
Index: pom.xml
===================================================================
--- pom.xml	(revision 2d57cad1a18953bc47becb4f96114a908ecbf03d)
+++ pom.xml	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -42,5 +42,4 @@
             <groupId>org.postgresql</groupId>
             <artifactId>postgresql</artifactId>
-            <scope>runtime</scope>
         </dependency>
         <dependency>
@@ -72,13 +71,6 @@
             <artifactId>h2</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.postgresql</groupId>
-            <artifactId>postgresql</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.jcraft</groupId>
-            <artifactId>jsch</artifactId>
-            <version>0.1.55</version>
-        </dependency>
+
+
 
     </dependencies>
Index: project.iml
===================================================================
--- project.iml	(revision 2d57cad1a18953bc47becb4f96114a908ecbf03d)
+++ project.iml	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -138,5 +138,4 @@
     <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.6.2" level="project" />
     <orderEntry type="library" name="Maven: com.h2database:h2:1.4.200" level="project" />
-    <orderEntry type="library" name="Maven: com.jcraft:jsch:0.1.55" level="project" />
   </component>
 </module>
Index: src/main/java/com/wediscussmovies/project/exception/MovieIdNotFoundException.java
===================================================================
--- src/main/java/com/wediscussmovies/project/exception/MovieIdNotFoundException.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/exception/MovieIdNotFoundException.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -0,0 +1,7 @@
+package com.wediscussmovies.project.exception;
+
+public class MovieIdNotFoundException extends RuntimeException{
+    public MovieIdNotFoundException(Long id){
+        super("Movie with that id=" + id + " does not exist!");
+    }
+}
Index: src/main/java/com/wediscussmovies/project/model/Discussion.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/Discussion.java	(revision 2d57cad1a18953bc47becb4f96114a908ecbf03d)
+++ src/main/java/com/wediscussmovies/project/model/Discussion.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -1,176 +1,61 @@
 package com.wediscussmovies.project.model;
+
+import com.wediscussmovies.project.model.enumerations.DiscussionType;
+import lombok.Data;
 
 import javax.persistence.*;
 import java.sql.Date;
 import java.util.Collection;
+import java.util.List;
 import java.util.Objects;
 
+@Data
 @Entity
 @Table(name = "discussions", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
 public class Discussion {
+
     @GeneratedValue(strategy = GenerationType.IDENTITY)
     @Id
     @Column(name = "discussion_id")
-    private int discussionId;
-    @Basic
-    @Column(name = "type")
-    private String type;
-    @Basic
-    @Column(name = "text")
+    private Long id;
+
+    @Enumerated
+    private DiscussionType type;
+
     private String text;
-    @Basic
-    @Column(name = "title")
+
     private String title;
-    @Basic
-    @Column(name = "date")
+
     private Date date;
-    @Basic
-    @Column(name = "user_id")
-    private int userId;
-    @Basic
-    @Column(name = "movie_id")
-    private Integer movieId;
-    @Basic
-    @Column(name = "person_id")
-    private Integer personId;
+
+
+
+
 
     @ManyToOne
-    @JoinColumn(name = "user_id", referencedColumnName = "user_id", nullable = false,insertable = false, updatable = false)
-    private User usersByUserId;
+    @JoinColumn(name = "user_id", referencedColumnName = "user_id", nullable = false)
+    private User user;
+
     @ManyToOne
-    @JoinColumn(name = "movie_id", referencedColumnName = "movie_id",insertable = false, updatable = false)
-    private Movie moviesByMovieId;
+    @JoinColumn(name = "movie_id", referencedColumnName = "movie_id")
+    private Movie movie;
+
     @ManyToOne
-    @JoinColumn(name = "person_id", referencedColumnName = "person_id",insertable = false, updatable = false)
-    private Person personsByPersonId;
-    @OneToMany(mappedBy = "discussionsByDiscussionId")
-    private Collection<Reply> repliesByDiscussionId;
+    @JoinColumn(name = "person_id", referencedColumnName = "person_id")
+    private Person person;
 
-    public int getDiscussionId() {
-        return discussionId;
-    }
 
-    public void setDiscussionId(int discussionId) {
-        this.discussionId = discussionId;
-    }
 
-    public String getType() {
-        return type;
-    }
 
-    public void setType(String type) {
+
+
+    public Discussion(DiscussionType type, String text, String title, Date date, User user, Movie movie, Person person, List<Reply> replies) {
         this.type = type;
-    }
-
-    public String getText() {
-        return text;
-    }
-
-    public void setText(String text) {
         this.text = text;
-    }
-
-    public String getTitle() {
-        return title;
-    }
-
-    public void setTitle(String title) {
         this.title = title;
-    }
-
-    public Date getDate() {
-        return date;
-    }
-
-    public void setDate(Date date) {
         this.date = date;
-    }
-
-    public int getUserId() {
-        return userId;
-    }
-
-    public void setUserId(int userId) {
-        this.userId = userId;
-    }
-
-    public Integer getMovieId() {
-        return movieId;
-    }
-
-    public void setMovieId(Integer movieId) {
-        this.movieId = movieId;
-    }
-
-    public Integer getPersonId() {
-        return personId;
-    }
-
-    public void setPersonId(Integer personId) {
-        this.personId = personId;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
-
-        Discussion that = (Discussion) o;
-
-        if (discussionId != that.discussionId) return false;
-        if (userId != that.userId) return false;
-        if (!Objects.equals(type, that.type)) return false;
-        if (!Objects.equals(text, that.text)) return false;
-        if (!Objects.equals(title, that.title)) return false;
-        if (!Objects.equals(date, that.date)) return false;
-        if (!Objects.equals(movieId, that.movieId)) return false;
-        if (!Objects.equals(personId, that.personId)) return false;
-
-        return true;
-    }
-
-    @Override
-    public int hashCode() {
-        int result = discussionId;
-        result = 31 * result + (type != null ? type.hashCode() : 0);
-        result = 31 * result + (text != null ? text.hashCode() : 0);
-        result = 31 * result + (title != null ? title.hashCode() : 0);
-        result = 31 * result + (date != null ? date.hashCode() : 0);
-        result = 31 * result + userId;
-        result = 31 * result + (movieId != null ? movieId.hashCode() : 0);
-        result = 31 * result + (personId != null ? personId.hashCode() : 0);
-        return result;
-    }
-
-    public User getUsersByUserId() {
-        return usersByUserId;
-    }
-
-    public void setUsersByUserId(User usersByUserId) {
-        this.usersByUserId = usersByUserId;
-    }
-
-    public Movie getMoviesByMovieId() {
-        return moviesByMovieId;
-    }
-
-    public void setMoviesByMovieId(Movie moviesByMovieId) {
-        this.moviesByMovieId = moviesByMovieId;
-    }
-
-    public Person getPersonsByPersonId() {
-        return personsByPersonId;
-    }
-
-    public void setPersonsByPersonId(Person personsByPersonId) {
-        this.personsByPersonId = personsByPersonId;
-    }
-
-    public Collection<Reply> getRepliesByDiscussionId() {
-        return repliesByDiscussionId;
-    }
-
-    public void setRepliesByDiscussionId(Collection<Reply> repliesByDiscussionId) {
-        this.repliesByDiscussionId = repliesByDiscussionId;
+        this.user = user;
+        this.movie = movie;
+        this.person = person;
     }
 
@@ -178,12 +63,4 @@
     }
 
-    public Discussion(String type, String text, String title, Date date, int userId, Integer movieId, Integer personId) {
-        this.type = type;
-        this.text = text;
-        this.title = title;
-        this.date = date;
-        this.userId = userId;
-        this.movieId = movieId;
-        this.personId = personId;
-    }
+
 }
Index: src/main/java/com/wediscussmovies/project/model/DiscussionType.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/DiscussionType.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/model/DiscussionType.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -0,0 +1,5 @@
+package com.wediscussmovies.project.model;
+
+public enum DiscussionType {
+    M,P
+}
Index: src/main/java/com/wediscussmovies/project/model/Genre.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/Genre.java	(revision 2d57cad1a18953bc47becb4f96114a908ecbf03d)
+++ src/main/java/com/wediscussmovies/project/model/Genre.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -1,79 +1,29 @@
 package com.wediscussmovies.project.model;
+
 
 import javax.persistence.*;
 import java.util.Collection;
+import lombok.Data;
+
 
 @Entity
 @Table(name = "genres", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
+@Data
 public class Genre {
+
     @GeneratedValue(strategy = GenerationType.IDENTITY)
     @Id
     @Column(name = "genre_id")
-    private int genreId;
-    @Basic
+    private Long id;
+
     @Column(name = "genre_type")
-    private String genreType;
-    @OneToMany(mappedBy = "genresByGenreId")
-    private Collection<MovieGenresEntity> movieGenresByGenreId;
-    @OneToMany(mappedBy = "genresByGenreId")
-    private Collection<UserGenresEntity> userGenresByGenreId;
+    private String genre;
 
-    public int getGenreId() {
-        return genreId;
-    }
-
-    public void setGenreId(int genreId) {
-        this.genreId = genreId;
-    }
-
-    public String getGenreType() {
-        return genreType;
-    }
-
-    public void setGenreType(String genreType) {
-        this.genreType = genreType;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
-
-        Genre that = (Genre) o;
-
-        if (genreId != that.genreId) return false;
-        if (genreType != null ? !genreType.equals(that.genreType) : that.genreType != null) return false;
-
-        return true;
-    }
-
-    @Override
-    public int hashCode() {
-        int result = genreId;
-        result = 31 * result + (genreType != null ? genreType.hashCode() : 0);
-        return result;
-    }
-
-    public Collection<MovieGenresEntity> getMovieGenresByGenreId() {
-        return movieGenresByGenreId;
-    }
-
-    public void setMovieGenresByGenreId(Collection<MovieGenresEntity> movieGenresByGenreId) {
-        this.movieGenresByGenreId = movieGenresByGenreId;
-    }
-
-    public Collection<UserGenresEntity> getUserGenresByGenreId() {
-        return userGenresByGenreId;
-    }
-
-    public void setUserGenresByGenreId(Collection<UserGenresEntity> userGenresByGenreId) {
-        this.userGenresByGenreId = userGenresByGenreId;
-    }
-
-    public Genre(String genreType) {
-        this.genreType = genreType;
+    public Genre(String genre) {
+        this.genre = genre;
     }
 
     public Genre() {
     }
+
 }
Index: src/main/java/com/wediscussmovies/project/model/Movie.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/Movie.java	(revision 2d57cad1a18953bc47becb4f96114a908ecbf03d)
+++ src/main/java/com/wediscussmovies/project/model/Movie.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -1,129 +1,93 @@
 package com.wediscussmovies.project.model;
+
+import lombok.Data;
 
 import javax.persistence.*;
 import java.sql.Date;
 import java.util.Collection;
+import java.util.Comparator;
+import java.util.List;
 import java.util.Objects;
+
 
 @Entity
 @Table(name = "movies", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
+@Data
 public class Movie {
+
     @GeneratedValue(strategy = GenerationType.IDENTITY)
     @Id
     @Column(name = "movie_id")
-    private int movieId;
-    @Basic
-    @Column(name = "title")
+    private Long id;
+
     private String title;
-    @Basic
-    @Column(name = "description")
+
     private String description;
-    @Basic
+
     @Column(name = "image_url")
     private String imageUrl;
-    @Basic
+
+
     @Column(name = "airing_date")
-    private Date airingDate;
-    @Basic
+    private Date aringDate;
+
     @Column(name = "imdb_rating")
-    private Double imdbRating;
-    @Basic
-    @Column(name = "director_id")
-    private Integer directorId;
-    @OneToMany(mappedBy = "moviesByMovieId")
-    private Collection<Discussion> discussionsByMovieId;
-    @OneToMany(mappedBy = "moviesByMovieId")
-    private Collection<MovieActorsEntity> movieActorsByMovieId;
-    @OneToMany(mappedBy = "moviesByMovieId")
-    private Collection<MovieGenresEntity> movieGenresByMovieId;
-    @OneToMany(mappedBy = "moviesByMovieId")
-    private Collection<MovieLikesEntity> movieLikesByMovieId;
-    @OneToMany(mappedBy = "moviesByMovieId")
-    private Collection<MovieRatesEntity> movieRatesByMovieId;
+    private Double imbdRating;
+
+    @ManyToMany
+    private List<Genre> genres;
+
+    @ManyToMany
+    private List<Person> likes;
+
+    @ManyToMany
+    private List<Person> actors;
+
+
+
+
     @ManyToOne
-    @JoinColumn(name = "director_id", referencedColumnName = "person_id",insertable = false, updatable = false)
-    private Person personsByDirectorId;
+    @JoinColumn(name = "director_id")
+    private Person director;
 
-    public int getMovieId() {
-        return movieId;
+
+
+
+
+
+    public boolean isFromGenre(Genre genre){
+
+     return    genres
+                .stream()
+                .anyMatch(g -> Objects.equals(g.getId(), genre.getId()));
+
+    }
+    public boolean hasActor(Person p){
+        return
+                actors
+                        .stream()
+                        .anyMatch(a -> Objects.equals(a.getPersonId(), p.getPersonId()));
+
+
     }
 
-    public void setMovieId(int movieId) {
-        this.movieId = movieId;
+    public boolean isDirectedBy(Person p){
+        return Objects.equals(director.getPersonId(), p.getPersonId());
     }
 
-    public String getTitle() {
-        return title;
-    }
+    public static Comparator<Movie> comparatorTitle = Comparator.comparing(Movie::getTitle);
 
-    public void setTitle(String title) {
-        this.title = title;
-    }
 
-    public String getDescription() {
-        return description;
-    }
+    public Movie( String title, String description, String imageUrl, Date aringDate, Double imbdRating,Person director, List<Person> actors, List<Genre> genres) {
 
-    public void setDescription(String description) {
-        this.description = description;
-    }
-
-    public String getImageUrl() {
-        return imageUrl;
-    }
-
-    public void setImageUrl(String imageUrl) {
-        this.imageUrl = imageUrl;
-    }
-
-    public Date getAiringDate() {
-        return airingDate;
-    }
-
-    public void setAiringDate(Date airingDate) {
-        this.airingDate = airingDate;
-    }
-
-    public Double getImdbRating() {
-        return imdbRating;
-    }
-
-    public void setImdbRating(Double imdbRating) {
-        this.imdbRating = imdbRating;
-    }
-
-    public Integer getDirectorId() {
-        return directorId;
-    }
-
-    public void setDirectorId(Integer directorId) {
-        this.directorId = directorId;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
-
-        Movie that = (Movie) o;
-
-        if (movieId != that.movieId) return false;
-        if (!Objects.equals(title, that.title)) return false;
-        if (!Objects.equals(description, that.description)) return false;
-        if (!Objects.equals(imageUrl, that.imageUrl)) return false;
-        if (!Objects.equals(airingDate, that.airingDate)) return false;
-        if (!Objects.equals(imdbRating, that.imdbRating)) return false;
-        if (!Objects.equals(directorId, that.directorId)) return false;
-
-        return true;
-    }
-
-    public Movie(String title, String description, String imageUrl, Date airingDate, Double imdbRating, Integer directorId) {
         this.title = title;
         this.description = description;
         this.imageUrl = imageUrl;
-        this.airingDate = airingDate;
-        this.imdbRating = imdbRating;
-        this.directorId = directorId;
+        this.aringDate = aringDate;
+        this.imbdRating = imbdRating;
+        this.genres = genres;
+        this.likes = likes;
+        this.actors = actors;
+        this.director = director;
     }
 
@@ -131,62 +95,4 @@
     }
 
-    @Override
-    public int hashCode() {
-        int result = movieId;
-        result = 31 * result + (title != null ? title.hashCode() : 0);
-        result = 31 * result + (description != null ? description.hashCode() : 0);
-        result = 31 * result + (imageUrl != null ? imageUrl.hashCode() : 0);
-        result = 31 * result + (airingDate != null ? airingDate.hashCode() : 0);
-        result = 31 * result + (imdbRating != null ? imdbRating.hashCode() : 0);
-        result = 31 * result + (directorId != null ? directorId.hashCode() : 0);
-        return result;
-    }
 
-    public Collection<Discussion> getDiscussionsByMovieId() {
-        return discussionsByMovieId;
-    }
-
-    public void setDiscussionsByMovieId(Collection<Discussion> discussionsByMovieId) {
-        this.discussionsByMovieId = discussionsByMovieId;
-    }
-
-    public Collection<MovieActorsEntity> getMovieActorsByMovieId() {
-        return movieActorsByMovieId;
-    }
-
-    public void setMovieActorsByMovieId(Collection<MovieActorsEntity> movieActorsByMovieId) {
-        this.movieActorsByMovieId = movieActorsByMovieId;
-    }
-
-    public Collection<MovieGenresEntity> getMovieGenresByMovieId() {
-        return movieGenresByMovieId;
-    }
-
-    public void setMovieGenresByMovieId(Collection<MovieGenresEntity> movieGenresByMovieId) {
-        this.movieGenresByMovieId = movieGenresByMovieId;
-    }
-
-    public Collection<MovieLikesEntity> getMovieLikesByMovieId() {
-        return movieLikesByMovieId;
-    }
-
-    public void setMovieLikesByMovieId(Collection<MovieLikesEntity> movieLikesByMovieId) {
-        this.movieLikesByMovieId = movieLikesByMovieId;
-    }
-
-    public Collection<MovieRatesEntity> getMovieRatesByMovieId() {
-        return movieRatesByMovieId;
-    }
-
-    public void setMovieRatesByMovieId(Collection<MovieRatesEntity> movieRatesByMovieId) {
-        this.movieRatesByMovieId = movieRatesByMovieId;
-    }
-
-    public Person getPersonsByDirectorId() {
-        return personsByDirectorId;
-    }
-
-    public void setPersonsByDirectorId(Person personsByDirectorId) {
-        this.personsByDirectorId = personsByDirectorId;
-    }
 }
Index: c/main/java/com/wediscussmovies/project/model/MovieActorsEntity.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/MovieActorsEntity.java	(revision 2d57cad1a18953bc47becb4f96114a908ecbf03d)
+++ 	(revision )
@@ -1,74 +1,0 @@
-package com.wediscussmovies.project.model;
-
-import javax.persistence.*;
-
-@Entity
-@Table(name = "movie_actors", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
-@IdClass(MovieActorsEntityPK.class)
-public class MovieActorsEntity {
-    @Id
-    @Column(name = "movie_id")
-    private int movieId;
-    @Id
-    @Column(name = "actor_id")
-    private int actorId;
-
-    @ManyToOne
-    @JoinColumn(name = "movie_id", referencedColumnName = "movie_id", nullable = false,insertable = false, updatable = false)
-    private Movie moviesByMovieId;
-    @ManyToOne
-    @JoinColumn(name = "actor_id", referencedColumnName = "person_id", nullable = false,insertable = false, updatable = false)
-    private Person personsByActorId;
-
-    public int getMovieId() {
-        return movieId;
-    }
-
-    public void setMovieId(int movieId) {
-        this.movieId = movieId;
-    }
-
-    public int getActorId() {
-        return actorId;
-    }
-
-    public void setActorId(int actorId) {
-        this.actorId = actorId;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
-
-        MovieActorsEntity that = (MovieActorsEntity) o;
-
-        if (movieId != that.movieId) return false;
-        if (actorId != that.actorId) return false;
-
-        return true;
-    }
-
-    @Override
-    public int hashCode() {
-        int result = movieId;
-        result = 31 * result + actorId;
-        return result;
-    }
-
-    public Movie getMoviesByMovieId() {
-        return moviesByMovieId;
-    }
-
-    public void setMoviesByMovieId(Movie moviesByMovieId) {
-        this.moviesByMovieId = moviesByMovieId;
-    }
-
-    public Person getPersonsByActorId() {
-        return personsByActorId;
-    }
-
-    public void setPersonsByActorId(Person personsByActorId) {
-        this.personsByActorId = personsByActorId;
-    }
-}
Index: c/main/java/com/wediscussmovies/project/model/MovieActorsEntityPK.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/MovieActorsEntityPK.java	(revision 2d57cad1a18953bc47becb4f96114a908ecbf03d)
+++ 	(revision )
@@ -1,52 +1,0 @@
-package com.wediscussmovies.project.model;
-
-import javax.persistence.Column;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import java.io.Serializable;
-
-public class MovieActorsEntityPK implements Serializable {
-    @Column(name = "movie_id")
-    @Id
-    private int movieId;
-    @Column(name = "actor_id")
-    @Id
-    private int actorId;
-
-    public int getMovieId() {
-        return movieId;
-    }
-
-    public void setMovieId(int movieId) {
-        this.movieId = movieId;
-    }
-
-    public int getActorId() {
-        return actorId;
-    }
-
-    public void setActorId(int actorId) {
-        this.actorId = actorId;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
-
-        MovieActorsEntityPK that = (MovieActorsEntityPK) o;
-
-        if (movieId != that.movieId) return false;
-        if (actorId != that.actorId) return false;
-
-        return true;
-    }
-
-    @Override
-    public int hashCode() {
-        int result = movieId;
-        result = 31 * result + actorId;
-        return result;
-    }
-}
Index: c/main/java/com/wediscussmovies/project/model/MovieGenresEntity.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/MovieGenresEntity.java	(revision 2d57cad1a18953bc47becb4f96114a908ecbf03d)
+++ 	(revision )
@@ -1,73 +1,0 @@
-package com.wediscussmovies.project.model;
-
-import javax.persistence.*;
-
-@Entity
-@Table(name = "movie_genres", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
-@IdClass(MovieGenresEntityPK.class)
-public class MovieGenresEntity {
-    @Id
-    @Column(name = "movie_id", insertable = false, updatable = false)
-    private int movieId;
-    @Id
-    @Column(name = "genre_id",insertable = false, updatable = false)
-    private int genreId;
-    @ManyToOne
-    @JoinColumn(name = "movie_id", referencedColumnName = "movie_id", nullable = false,insertable = false, updatable = false)
-    private Movie moviesByMovieId;
-    @ManyToOne
-    @JoinColumn(name = "genre_id", referencedColumnName = "genre_id", nullable = false,insertable = false, updatable = false)
-    private Genre genresByGenreId;
-
-    public int getMovieId() {
-        return movieId;
-    }
-
-    public void setMovieId(int movieId) {
-        this.movieId = movieId;
-    }
-
-    public int getGenreId() {
-        return genreId;
-    }
-
-    public void setGenreId(int genreId) {
-        this.genreId = genreId;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
-
-        MovieGenresEntity that = (MovieGenresEntity) o;
-
-        if (movieId != that.movieId) return false;
-        if (genreId != that.genreId) return false;
-
-        return true;
-    }
-
-    @Override
-    public int hashCode() {
-        int result = movieId;
-        result = 31 * result + genreId;
-        return result;
-    }
-
-    public Movie getMoviesByMovieId() {
-        return moviesByMovieId;
-    }
-
-    public void setMoviesByMovieId(Movie moviesByMovieId) {
-        this.moviesByMovieId = moviesByMovieId;
-    }
-
-    public Genre getGenresByGenreId() {
-        return genresByGenreId;
-    }
-
-    public void setGenresByGenreId(Genre genresByGenreId) {
-        this.genresByGenreId = genresByGenreId;
-    }
-}
Index: c/main/java/com/wediscussmovies/project/model/MovieGenresEntityPK.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/MovieGenresEntityPK.java	(revision 2d57cad1a18953bc47becb4f96114a908ecbf03d)
+++ 	(revision )
@@ -1,52 +1,0 @@
-package com.wediscussmovies.project.model;
-
-import javax.persistence.Column;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import java.io.Serializable;
-
-public class MovieGenresEntityPK implements Serializable {
-    @Column(name = "movie_id")
-    @Id
-    private int movieId;
-    @Column(name = "genre_id")
-    @Id
-    private int genreId;
-
-    public int getMovieId() {
-        return movieId;
-    }
-
-    public void setMovieId(int movieId) {
-        this.movieId = movieId;
-    }
-
-    public int getGenreId() {
-        return genreId;
-    }
-
-    public void setGenreId(int genreId) {
-        this.genreId = genreId;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
-
-        MovieGenresEntityPK that = (MovieGenresEntityPK) o;
-
-        if (movieId != that.movieId) return false;
-        if (genreId != that.genreId) return false;
-
-        return true;
-    }
-
-    @Override
-    public int hashCode() {
-        int result = movieId;
-        result = 31 * result + genreId;
-        return result;
-    }
-}
Index: c/main/java/com/wediscussmovies/project/model/MovieLikesEntity.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/MovieLikesEntity.java	(revision 2d57cad1a18953bc47becb4f96114a908ecbf03d)
+++ 	(revision )
@@ -1,73 +1,0 @@
-package com.wediscussmovies.project.model;
-
-import javax.persistence.*;
-
-@Entity
-@Table(name = "movie_likes", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
-@IdClass(MovieLikesEntityPK.class)
-public class MovieLikesEntity {
-    @Id
-    @Column(name = "movie_id")
-    private int movieId;
-    @Id
-    @Column(name = "user_id")
-    private int userId;
-    @ManyToOne
-    @JoinColumn(name = "movie_id", referencedColumnName = "movie_id", nullable = false,insertable = false, updatable = false)
-    private Movie moviesByMovieId;
-    @ManyToOne
-    @JoinColumn(name = "user_id", referencedColumnName = "user_id", nullable = false,insertable = false, updatable = false)
-    private User usersByUserId;
-
-    public int getMovieId() {
-        return movieId;
-    }
-
-    public void setMovieId(int movieId) {
-        this.movieId = movieId;
-    }
-
-    public int getUserId() {
-        return userId;
-    }
-
-    public void setUserId(int userId) {
-        this.userId = userId;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
-
-        MovieLikesEntity that = (MovieLikesEntity) o;
-
-        if (movieId != that.movieId) return false;
-        if (userId != that.userId) return false;
-
-        return true;
-    }
-
-    @Override
-    public int hashCode() {
-        int result = movieId;
-        result = 31 * result + userId;
-        return result;
-    }
-
-    public Movie getMoviesByMovieId() {
-        return moviesByMovieId;
-    }
-
-    public void setMoviesByMovieId(Movie moviesByMovieId) {
-        this.moviesByMovieId = moviesByMovieId;
-    }
-
-    public User getUsersByUserId() {
-        return usersByUserId;
-    }
-
-    public void setUsersByUserId(User usersByUserId) {
-        this.usersByUserId = usersByUserId;
-    }
-}
Index: c/main/java/com/wediscussmovies/project/model/MovieLikesEntityPK.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/MovieLikesEntityPK.java	(revision 2d57cad1a18953bc47becb4f96114a908ecbf03d)
+++ 	(revision )
@@ -1,52 +1,0 @@
-package com.wediscussmovies.project.model;
-
-import javax.persistence.Column;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import java.io.Serializable;
-
-public class MovieLikesEntityPK implements Serializable {
-    @Column(name = "movie_id")
-    @Id
-    private int movieId;
-    @Column(name = "user_id")
-    @Id
-    private int userId;
-
-    public int getMovieId() {
-        return movieId;
-    }
-
-    public void setMovieId(int movieId) {
-        this.movieId = movieId;
-    }
-
-    public int getUserId() {
-        return userId;
-    }
-
-    public void setUserId(int userId) {
-        this.userId = userId;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
-
-        MovieLikesEntityPK that = (MovieLikesEntityPK) o;
-
-        if (movieId != that.movieId) return false;
-        if (userId != that.userId) return false;
-
-        return true;
-    }
-
-    @Override
-    public int hashCode() {
-        int result = movieId;
-        result = 31 * result + userId;
-        return result;
-    }
-}
Index: src/main/java/com/wediscussmovies/project/model/MovieRates.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/MovieRates.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/model/MovieRates.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -0,0 +1,40 @@
+package com.wediscussmovies.project.model;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name = "movie_rates", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
+@IdClass(MovieRatesPK.class)
+public class MovieRates {
+
+    @Id
+    @Column(name = "movie_id")
+    private Long movieId;
+
+    @Id
+    @Column(name = "user_id")
+    private Long userId;
+
+    private String reason;
+
+    @Column(name = "stars_rated")
+    private int stars;
+
+    @ManyToOne
+    @JoinColumn(name = "movie_id", referencedColumnName = "movie_id", nullable = false, insertable = false, updatable = false)
+    private Movie movie;
+
+    @ManyToOne
+    @JoinColumn(name = "user_id", referencedColumnName = "user_id", nullable = false, insertable = false, updatable = false)
+    private User user;
+
+    public MovieRates(Long movieId, Long userId, String reason, int starsRated) {
+        this.movieId = movieId;
+        this.userId = userId;
+        this.reason = reason;
+        this.stars = starsRated;
+    }
+
+    public MovieRates() {
+    }
+}
Index: c/main/java/com/wediscussmovies/project/model/MovieRatesEntity.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/MovieRatesEntity.java	(revision 2d57cad1a18953bc47becb4f96114a908ecbf03d)
+++ 	(revision )
@@ -1,99 +1,0 @@
-package com.wediscussmovies.project.model;
-
-import javax.persistence.*;
-
-@Entity
-@Table(name = "movie_rates", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
-@IdClass(MovieRatesEntityPK.class)
-public class MovieRatesEntity {
-    @Id
-    @Column(name = "movie_id")
-    private int movieId;
-    @Id
-    @Column(name = "user_id")
-    private int userId;
-    @Basic
-    @Column(name = "reason")
-    private String reason;
-    @Basic
-    @Column(name = "stars_rated")
-    private int starsRated;
-    @ManyToOne
-    @JoinColumn(name = "movie_id", referencedColumnName = "movie_id", nullable = false,insertable = false, updatable = false)
-    private Movie moviesByMovieId;
-    @ManyToOne
-    @JoinColumn(name = "user_id", referencedColumnName = "user_id", nullable = false,insertable = false, updatable = false)
-    private User usersByUserId;
-
-    public int getMovieId() {
-        return movieId;
-    }
-
-    public void setMovieId(int movieId) {
-        this.movieId = movieId;
-    }
-
-    public int getUserId() {
-        return userId;
-    }
-
-    public void setUserId(int userId) {
-        this.userId = userId;
-    }
-
-    public String getReason() {
-        return reason;
-    }
-
-    public void setReason(String reason) {
-        this.reason = reason;
-    }
-
-    public int getStarsRated() {
-        return starsRated;
-    }
-
-    public void setStarsRated(int starsRated) {
-        this.starsRated = starsRated;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
-
-        MovieRatesEntity that = (MovieRatesEntity) o;
-
-        if (movieId != that.movieId) return false;
-        if (userId != that.userId) return false;
-        if (starsRated != that.starsRated) return false;
-        if (reason != null ? !reason.equals(that.reason) : that.reason != null) return false;
-
-        return true;
-    }
-
-    @Override
-    public int hashCode() {
-        int result = movieId;
-        result = 31 * result + userId;
-        result = 31 * result + (reason != null ? reason.hashCode() : 0);
-        result = 31 * result + starsRated;
-        return result;
-    }
-
-    public Movie getMoviesByMovieId() {
-        return moviesByMovieId;
-    }
-
-    public void setMoviesByMovieId(Movie moviesByMovieId) {
-        this.moviesByMovieId = moviesByMovieId;
-    }
-
-    public User getUsersByUserId() {
-        return usersByUserId;
-    }
-
-    public void setUsersByUserId(User usersByUserId) {
-        this.usersByUserId = usersByUserId;
-    }
-}
Index: c/main/java/com/wediscussmovies/project/model/MovieRatesEntityPK.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/MovieRatesEntityPK.java	(revision 2d57cad1a18953bc47becb4f96114a908ecbf03d)
+++ 	(revision )
@@ -1,52 +1,0 @@
-package com.wediscussmovies.project.model;
-
-import javax.persistence.Column;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import java.io.Serializable;
-
-public class MovieRatesEntityPK implements Serializable {
-    @Column(name = "movie_id")
-    @Id
-    private int movieId;
-    @Column(name = "user_id")
-    @Id
-    private int userId;
-
-    public int getMovieId() {
-        return movieId;
-    }
-
-    public void setMovieId(int movieId) {
-        this.movieId = movieId;
-    }
-
-    public int getUserId() {
-        return userId;
-    }
-
-    public void setUserId(int userId) {
-        this.userId = userId;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
-
-        MovieRatesEntityPK that = (MovieRatesEntityPK) o;
-
-        if (movieId != that.movieId) return false;
-        if (userId != that.userId) return false;
-
-        return true;
-    }
-
-    @Override
-    public int hashCode() {
-        int result = movieId;
-        result = 31 * result + userId;
-        return result;
-    }
-}
Index: src/main/java/com/wediscussmovies/project/model/MovieRatesPK.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/MovieRatesPK.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/model/MovieRatesPK.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -0,0 +1,17 @@
+package com.wediscussmovies.project.model;
+
+import javax.persistence.Column;
+import javax.persistence.Id;
+import java.io.Serializable;
+
+public class MovieRatesPK implements Serializable {
+
+    @Id
+    @Column(name = "movie_id")
+    private Long movieId;
+
+    @Id
+    @Column(name = "user_id")
+    private Long userId;
+
+}
Index: src/main/java/com/wediscussmovies/project/model/PasswordEncoder.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/PasswordEncoder.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/model/PasswordEncoder.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -0,0 +1,36 @@
+package com.wediscussmovies.project.model;
+
+
+import java.math.BigInteger;
+import java.nio.charset.StandardCharsets;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+public class PasswordEncoder {
+    public static byte[] getSHA(String input) throws NoSuchAlgorithmException
+    {
+        MessageDigest md = MessageDigest.getInstance("SHA-512");
+
+        return md.digest(input.getBytes(StandardCharsets.UTF_8));
+    }
+
+    public static String toHexString(byte[] hash)
+    {
+        BigInteger number = new BigInteger(1, hash);
+
+        StringBuilder hexString = new StringBuilder(number.toString(16));
+
+        while (hexString.length() < 32)
+        {
+            hexString.insert(0, '0');
+        }
+
+        return hexString.toString();
+    }
+
+    public static String getEncodedPasswordString(String password) throws NoSuchAlgorithmException {
+        return toHexString(getSHA(password));
+    }
+
+}
+
Index: src/main/java/com/wediscussmovies/project/model/Person.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/Person.java	(revision 2d57cad1a18953bc47becb4f96114a908ecbf03d)
+++ src/main/java/com/wediscussmovies/project/model/Person.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -1,158 +1,48 @@
 package com.wediscussmovies.project.model;
+
+import com.wediscussmovies.project.model.enumerations.PersonType;
+import lombok.Data;
 
 import javax.persistence.*;
 import java.sql.Date;
 import java.util.Collection;
+import java.util.List;
 
 @Entity
 @Table(name = "persons", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
+@Data
 public class Person {
     @GeneratedValue(strategy = GenerationType.IDENTITY)
     @Id
     @Column(name = "person_id")
-    private int personId;
-    @Basic
-    @Column(name = "name")
+    private Long personId;
+
     private String name;
-    @Basic
-    @Column(name = "surname")
+
     private String surname;
-    @Basic
-    @Column(name = "type")
-    private String type;
-    @Basic
+
+    @Enumerated
+    private PersonType type;
+
     @Column(name = "date_of_birth")
-    private Date dateOfBirth;
-    @Basic
+    private Date birthDate;
+
     @Column(name = "image_url")
     private String imageUrl;
-    @Basic
-    @Column(name = "description")
+
     private String description;
-    @OneToMany(mappedBy = "personsByPersonId")
-    private Collection<Discussion> discussionsByPersonId;
-    @OneToMany(mappedBy = "personsByActorId")
-    private Collection<MovieActorsEntity> movieActorsByPersonId;
-    @OneToMany(mappedBy = "personsByDirectorId")
-    private Collection<Movie> moviesByPersonId;
-    @OneToMany(mappedBy = "personsByPersonId")
-    private Collection<PersonRatesEntity> personRatesByPersonId;
 
-    public int getPersonId() {
-        return personId;
+
+
+    public Person() {
     }
 
-    public void setPersonId(int personId) {
-        this.personId = personId;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
+    public Person(String name, String surname, PersonType type, Date date_of_birth, String image_url, String description) {
         this.name = name;
-    }
-
-    public String getSurname() {
-        return surname;
-    }
-
-    public void setSurname(String surname) {
         this.surname = surname;
-    }
-
-    public String getType() {
-        return type;
-    }
-
-    public void setType(String type) {
         this.type = type;
-    }
-
-    public Date getDateOfBirth() {
-        return dateOfBirth;
-    }
-
-    public void setDateOfBirth(Date dateOfBirth) {
-        this.dateOfBirth = dateOfBirth;
-    }
-
-    public String getImageUrl() {
-        return imageUrl;
-    }
-
-    public void setImageUrl(String imageUrl) {
-        this.imageUrl = imageUrl;
-    }
-
-    public String getDescription() {
-        return description;
-    }
-
-    public void setDescription(String description) {
+        this.birthDate = date_of_birth;
+        this.imageUrl = image_url;
         this.description = description;
     }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
-
-        Person that = (Person) o;
-
-        if (personId != that.personId) return false;
-        if (name != null ? !name.equals(that.name) : that.name != null) return false;
-        if (surname != null ? !surname.equals(that.surname) : that.surname != null) return false;
-        if (type != null ? !type.equals(that.type) : that.type != null) return false;
-        if (dateOfBirth != null ? !dateOfBirth.equals(that.dateOfBirth) : that.dateOfBirth != null) return false;
-        if (imageUrl != null ? !imageUrl.equals(that.imageUrl) : that.imageUrl != null) return false;
-        if (description != null ? !description.equals(that.description) : that.description != null) return false;
-
-        return true;
-    }
-
-    @Override
-    public int hashCode() {
-        int result = personId;
-        result = 31 * result + (name != null ? name.hashCode() : 0);
-        result = 31 * result + (surname != null ? surname.hashCode() : 0);
-        result = 31 * result + (type != null ? type.hashCode() : 0);
-        result = 31 * result + (dateOfBirth != null ? dateOfBirth.hashCode() : 0);
-        result = 31 * result + (imageUrl != null ? imageUrl.hashCode() : 0);
-        result = 31 * result + (description != null ? description.hashCode() : 0);
-        return result;
-    }
-
-    public Collection<Discussion> getDiscussionsByPersonId() {
-        return discussionsByPersonId;
-    }
-
-    public void setDiscussionsByPersonId(Collection<Discussion> discussionsByPersonId) {
-        this.discussionsByPersonId = discussionsByPersonId;
-    }
-
-    public Collection<MovieActorsEntity> getMovieActorsByPersonId() {
-        return movieActorsByPersonId;
-    }
-
-    public void setMovieActorsByPersonId(Collection<MovieActorsEntity> movieActorsByPersonId) {
-        this.movieActorsByPersonId = movieActorsByPersonId;
-    }
-
-    public Collection<Movie> getMoviesByPersonId() {
-        return moviesByPersonId;
-    }
-
-    public void setMoviesByPersonId(Collection<Movie> moviesByPersonId) {
-        this.moviesByPersonId = moviesByPersonId;
-    }
-
-    public Collection<PersonRatesEntity> getPersonRatesByPersonId() {
-        return personRatesByPersonId;
-    }
-
-    public void setPersonRatesByPersonId(Collection<PersonRatesEntity> personRatesByPersonId) {
-        this.personRatesByPersonId = personRatesByPersonId;
-    }
 }
Index: src/main/java/com/wediscussmovies/project/model/PersonRates.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/PersonRates.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/model/PersonRates.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -0,0 +1,41 @@
+package com.wediscussmovies.project.model;
+
+import lombok.Data;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name = "person_rates", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
+@IdClass(PersonRatesPK.class)
+@Data
+public class PersonRates {
+    @Id
+    @Column(name = "person_id")
+    private Long personId;
+
+    @Id
+    @Column(name = "user_id")
+    private Long userId;
+
+    private String reason;
+
+    @Column(name = "stars_rated")
+    private int stars;
+
+    @ManyToOne
+    @JoinColumn(name = "person_id", referencedColumnName = "person_id", nullable = false,insertable = false, updatable = false)
+    private Person person;
+    @ManyToOne
+    @JoinColumn(name = "user_id", referencedColumnName = "user_id", nullable = false,insertable = false, updatable = false)
+    private User user;
+
+    public PersonRates(Long person_id, Long user_id, String reason, int stars_rated) {
+        this.personId = person_id;
+        this.userId = user_id;
+        this.reason = reason;
+        this.stars = stars_rated;
+    }
+
+    public PersonRates() {
+    }
+}
Index: c/main/java/com/wediscussmovies/project/model/PersonRatesEntity.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/PersonRatesEntity.java	(revision 2d57cad1a18953bc47becb4f96114a908ecbf03d)
+++ 	(revision )
@@ -1,99 +1,0 @@
-package com.wediscussmovies.project.model;
-
-import javax.persistence.*;
-
-@Entity
-@Table(name = "person_rates", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
-@IdClass(PersonRatesEntityPK.class)
-public class PersonRatesEntity {
-    @Id
-    @Column(name = "person_id")
-    private int personId;
-    @Id
-    @Column(name = "user_id")
-    private int userId;
-    @Basic
-    @Column(name = "reason")
-    private String reason;
-    @Basic
-    @Column(name = "stars_rated")
-    private int starsRated;
-    @ManyToOne
-    @JoinColumn(name = "person_id", referencedColumnName = "person_id", nullable = false,insertable = false, updatable = false)
-    private Person personsByPersonId;
-    @ManyToOne
-    @JoinColumn(name = "user_id", referencedColumnName = "user_id", nullable = false,insertable = false, updatable = false)
-    private User usersByUserId;
-
-    public int getPersonId() {
-        return personId;
-    }
-
-    public void setPersonId(int personId) {
-        this.personId = personId;
-    }
-
-    public int getUserId() {
-        return userId;
-    }
-
-    public void setUserId(int userId) {
-        this.userId = userId;
-    }
-
-    public String getReason() {
-        return reason;
-    }
-
-    public void setReason(String reason) {
-        this.reason = reason;
-    }
-
-    public int getStarsRated() {
-        return starsRated;
-    }
-
-    public void setStarsRated(int starsRated) {
-        this.starsRated = starsRated;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
-
-        PersonRatesEntity that = (PersonRatesEntity) o;
-
-        if (personId != that.personId) return false;
-        if (userId != that.userId) return false;
-        if (starsRated != that.starsRated) return false;
-        if (reason != null ? !reason.equals(that.reason) : that.reason != null) return false;
-
-        return true;
-    }
-
-    @Override
-    public int hashCode() {
-        int result = personId;
-        result = 31 * result + userId;
-        result = 31 * result + (reason != null ? reason.hashCode() : 0);
-        result = 31 * result + starsRated;
-        return result;
-    }
-
-    public Person getPersonsByPersonId() {
-        return personsByPersonId;
-    }
-
-    public void setPersonsByPersonId(Person personsByPersonId) {
-        this.personsByPersonId = personsByPersonId;
-    }
-
-    public User getUsersByUserId() {
-        return usersByUserId;
-    }
-
-    public void setUsersByUserId(User usersByUserId) {
-        this.usersByUserId = usersByUserId;
-    }
-}
Index: c/main/java/com/wediscussmovies/project/model/PersonRatesEntityPK.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/PersonRatesEntityPK.java	(revision 2d57cad1a18953bc47becb4f96114a908ecbf03d)
+++ 	(revision )
@@ -1,52 +1,0 @@
-package com.wediscussmovies.project.model;
-
-import javax.persistence.Column;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import java.io.Serializable;
-
-public class PersonRatesEntityPK implements Serializable {
-    @Column(name = "person_id")
-    @Id
-    private int personId;
-    @Column(name = "user_id")
-    @Id
-    private int userId;
-
-    public int getPersonId() {
-        return personId;
-    }
-
-    public void setPersonId(int personId) {
-        this.personId = personId;
-    }
-
-    public int getUserId() {
-        return userId;
-    }
-
-    public void setUserId(int userId) {
-        this.userId = userId;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
-
-        PersonRatesEntityPK that = (PersonRatesEntityPK) o;
-
-        if (personId != that.personId) return false;
-        if (userId != that.userId) return false;
-
-        return true;
-    }
-
-    @Override
-    public int hashCode() {
-        int result = personId;
-        result = 31 * result + userId;
-        return result;
-    }
-}
Index: src/main/java/com/wediscussmovies/project/model/PersonRatesPK.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/PersonRatesPK.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/model/PersonRatesPK.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -0,0 +1,17 @@
+package com.wediscussmovies.project.model;
+
+import javax.persistence.Column;
+import javax.persistence.Id;
+import java.io.Serializable;
+
+public class PersonRatesPK implements Serializable {
+
+    @Id
+    @Column(name = "person_id")
+    private Long personId;
+    @Id
+    @Column(name = "user_id")
+    private Long userId;
+
+
+}
Index: src/main/java/com/wediscussmovies/project/model/RepliesEntityPK.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/RepliesEntityPK.java	(revision 2d57cad1a18953bc47becb4f96114a908ecbf03d)
+++ src/main/java/com/wediscussmovies/project/model/RepliesEntityPK.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -8,46 +8,13 @@
 
 public class RepliesEntityPK implements Serializable {
+    @Id
     @Column(name = "discussion_id")
-    @Id
-    private int discussionId;
-    @Column(name = "reply_id")
+    private Long discussionId;
     @Id
     @GeneratedValue(strategy = GenerationType.IDENTITY)
-    private int replyId;
+    @Column(name = "reply_id")
+    private Long replyId;
 
-    public int getDiscussionId() {
-        return discussionId;
-    }
 
-    public void setDiscussionId(int discussionId) {
-        this.discussionId = discussionId;
-    }
 
-    public int getReplyId() {
-        return replyId;
-    }
-
-    public void setReplyId(int replyId) {
-        this.replyId = replyId;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
-
-        RepliesEntityPK that = (RepliesEntityPK) o;
-
-        if (discussionId != that.discussionId) return false;
-        if (replyId != that.replyId) return false;
-
-        return true;
-    }
-
-    @Override
-    public int hashCode() {
-        int result = discussionId;
-        result = 31 * result + replyId;
-        return result;
-    }
 }
Index: src/main/java/com/wediscussmovies/project/model/Reply.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/Reply.java	(revision 2d57cad1a18953bc47becb4f96114a908ecbf03d)
+++ src/main/java/com/wediscussmovies/project/model/Reply.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -1,114 +1,51 @@
 package com.wediscussmovies.project.model;
+
+import lombok.Data;
 
 import javax.persistence.*;
 import java.sql.Date;
+import java.util.Optional;
 
 @Entity
 @Table(name = "replies", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
 @IdClass(RepliesEntityPK.class)
+@Data
 public class Reply {
     @Id
-    @Column(name = "discussion_id",insertable = false, updatable = false)
-    private int discussionId;
+    @Column(name = "discussion_id")
+    private Long discussionId;
+
     @GeneratedValue(strategy = GenerationType.IDENTITY)
     @Id
     @Column(name = "reply_id")
-    private int replyId;
-    @Basic
-    @Column(name = "text")
+    private Long replyId;
+
     private String text;
-    @Basic
-    @Column(name = "date")
+
     private Date date;
-    @Basic
-    @Column(name = "user_id")
-    private int userId;
+
     @ManyToOne
     @JoinColumn(name = "discussion_id", referencedColumnName = "discussion_id", nullable = false,insertable = false, updatable = false)
-    private Discussion discussionsByDiscussionId;
+    private Discussion discussion;
+
     @ManyToOne
-    @JoinColumn(name = "user_id", referencedColumnName = "user_id", nullable = false,insertable = false, updatable = false)
-    private User usersByUserId;
+    @JoinColumn(name = "user_id")
+    private User user;
 
-    public int getDiscussionId() {
-        return discussionId;
+
+
+
+    public Reply(Discussion discussion, User user, Date date, String text) {
+        this.discussion = discussion;
+        this.user = user;
+        this.date = date;
+        this.text = text;
+
     }
 
-    public void setDiscussionId(int discussionId) {
-        this.discussionId = discussionId;
+    public Reply() {
+
     }
 
-    public int getReplyId() {
-        return replyId;
-    }
 
-    public void setReplyId(int replyId) {
-        this.replyId = replyId;
-    }
-
-    public String getText() {
-        return text;
-    }
-
-    public void setText(String text) {
-        this.text = text;
-    }
-
-    public Date getDate() {
-        return date;
-    }
-
-    public void setDate(Date date) {
-        this.date = date;
-    }
-
-    public int getUserId() {
-        return userId;
-    }
-
-    public void setUserId(int userId) {
-        this.userId = userId;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
-
-        Reply that = (Reply) o;
-
-        if (discussionId != that.discussionId) return false;
-        if (replyId != that.replyId) return false;
-        if (userId != that.userId) return false;
-        if (text != null ? !text.equals(that.text) : that.text != null) return false;
-        if (date != null ? !date.equals(that.date) : that.date != null) return false;
-
-        return true;
-    }
-
-    @Override
-    public int hashCode() {
-        int result = discussionId;
-        result = 31 * result + replyId;
-        result = 31 * result + (text != null ? text.hashCode() : 0);
-        result = 31 * result + (date != null ? date.hashCode() : 0);
-        result = 31 * result + userId;
-        return result;
-    }
-
-    public Discussion getDiscussionsByDiscussionId() {
-        return discussionsByDiscussionId;
-    }
-
-    public void setDiscussionsByDiscussionId(Discussion discussionsByDiscussionId) {
-        this.discussionsByDiscussionId = discussionsByDiscussionId;
-    }
-
-    public User getUsersByUserId() {
-        return usersByUserId;
-    }
-
-    public void setUsersByUserId(User usersByUserId) {
-        this.usersByUserId = usersByUserId;
-    }
 }
Index: src/main/java/com/wediscussmovies/project/model/User.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/User.java	(revision 2d57cad1a18953bc47becb4f96114a908ecbf03d)
+++ src/main/java/com/wediscussmovies/project/model/User.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -3,4 +3,5 @@
 import javax.persistence.*;
 import java.util.Collection;
+import java.util.List;
 
 @Entity
@@ -10,155 +11,31 @@
     @Id
     @Column(name = "user_id")
-    private int userId;
-    @Basic
-    @Column(name = "username")
+    private Long userId;
+
     private String username;
-    @Basic
-    @Column(name = "name")
+
     private String name;
-    @Basic
-    @Column(name = "surname")
+
     private String surname;
-    @Basic
-    @Column(name = "email")
+
     private String email;
-    @Basic
-    @Column(name = "password")
+
     private String password;
-    @OneToMany(mappedBy = "usersByUserId")
-    private Collection<Discussion> discussionsByUserId;
-    @OneToMany(mappedBy = "usersByUserId")
-    private Collection<MovieLikesEntity> movieLikesByUserId;
-    @OneToMany(mappedBy = "usersByUserId")
-    private Collection<MovieRatesEntity> movieRatesByUserId;
-    @OneToMany(mappedBy = "usersByUserId")
-    private Collection<PersonRatesEntity> personRatesByUserId;
-    @OneToMany(mappedBy = "usersByUserId")
-    private Collection<Reply> repliesByUserId;
-    @OneToMany(mappedBy = "usersByUserId")
-    private Collection<UserGenresEntity> userGenresByUserId;
 
-    public int getUserId() {
-        return userId;
-    }
+    @ManyToMany
+    private List<Movie> movies;
 
-    public void setUserId(int userId) {
-        this.userId = userId;
-    }
 
-    public String getUsername() {
-        return username;
-    }
 
-    public void setUsername(String username) {
+
+    public User(String username, String name, String surname, String email, String password) {
         this.username = username;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
         this.name = name;
-    }
-
-    public String getSurname() {
-        return surname;
-    }
-
-    public void setSurname(String surname) {
         this.surname = surname;
-    }
-
-    public String getEmail() {
-        return email;
-    }
-
-    public void setEmail(String email) {
         this.email = email;
-    }
-
-    public String getPassword() {
-        return password;
-    }
-
-    public void setPassword(String password) {
         this.password = password;
     }
 
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
-
-        User that = (User) o;
-
-        if (userId != that.userId) return false;
-        if (username != null ? !username.equals(that.username) : that.username != null) return false;
-        if (name != null ? !name.equals(that.name) : that.name != null) return false;
-        if (surname != null ? !surname.equals(that.surname) : that.surname != null) return false;
-        if (email != null ? !email.equals(that.email) : that.email != null) return false;
-        if (password != null ? !password.equals(that.password) : that.password != null) return false;
-
-        return true;
-    }
-
-    @Override
-    public int hashCode() {
-        int result = userId;
-        result = 31 * result + (username != null ? username.hashCode() : 0);
-        result = 31 * result + (name != null ? name.hashCode() : 0);
-        result = 31 * result + (surname != null ? surname.hashCode() : 0);
-        result = 31 * result + (email != null ? email.hashCode() : 0);
-        result = 31 * result + (password != null ? password.hashCode() : 0);
-        return result;
-    }
-
-    public Collection<Discussion> getDiscussionsByUserId() {
-        return discussionsByUserId;
-    }
-
-    public void setDiscussionsByUserId(Collection<Discussion> discussionsByUserId) {
-        this.discussionsByUserId = discussionsByUserId;
-    }
-
-    public Collection<MovieLikesEntity> getMovieLikesByUserId() {
-        return movieLikesByUserId;
-    }
-
-    public void setMovieLikesByUserId(Collection<MovieLikesEntity> movieLikesByUserId) {
-        this.movieLikesByUserId = movieLikesByUserId;
-    }
-
-    public Collection<MovieRatesEntity> getMovieRatesByUserId() {
-        return movieRatesByUserId;
-    }
-
-    public void setMovieRatesByUserId(Collection<MovieRatesEntity> movieRatesByUserId) {
-        this.movieRatesByUserId = movieRatesByUserId;
-    }
-
-    public Collection<PersonRatesEntity> getPersonRatesByUserId() {
-        return personRatesByUserId;
-    }
-
-    public void setPersonRatesByUserId(Collection<PersonRatesEntity> personRatesByUserId) {
-        this.personRatesByUserId = personRatesByUserId;
-    }
-
-    public Collection<Reply> getRepliesByUserId() {
-        return repliesByUserId;
-    }
-
-    public void setRepliesByUserId(Collection<Reply> repliesByUserId) {
-        this.repliesByUserId = repliesByUserId;
-    }
-
-    public Collection<UserGenresEntity> getUserGenresByUserId() {
-        return userGenresByUserId;
-    }
-
-    public void setUserGenresByUserId(Collection<UserGenresEntity> userGenresByUserId) {
-        this.userGenresByUserId = userGenresByUserId;
+    public User() {
     }
 }
Index: c/main/java/com/wediscussmovies/project/model/UserGenresEntity.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/UserGenresEntity.java	(revision 2d57cad1a18953bc47becb4f96114a908ecbf03d)
+++ 	(revision )
@@ -1,73 +1,0 @@
-package com.wediscussmovies.project.model;
-
-import javax.persistence.*;
-
-@Entity
-@Table(name = "user_genres", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
-@IdClass(UserGenresEntityPK.class)
-public class UserGenresEntity {
-    @Id
-    @Column(name = "user_id")
-    private int userId;
-    @Id
-    @Column(name = "genre_id")
-    private int genreId;
-    @ManyToOne
-    @JoinColumn(name = "user_id", referencedColumnName = "user_id", nullable = false,insertable = false, updatable = false)
-    private User usersByUserId;
-    @ManyToOne
-    @JoinColumn(name = "genre_id", referencedColumnName = "genre_id", nullable = false,insertable = false, updatable = false)
-    private Genre genresByGenreId;
-
-    public int getUserId() {
-        return userId;
-    }
-
-    public void setUserId(int userId) {
-        this.userId = userId;
-    }
-
-    public int getGenreId() {
-        return genreId;
-    }
-
-    public void setGenreId(int genreId) {
-        this.genreId = genreId;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
-
-        UserGenresEntity that = (UserGenresEntity) o;
-
-        if (userId != that.userId) return false;
-        if (genreId != that.genreId) return false;
-
-        return true;
-    }
-
-    @Override
-    public int hashCode() {
-        int result = userId;
-        result = 31 * result + genreId;
-        return result;
-    }
-
-    public User getUsersByUserId() {
-        return usersByUserId;
-    }
-
-    public void setUsersByUserId(User usersByUserId) {
-        this.usersByUserId = usersByUserId;
-    }
-
-    public Genre getGenresByGenreId() {
-        return genresByGenreId;
-    }
-
-    public void setGenresByGenreId(Genre genresByGenreId) {
-        this.genresByGenreId = genresByGenreId;
-    }
-}
Index: c/main/java/com/wediscussmovies/project/model/UserGenresEntityPK.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/UserGenresEntityPK.java	(revision 2d57cad1a18953bc47becb4f96114a908ecbf03d)
+++ 	(revision )
@@ -1,52 +1,0 @@
-package com.wediscussmovies.project.model;
-
-import javax.persistence.Column;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import java.io.Serializable;
-
-public class UserGenresEntityPK implements Serializable {
-    @Column(name = "user_id")
-    @Id
-    private int userId;
-    @Column(name = "genre_id")
-    @Id
-    private int genreId;
-
-    public int getUserId() {
-        return userId;
-    }
-
-    public void setUserId(int userId) {
-        this.userId = userId;
-    }
-
-    public int getGenreId() {
-        return genreId;
-    }
-
-    public void setGenreId(int genreId) {
-        this.genreId = genreId;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
-
-        UserGenresEntityPK that = (UserGenresEntityPK) o;
-
-        if (userId != that.userId) return false;
-        if (genreId != that.genreId) return false;
-
-        return true;
-    }
-
-    @Override
-    public int hashCode() {
-        int result = userId;
-        result = 31 * result + genreId;
-        return result;
-    }
-}
Index: src/main/java/com/wediscussmovies/project/model/enumerations/DiscussionType.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/enumerations/DiscussionType.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/model/enumerations/DiscussionType.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -0,0 +1,5 @@
+package com.wediscussmovies.project.model.enumerations;
+
+public enum DiscussionType {
+    M,P
+}
Index: src/main/java/com/wediscussmovies/project/model/enumerations/PersonType.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/enumerations/PersonType.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/model/enumerations/PersonType.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -0,0 +1,5 @@
+package com.wediscussmovies.project.model.enumerations;
+
+public enum PersonType {
+    A, D
+}
Index: src/main/java/com/wediscussmovies/project/model/exception/InvalidUserCredentialsException.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/exception/InvalidUserCredentialsException.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/model/exception/InvalidUserCredentialsException.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -0,0 +1,7 @@
+package com.wediscussmovies.project.model.exception;
+
+public class InvalidUserCredentialsException extends RuntimeException{
+    public InvalidUserCredentialsException(String username) {
+        super("The user with the username {" + username +"} cannot be authenticated.");
+    }
+}
Index: src/main/java/com/wediscussmovies/project/model/exception/MovieIdNotFoundException.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/exception/MovieIdNotFoundException.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/model/exception/MovieIdNotFoundException.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -0,0 +1,7 @@
+package com.wediscussmovies.project.model.exception;
+
+public class MovieIdNotFoundException extends RuntimeException{
+    public MovieIdNotFoundException(Integer id) {
+        super("Movie with id {"+id+"} was not found.");
+    }
+}
Index: src/main/java/com/wediscussmovies/project/model/exception/NotEnoughArgumentsException.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/exception/NotEnoughArgumentsException.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/model/exception/NotEnoughArgumentsException.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -0,0 +1,4 @@
+package com.wediscussmovies.project.model.exception;
+
+public class NotEnoughArgumentsException {
+}
Index: src/main/java/com/wediscussmovies/project/model/exception/PasswordsDontMatchException.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/exception/PasswordsDontMatchException.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/model/exception/PasswordsDontMatchException.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -0,0 +1,7 @@
+package com.wediscussmovies.project.model.exception;
+
+public class PasswordsDontMatchException extends RuntimeException{
+    public PasswordsDontMatchException() {
+        super("The passwords you provided did not match.");
+    }
+}
Index: src/main/java/com/wediscussmovies/project/model/exception/UserWithEmailAlreadyExists.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/exception/UserWithEmailAlreadyExists.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/model/exception/UserWithEmailAlreadyExists.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -0,0 +1,7 @@
+package com.wediscussmovies.project.model.exception;
+
+public class UserWithEmailAlreadyExists extends RuntimeException{
+    public UserWithEmailAlreadyExists(String email) {
+        super("User with the email {" + email +"} is already registered");
+    }
+}
Index: src/main/java/com/wediscussmovies/project/model/exception/UserWithUsernameAlreadyExists.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/exception/UserWithUsernameAlreadyExists.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/model/exception/UserWithUsernameAlreadyExists.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -0,0 +1,7 @@
+package com.wediscussmovies.project.model.exception;
+
+public class UserWithUsernameAlreadyExists extends RuntimeException{
+    public UserWithUsernameAlreadyExists(String username) {
+        super("User with the username " + username + " is already registered");
+    }
+}
Index: src/main/java/com/wediscussmovies/project/repository/DiscussionRepository.java
===================================================================
--- src/main/java/com/wediscussmovies/project/repository/DiscussionRepository.java	(revision 2d57cad1a18953bc47becb4f96114a908ecbf03d)
+++ src/main/java/com/wediscussmovies/project/repository/DiscussionRepository.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -5,5 +5,8 @@
 import org.springframework.stereotype.Repository;
 
+import java.util.List;
+
 @Repository
 public interface DiscussionRepository extends JpaRepository<Discussion, Integer> {
+    public List<Discussion> findAllByTitleLike(String title);
 }
Index: src/main/java/com/wediscussmovies/project/repository/GenreRepository.java
===================================================================
--- src/main/java/com/wediscussmovies/project/repository/GenreRepository.java	(revision 2d57cad1a18953bc47becb4f96114a908ecbf03d)
+++ src/main/java/com/wediscussmovies/project/repository/GenreRepository.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -5,5 +5,8 @@
 import org.springframework.stereotype.Repository;
 
+import java.util.List;
+
 @Repository
 public interface GenreRepository extends JpaRepository<Genre, Integer> {
+    public List<Genre> findAllByGenre(String genre_type);
 }
Index: src/main/java/com/wediscussmovies/project/repository/PersonRepository.java
===================================================================
--- src/main/java/com/wediscussmovies/project/repository/PersonRepository.java	(revision 2d57cad1a18953bc47becb4f96114a908ecbf03d)
+++ src/main/java/com/wediscussmovies/project/repository/PersonRepository.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -2,8 +2,17 @@
 
 import com.wediscussmovies.project.model.Person;
+import com.wediscussmovies.project.model.enumerations.PersonType;
 import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
 import org.springframework.stereotype.Repository;
+
+import java.util.List;
+import java.util.Optional;
 
 @Repository
 public interface PersonRepository extends JpaRepository<Person, Integer> {
+    public List<Person> findAllByPersonType(PersonType type);
+    public List<Person> findAllByPersonTypeAndNameLike(PersonType type, String name);
+    public List<Person> findAllByPersonTypeAndSurnameLike(PersonType type, String surname);
+    public Optional<Person> findPersonByPerson_idAndPersonType(Integer id, PersonType type);
 }
Index: src/main/java/com/wediscussmovies/project/repository/UserRepository.java
===================================================================
--- src/main/java/com/wediscussmovies/project/repository/UserRepository.java	(revision 2d57cad1a18953bc47becb4f96114a908ecbf03d)
+++ src/main/java/com/wediscussmovies/project/repository/UserRepository.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -5,5 +5,12 @@
 import org.springframework.stereotype.Repository;
 
+import java.util.EnumMap;
+import java.util.Optional;
+
 @Repository
 public interface UserRepository extends JpaRepository<User, Integer> {
+    public Optional<User> findByEmailAndPassword(String email, String password);
+    public Optional<User> findByUsernameAndPassword(String email, String password);
+    public Optional<User> findByUsername(String username);
+    public Optional<User> findByEmail(String email);
 }
Index: src/main/java/com/wediscussmovies/project/service/DiscussionService.java
===================================================================
--- src/main/java/com/wediscussmovies/project/service/DiscussionService.java	(revision 2d57cad1a18953bc47becb4f96114a908ecbf03d)
+++ src/main/java/com/wediscussmovies/project/service/DiscussionService.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -1,4 +1,13 @@
 package com.wediscussmovies.project.service;
 
+import com.wediscussmovies.project.model.Discussion;
+
+import java.util.List;
+import java.util.Optional;
+
 public interface DiscussionService {
+    List<Discussion> listAll();
+    List<Discussion> listAllByTitle(String title);
+    Optional<Discussion> findById(Integer id);
+    void save(Discussion discussion);
 }
Index: src/main/java/com/wediscussmovies/project/service/GenreService.java
===================================================================
--- src/main/java/com/wediscussmovies/project/service/GenreService.java	(revision 2d57cad1a18953bc47becb4f96114a908ecbf03d)
+++ src/main/java/com/wediscussmovies/project/service/GenreService.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -1,4 +1,15 @@
 package com.wediscussmovies.project.service;
 
+import com.wediscussmovies.project.model.Genre;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Optional;
+
+@Service
 public interface GenreService {
+    public List<Genre> findAll();
+    public Optional<Genre> findById(Integer id);
+    public List<Genre> findAllByType(String genre);
+    public Genre save(String genreName);
 }
Index: src/main/java/com/wediscussmovies/project/service/MovieService.java
===================================================================
--- src/main/java/com/wediscussmovies/project/service/MovieService.java	(revision 2d57cad1a18953bc47becb4f96114a908ecbf03d)
+++ src/main/java/com/wediscussmovies/project/service/MovieService.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -4,7 +4,11 @@
 
 import java.util.List;
+import java.util.Optional;
 
 public interface MovieService {
     public List<Movie> listAll();
     public List<Movie> searchByTitle(String title);
+    public Optional<Movie> findById(Long id);
+    public Movie save(Movie movie);
+    public void deleteById(Long id);
 }
Index: src/main/java/com/wediscussmovies/project/service/PersonService.java
===================================================================
--- src/main/java/com/wediscussmovies/project/service/PersonService.java	(revision 2d57cad1a18953bc47becb4f96114a908ecbf03d)
+++ src/main/java/com/wediscussmovies/project/service/PersonService.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -1,4 +1,20 @@
 package com.wediscussmovies.project.service;
 
+import com.wediscussmovies.project.model.Person;
+
+import java.util.List;
+import java.util.Optional;
+
 public interface PersonService {
+     List<Person> findAllDirectors();
+     List<Person> findAllActors();
+    Optional<Person> findById(Integer person_id);
+    Optional<Person> findActorById(Integer id);
+    Optional<Person> findDirectorById(Integer id);
+    boolean save(Person person);
+    List<Person> findActorsByNameLike(String name);
+    List<Person> findActorsBySurnameLike(String surname);
+    List<Person> findDirectorsByNameLike(String name);
+    List<Person> findDirectorsBySurnameLike(String surname);
+
 }
Index: src/main/java/com/wediscussmovies/project/service/ReplyService.java
===================================================================
--- src/main/java/com/wediscussmovies/project/service/ReplyService.java	(revision 2d57cad1a18953bc47becb4f96114a908ecbf03d)
+++ src/main/java/com/wediscussmovies/project/service/ReplyService.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -1,4 +1,12 @@
 package com.wediscussmovies.project.service;
 
+import com.wediscussmovies.project.model.Reply;
+
+import java.util.Optional;
+
 public interface ReplyService {
+    public Reply save(Reply r);
+    public void delete(Reply r);
+    Optional<Reply> findById(Long id);
+
 }
Index: src/main/java/com/wediscussmovies/project/service/UserService.java
===================================================================
--- src/main/java/com/wediscussmovies/project/service/UserService.java	(revision 2d57cad1a18953bc47becb4f96114a908ecbf03d)
+++ src/main/java/com/wediscussmovies/project/service/UserService.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -1,4 +1,11 @@
 package com.wediscussmovies.project.service;
 
+import com.wediscussmovies.project.model.User;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Optional;
+
 public interface UserService {
+    public Optional<User> login(String email, String password);
+    public Optional<User> register(HttpServletRequest request, String email, String password, String confirmPassword, String username, String name, String surname);
 }
Index: src/main/java/com/wediscussmovies/project/service/impl/DiscussionServiceImpl.java
===================================================================
--- src/main/java/com/wediscussmovies/project/service/impl/DiscussionServiceImpl.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/service/impl/DiscussionServiceImpl.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -0,0 +1,38 @@
+package com.wediscussmovies.project.service.impl;
+
+import com.wediscussmovies.project.model.Discussion;
+import com.wediscussmovies.project.repository.DiscussionRepository;
+import com.wediscussmovies.project.service.DiscussionService;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Optional;
+
+@Service
+public class DiscussionServiceImpl implements DiscussionService {
+    private final DiscussionRepository discussionRepository;
+
+    public DiscussionServiceImpl(DiscussionRepository discussionRepository) {
+        this.discussionRepository = discussionRepository;
+    }
+
+    @Override
+    public List<Discussion> listAll() {
+        return discussionRepository.findAll();
+    }
+
+    @Override
+    public void save(Discussion discussion) {
+        discussionRepository.save(discussion);
+    }
+
+    @Override
+    public Optional<Discussion> findById(Integer id) {
+        return discussionRepository.findById(id);
+    }
+
+    @Override
+    public List<Discussion> listAllByTitle(String title) {
+        return discussionRepository.findAllByTitleLike("%"+title+"%");
+    }
+}
Index: src/main/java/com/wediscussmovies/project/service/impl/GenreServiceImpl.java
===================================================================
--- src/main/java/com/wediscussmovies/project/service/impl/GenreServiceImpl.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/service/impl/GenreServiceImpl.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -0,0 +1,39 @@
+package com.wediscussmovies.project.service.impl;
+
+import com.wediscussmovies.project.model.Genre;
+import com.wediscussmovies.project.repository.GenreRepository;
+import com.wediscussmovies.project.service.GenreService;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Optional;
+
+@Service
+public class GenreServiceImpl implements GenreService {
+    private final GenreRepository genreRepository;
+
+    public GenreServiceImpl(GenreRepository genreRepository) {
+        this.genreRepository = genreRepository;
+    }
+
+    @Override
+    public Optional<Genre> findById(Integer id) {
+        return genreRepository.findById(id);
+    }
+
+    @Override
+    public List<Genre> findAllByType(String genre) {
+        return genreRepository.findAllByGenre(genre);
+    }
+
+    @Override
+    public Genre save(String genreName) {
+        Genre genre = new Genre(genreName);
+        return genreRepository.save(genre);
+    }
+
+    @Override
+    public List<Genre> findAll() {
+        return genreRepository.findAll();
+    }
+}
Index: src/main/java/com/wediscussmovies/project/service/impl/MovieServiceImpl.java
===================================================================
--- src/main/java/com/wediscussmovies/project/service/impl/MovieServiceImpl.java	(revision 2d57cad1a18953bc47becb4f96114a908ecbf03d)
+++ src/main/java/com/wediscussmovies/project/service/impl/MovieServiceImpl.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -7,4 +7,5 @@
 
 import java.util.List;
+import java.util.Optional;
 
 @Service
@@ -22,6 +23,23 @@
 
     @Override
+    public Optional<Movie> findById(Long id) {
+        return movieRepository.findById(1);
+    }
+
+    @Override
+    public Movie save(Movie movie) {
+        return movieRepository.save(movie);
+    }
+
+    @Override
+    public void deleteById(Long id) {
+        movieRepository.deleteById(0);
+    }
+
+    @Override
     public List<Movie> searchByTitle(String title) {
         return movieRepository.findAllByTitleLike("%"+title+"%");
     }
 }
+
+
Index: src/main/java/com/wediscussmovies/project/service/impl/PersonServiceImpl.java
===================================================================
--- src/main/java/com/wediscussmovies/project/service/impl/PersonServiceImpl.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/service/impl/PersonServiceImpl.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -0,0 +1,73 @@
+package com.wediscussmovies.project.service.impl;
+
+import com.wediscussmovies.project.model.Person;
+import com.wediscussmovies.project.model.enumerations.PersonType;
+import com.wediscussmovies.project.repository.PersonRepository;
+import com.wediscussmovies.project.service.PersonService;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Optional;
+
+@Service
+public class PersonServiceImpl implements PersonService {
+    private final PersonRepository personRepository;
+
+
+    public PersonServiceImpl(PersonRepository personRepository) {
+        this.personRepository = personRepository;
+    }
+
+    @Override
+    public List<Person> findAllDirectors() {
+        return personRepository.findAllByPersonType(PersonType.D);
+    }
+
+    @Override
+    public Optional<Person> findActorById(Integer id) {
+        return personRepository.findPersonByPerson_idAndPersonType(id, PersonType.A);
+    }
+
+    @Override
+    public Optional<Person> findById(Integer person_id) {
+        return personRepository.findById(person_id);
+    }
+
+    @Override
+    public Optional<Person> findDirectorById(Integer id) {
+        return personRepository.findPersonByPerson_idAndPersonType(id, PersonType.D);
+    }
+
+    @Override
+    public List<Person> findAllActors() {
+        return personRepository.findAllByPersonType(PersonType.A);
+    }
+
+    @Override
+    public boolean save(Person person) {
+        Person p = personRepository.save(person);
+        if(p != null)
+            return true;
+        return false;
+    }
+
+    @Override
+    public List<Person> findActorsByNameLike(String name) {
+        return personRepository.findAllByPersonTypeAndNameLike(PersonType.A, name);
+    }
+
+    @Override
+    public List<Person> findActorsBySurnameLike(String surname) {
+        return personRepository.findAllByPersonTypeAndSurnameLike(PersonType.A, surname);
+    }
+
+    @Override
+    public List<Person> findDirectorsByNameLike(String name) {
+        return personRepository.findAllByPersonTypeAndNameLike(PersonType.D, name);
+    }
+
+    @Override
+    public List<Person> findDirectorsBySurnameLike(String surname) {
+        return personRepository.findAllByPersonTypeAndSurnameLike(PersonType.D, surname);
+    }
+}
Index: src/main/java/com/wediscussmovies/project/service/impl/ReplyServiceImpl.java
===================================================================
--- src/main/java/com/wediscussmovies/project/service/impl/ReplyServiceImpl.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/service/impl/ReplyServiceImpl.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -0,0 +1,32 @@
+package com.wediscussmovies.project.service.impl;
+
+import com.wediscussmovies.project.model.Reply;
+import com.wediscussmovies.project.repository.ReplyRepository;
+import com.wediscussmovies.project.service.ReplyService;
+import org.springframework.stereotype.Service;
+
+import java.util.Optional;
+
+@Service
+public class ReplyServiceImpl implements ReplyService {
+    private final ReplyRepository replyRepository;
+
+    public ReplyServiceImpl(ReplyRepository replyRepository) {
+        this.replyRepository = replyRepository;
+    }
+
+    @Override
+    public Optional<Reply> findById(Long id) {
+        return replyRepository.findById(1);
+    }
+
+    @Override
+    public void delete(Reply r) {
+        replyRepository.delete(r);
+    }
+
+    @Override
+    public Reply save(Reply r) {
+        return replyRepository.save(r);
+    }
+}
Index: src/main/java/com/wediscussmovies/project/service/impl/UserServiceImpl.java
===================================================================
--- src/main/java/com/wediscussmovies/project/service/impl/UserServiceImpl.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/service/impl/UserServiceImpl.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -0,0 +1,61 @@
+package com.wediscussmovies.project.service.impl;
+
+import com.wediscussmovies.project.model.PasswordEncoder;
+import com.wediscussmovies.project.model.User;
+import com.wediscussmovies.project.model.exception.PasswordsDontMatchException;
+import com.wediscussmovies.project.model.exception.UserWithEmailAlreadyExists;
+import com.wediscussmovies.project.model.exception.UserWithUsernameAlreadyExists;
+import com.wediscussmovies.project.repository.UserRepository;
+import com.wediscussmovies.project.service.UserService;
+import org.springframework.http.HttpRequest;
+import org.springframework.stereotype.Service;
+
+import javax.servlet.http.HttpServletRequest;
+import java.security.NoSuchAlgorithmException;
+import java.util.Optional;
+
+@Service
+public class UserServiceImpl implements UserService {
+    private final UserRepository userRepository;
+
+    public UserServiceImpl(UserRepository userRepository) {
+        this.userRepository = userRepository;
+    }
+
+    @Override
+    public Optional<User> login(String email, String password) {
+        Optional<User> userEmail = userRepository.findByEmailAndPassword(email, password);
+        Optional<User> userUsername = userRepository.findByUsernameAndPassword(email, password);
+        if(userEmail.isPresent())
+            return userEmail;
+        else if(userUsername.isPresent())
+            return userUsername;
+        else
+            return Optional.empty();
+    }
+
+    @Override
+    public Optional<User> register(HttpServletRequest request, String email, String password, String confirmPassword,
+                                   String username, String name, String surname) {
+        if(email == null || email.isEmpty() || password == null || password.isEmpty() ||
+                confirmPassword == null || confirmPassword.isEmpty() || username == null || username.isEmpty() ||
+                name == null || name.isEmpty() || surname == null || surname.isEmpty()) {
+            request.getSession().setAttribute("error", "Not all of the fields had a value in them, check again.");
+            return Optional.empty();
+        }
+        if(userRepository.findByUsername(username).isPresent()){
+            request.getSession().setAttribute("error", new UserWithUsernameAlreadyExists(username).getMessage());
+            return Optional.empty();
+        }
+        if(userRepository.findByEmail(email).isPresent()){
+            request.getSession().setAttribute("error", new UserWithEmailAlreadyExists(email).getMessage());
+            return Optional.empty();
+        }
+        if(!password.equals(confirmPassword)){
+            request.getSession().setAttribute("error", new PasswordsDontMatchException().getMessage());
+            return Optional.empty();
+        }
+        User user = new User(email, username, password, name, surname);
+        return Optional.of(userRepository.save(user));
+    }
+}
Index: src/main/java/com/wediscussmovies/project/web/controller/DiscussionsController.java
===================================================================
--- src/main/java/com/wediscussmovies/project/web/controller/DiscussionsController.java	(revision 2d57cad1a18953bc47becb4f96114a908ecbf03d)
+++ src/main/java/com/wediscussmovies/project/web/controller/DiscussionsController.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -1,7 +1,145 @@
 package com.wediscussmovies.project.web.controller;
 
+import com.wediscussmovies.project.model.*;
+import com.wediscussmovies.project.model.enumerations.DiscussionType;
+import com.wediscussmovies.project.service.DiscussionService;
+import com.wediscussmovies.project.service.MovieService;
+import com.wediscussmovies.project.service.PersonService;
+import com.wediscussmovies.project.service.ReplyService;
 import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import java.sql.Date;
+import java.time.LocalDate;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
 
 @Controller
+@RequestMapping("/discussions")
 public class DiscussionsController {
+    private final DiscussionService discussionService;
+    private final ReplyService replyService;
+    private final MovieService movieService;
+    private final PersonService personService;
+    public DiscussionsController(DiscussionService discussionService, ReplyService replyService, MovieService movieService, PersonService personService) {
+        this.discussionService = discussionService;
+        this.replyService = replyService;
+        this.movieService = movieService;
+        this.personService = personService;
+    }
+
+    @GetMapping("/")
+    public String getDiscussions(@RequestParam(required = false) String titleSearch,
+                                    Model model){
+        List<Discussion> discussions = discussionService.listAll();
+        if(titleSearch != null && !titleSearch.isEmpty()){
+            discussions = discussionService.listAllByTitle(titleSearch);
+        }
+        model.addAttribute("discussions", discussions);
+        model.addAttribute("contentTemplate", "discussionsList");
+        return "template";
+    }
+
+    @GetMapping("/{id}")
+    public String getDiscussion(
+            @PathVariable Integer id,
+            Model model){
+        Optional<Discussion> discussion = discussionService.findById(id);
+        if(discussion.isEmpty())
+            return "redirect:/discussions";
+        model.addAttribute("discussion", discussion);
+        model.addAttribute("contentTemplate", "discussionsDiscussion");
+        return "template";
+    }
+
+    @GetMapping("/{id}/reply")
+    public String getReplyToDiscussion(
+            @PathVariable Integer id,
+            Model model){
+        Optional<Discussion> discussion = discussionService.findById(id);
+        if(discussion.isEmpty())
+            return "redirect:/discussions";
+        model.addAttribute("discussion", discussion);
+        model.addAttribute("contentTemplate", "discussionsReply");
+        return "template";
+    }
+    @PostMapping("/{id}/reply/confirm")
+    public String getReplyToDiscussionConfirm(
+            @PathVariable Integer id,
+            @RequestParam String text,
+            HttpServletRequest request){
+        Optional<Discussion> discussion = discussionService.findById(id);
+        User user = (User) request.getSession().getAttribute("user");
+        if(user == null){
+            return "redirect:/login";
+        }
+        Date date = Date.valueOf(LocalDate.now());
+        if(discussion.isEmpty())
+            return "redirect:/discussions";
+        Reply reply = new Reply(discussion.get(), user, date, text);
+        replyService.save(reply);
+        return "redirect:/discussions/"+id;
+    }
+
+    @GetMapping("/movies/add/{id}")
+    public String getAddDiscussionForMovie(Model model,
+                                           @PathVariable Integer id,
+                                           HttpServletRequest request){
+        model.addAttribute("contentTemplate", "discussionsAdd");
+        request.setAttribute("movieId", id);
+        return "template";
+    }
+
+    @PostMapping("/movies/add/confirm")
+    public String getAddDiscussionMovieConfirm(Model model,
+                                               HttpServletRequest request,
+                                               @RequestParam String title,
+                                               @RequestParam String text){
+        User user = (User) request.getSession().getAttribute("user");
+        if(user == null){
+            return "redirect:/login";
+        }
+        Long movie_id = (Long) request.getSession().getAttribute("movieId");
+        request.getSession().setAttribute("movieId", null);
+        Optional<Movie> movieOp = movieService.findById(movie_id);
+        if(movieOp.isEmpty())
+            return "redirect:/movies";
+        Discussion discussion = new Discussion(DiscussionType.M,text, title, Date.valueOf(LocalDate.now()),user,movieOp.get(),null,new ArrayList<>());
+        discussionService.save(discussion);
+        return "redirect:/discussions";
+    }
+
+
+    @GetMapping("/persons/add/{id}")
+    public String getAddDiscussionForPerson(Model model,
+                                           @PathVariable Integer id,
+                                           HttpServletRequest request){
+        model.addAttribute("contentTemplate", "discussionsAdd");
+        request.setAttribute("personId", id);
+        return "template";
+    }
+
+    @PostMapping("/persons/add/confirm")
+    public String getAddDiscussionForPersonConfirm(Model model,
+                                               HttpServletRequest request,
+                                               @RequestParam String title,
+                                               @RequestParam String text){
+        User user = (User) request.getSession().getAttribute("user");
+        if(user == null){
+            return "redirect:/login";
+        }
+        Integer person_id = (Integer) request.getSession().getAttribute("personId");
+        Optional<Person> personOp = personService.findById(person_id);
+        request.getSession().setAttribute("personId", null);
+        if(personOp.isEmpty())
+            return "redirect:/discussions";
+        Discussion discussion = new Discussion(DiscussionType.P,title, text,Date.valueOf(LocalDate.now()),user,null,personOp.get(),new ArrayList<>());
+        discussionService.save(discussion);
+        return "redirect:/discussions";
+    }
+
+
 }
Index: src/main/java/com/wediscussmovies/project/web/controller/MovieController.java
===================================================================
--- src/main/java/com/wediscussmovies/project/web/controller/MovieController.java	(revision 2d57cad1a18953bc47becb4f96114a908ecbf03d)
+++ src/main/java/com/wediscussmovies/project/web/controller/MovieController.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -1,13 +1,19 @@
 package com.wediscussmovies.project.web.controller;
 
+import com.wediscussmovies.project.exception.MovieIdNotFoundException;
+import com.wediscussmovies.project.model.Genre;
 import com.wediscussmovies.project.model.Movie;
+import com.wediscussmovies.project.model.Person;
+import com.wediscussmovies.project.service.GenreService;
 import com.wediscussmovies.project.service.MovieService;
+import com.wediscussmovies.project.service.PersonService;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-
+import org.springframework.web.bind.annotation.*;
+
+import java.sql.Date;
+import java.util.LinkedList;
 import java.util.List;
+import java.util.Optional;
 
 @Controller
@@ -15,7 +21,11 @@
 public class MovieController {
     private final MovieService movieService;
-
-    public MovieController(MovieService movieService) {
+    private final GenreService genreService;
+    private final PersonService personService;
+
+    public MovieController(MovieService movieService, GenreService genreService, PersonService personService) {
         this.movieService = movieService;
+        this.genreService = genreService;
+        this.personService = personService;
     }
 
@@ -29,4 +39,7 @@
             movies = movieService.searchByTitle(titleQuery);
         }
+
+        movies.sort(Movie.comparatorTitle);
+
         model.addAttribute("movies", movies);
         model.addAttribute("contentTemplate", "moviesList");
@@ -34,3 +47,178 @@
     }
 
+
+    @GetMapping("/add")
+    public String addMovie(Model model){
+        model.addAttribute("directors", personService.findAllDirectors());
+        model.addAttribute("actors", personService.findAllActors());
+        model.addAttribute("genres", genreService.findAll());
+        model.addAttribute("contentTemplate", "moviesAdd");
+        return "template";
+    }
+
+
+    @PostMapping("/{id}/delete")
+    public String addMovie(@PathVariable Long id){
+        Optional<Movie> movie = movieService.findById(id);
+        if(movie.isPresent()){
+            movieService.deleteById(movie.get().getId());
+        }
+        return "redirect:/movies";
+    }
+
+    @PostMapping("/add/confirm")
+    public String addMoviePost(@RequestParam String title,
+                               @RequestParam String description,
+                               @RequestParam String image_url,
+                               @RequestParam Date airing_date,
+                               @RequestParam Double rating,
+                               @RequestParam Integer director_id,
+                               @RequestParam List<Integer> actors,
+                               @RequestParam List<Integer> genres,
+                               Model model){
+        if(title == null || title.isEmpty() ||
+        description == null || description.isEmpty() ||
+        image_url == null || image_url.isEmpty() ||
+        airing_date == null ||
+        rating == null ||
+        director_id == null ||
+        actors == null || actors.size() == 0 ||
+        genres == null || genres.size() == 0)
+        {
+            model.addAttribute("error", "Not enough attributes, make sure all values are inputted, all of them are required");
+            model.addAttribute("hasError", true);
+            return "redirect:/add";
+        }
+        List<Person> actorsList = new LinkedList<>();
+        for(Integer id: actors){
+            Optional<Person> person = personService.findActorById(id);
+            if(person.isEmpty()){
+                model.addAttribute("error", "The actor with ID {" + id + "} was not found.");
+                model.addAttribute("hasError", true);
+                return "redirect:/add";
+            }
+            actorsList.add(person.get());
+        }
+
+        List<Genre> genreList = new LinkedList<>();
+        for(Integer id: genres){
+            Optional<Genre> genre = genreService.findById(id);
+            if(genre.isEmpty()){
+                model.addAttribute("error", "The genre with ID {" + id + "} was not found.");
+                model.addAttribute("hasError", true);
+                return "redirect:/add";
+            }
+            genreList.add(genre.get());
+        }
+
+        Optional<Person> directorOp = personService.findDirectorById(director_id);
+        if(directorOp.isEmpty()){
+            model.addAttribute("error", "The director with ID {" + director_id + "} was not found.");
+            model.addAttribute("hasError", true);
+            return "redirect:/add";
+        }
+
+        Person director = directorOp.get();
+
+        Movie movie = new Movie(title, description, image_url, airing_date,
+                    rating, director, actorsList, genreList);
+
+        movieService.save(movie);
+
+        return "redirect:/movies";
+    }
+
+    @PostMapping("/edit/confirm")
+    public String editMoviePost(
+                                @RequestParam Long movie_id,
+                                @RequestParam String title,
+                               @RequestParam String description,
+                               @RequestParam String image_url,
+                               @RequestParam Date airing_date,
+                               @RequestParam Double rating,
+                               @RequestParam Integer director_id,
+                               @RequestParam List<Integer> actors,
+                               @RequestParam List<Integer> genres,
+                               Model model){
+        if(
+                movie_id == null ||
+                title == null || title.isEmpty() ||
+                description == null || description.isEmpty() ||
+                image_url == null || image_url.isEmpty() ||
+                airing_date == null ||
+                rating == null ||
+                director_id == null ||
+                actors == null || actors.size() == 0 ||
+                genres == null || genres.size() == 0)
+        {
+            model.addAttribute("error", "Not enough attributes, make sure all values are inputted, all of them are required");
+            model.addAttribute("hasError", true);
+            return "redirect:/edit";
+        }
+
+        Optional<Movie> movieOptional = movieService.findById(movie_id);
+        if(movieOptional.isEmpty()){
+            model.addAttribute("error", "The movie with ID {" + movie_id + "} was not found.");
+            model.addAttribute("hasError", true);
+            return "redirect:/edit";
+        }
+        Movie movie = movieOptional.get();
+
+        List<Person> actorsList = new LinkedList<>();
+        for(Integer id: actors){
+            Optional<Person> person = personService.findActorById(id);
+            if(person.isEmpty()){
+                model.addAttribute("error", "The actor with ID {" + id + "} was not found.");
+                model.addAttribute("hasError", true);
+                return "redirect:/edit";
+            }
+            actorsList.add(person.get());
+        }
+
+        List<Genre> genreList = new LinkedList<>();
+        for(Integer id: genres){
+            Optional<Genre> genre = genreService.findById(id);
+            if(genre.isEmpty()){
+                model.addAttribute("error", "The genre with ID {" + id + "} was not found.");
+                model.addAttribute("hasError", true);
+                return "redirect:/edit";
+            }
+            genreList.add(genre.get());
+        }
+
+        Optional<Person> directorOp = personService.findDirectorById(director_id);
+        if(directorOp.isEmpty()){
+            model.addAttribute("error", "The director with ID {" + director_id + "} was not found.");
+            model.addAttribute("hasError", true);
+            return "redirect:/edit";
+        }
+
+        Person director = directorOp.get();
+
+        movieService.deleteById(movie_id);
+
+        movie.setActors(actorsList);
+        movie.setDirector(director);
+        movie.setGenres(genreList);
+        movie.setTitle(title);
+        movie.setDescription(description);
+        movie.setAringDate(airing_date);
+        movie.setImageUrl(image_url);
+        movie.setImbdRating(rating);
+
+        movieService.save(movie);
+
+        return "redirect:/movies";
+    }
+
+    @GetMapping("/{id}/edit")
+    public String editMovie(@PathVariable Long id, Model model){
+        Movie movie = movieService.findById(id).orElseThrow(() -> new MovieIdNotFoundException(id));
+        model.addAttribute("directors", personService.findAllDirectors());
+        model.addAttribute("actors", personService.findAllActors());
+        model.addAttribute("genres", genreService.findAll());
+        model.addAttribute("movie", movie);
+        model.addAttribute("contentTemplate", "moviesEdit");
+        return "template";
+    }
 }
Index: src/main/java/com/wediscussmovies/project/web/controller/PersonsController.java
===================================================================
--- src/main/java/com/wediscussmovies/project/web/controller/PersonsController.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/web/controller/PersonsController.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -0,0 +1,119 @@
+package com.wediscussmovies.project.web.controller;
+
+import com.wediscussmovies.project.model.Person;
+import com.wediscussmovies.project.model.enumerations.PersonType;
+import com.wediscussmovies.project.service.PersonService;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.sql.Date;
+import java.util.List;
+
+@Controller
+@RequestMapping(".")
+public class PersonsController {
+    private final PersonService personSerivce;
+
+    public PersonsController(PersonService personSerivce) {
+        this.personSerivce = personSerivce;
+    }
+
+    @GetMapping("/actors")
+    public String getActorsPage(Model model, @RequestParam(required = false) String nameAndSurname){
+        List<Person> actors = personSerivce.findAllActors();
+        if(nameAndSurname != null && !nameAndSurname.isEmpty()){
+            String [] parts = nameAndSurname.split(" ");
+            String name = parts[0];
+            String surname = "";
+            if(parts.length > 1)
+                surname = parts[1];
+            List<Person> actorsByName = personSerivce.findActorsByNameLike("%"+name+"%");
+            if(!surname.isEmpty()){
+                List<Person> actorsBySurname = personSerivce.findActorsBySurnameLike("%"+surname+"%");
+                for(Person p: actorsBySurname){
+                    boolean add = true;
+                    for(Person a: actorsByName){
+                        if(a.getPersonId() == p.getPersonId()){
+                            add=false;
+                            break;
+                        }
+                    }
+                    if(!add)
+                        continue;
+                    actorsByName.add(p);
+                }
+            }
+            actors = actorsByName;
+        }
+       // actors.sort(Person.personComparatorByNameSurname);
+        model.addAttribute("actors", actors);
+        model.addAttribute("contentTemplate", "actorsList");
+        return "template";
+    }
+
+    @GetMapping("/directors")
+    public String getDirectorsPage(Model model, @RequestParam(required = false) String nameAndSurname){
+        List<Person> directors = personSerivce.findAllDirectors();
+        if(nameAndSurname != null && !nameAndSurname.isEmpty()){
+            String [] parts = nameAndSurname.split(" ");
+            String name = parts[0];
+            String surname = "";
+            if(parts.length > 1)
+                surname = parts[1];
+            List<Person> directorsByName = personSerivce.findDirectorsByNameLike("%"+name+"%");
+            if(!surname.isEmpty()){
+                List<Person> directorsBySurname = personSerivce.findDirectorsBySurnameLike("%"+surname+"%");
+                for(Person p: directorsBySurname){
+                    boolean add = true;
+                    for(Person a: directorsByName){
+                        if(a.getPersonId() == p.getPersonId()){
+                            add=false;
+                            break;
+                        }
+                    }
+                    if(!add)
+                        continue;
+                    directorsByName.add(p);
+                }
+            }
+            directors = directorsByName;
+        }
+     //   directors.sort(Person.personComparatorByNameSurname);
+        model.addAttribute("directors", directors);
+        model.addAttribute("contentTemplate", "directorsList");
+        return "template";
+    }
+
+    @GetMapping("/persons/add")
+    public String getPersonsAddPage(Model model){
+        PersonType [] types = PersonType.values();
+        model.addAttribute("types", types);
+        model.addAttribute("contentTemplate", "personsAdd");
+        return "template";
+    }
+
+    @PostMapping("/persons/add/confirm")
+    public String confirmPersonsAdd(
+            @RequestParam String name,
+            @RequestParam String surname,
+            @RequestParam PersonType type,
+            @RequestParam Date date_of_birth,
+            @RequestParam String image_url,
+            @RequestParam String description){
+        Person person = new Person(name, surname, type, date_of_birth, image_url, description);
+        if(personSerivce.save(person)){
+            String toWhere = "actors";
+            if(type == PersonType.D)
+                toWhere = "directors";
+            return "redirect:/"+toWhere;
+        }
+        else{
+            return "redirect:/persons/add";
+        }
+    }
+
+}
Index: src/main/java/com/wediscussmovies/project/web/controller/ReplyController.java
===================================================================
--- src/main/java/com/wediscussmovies/project/web/controller/ReplyController.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/web/controller/ReplyController.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -0,0 +1,41 @@
+package com.wediscussmovies.project.web.controller;
+
+import com.wediscussmovies.project.model.Reply;
+import com.wediscussmovies.project.service.ReplyService;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.util.Optional;
+
+public class ReplyController {
+    private final ReplyService replyService;
+
+    public ReplyController(ReplyService replyService) {
+        this.replyService = replyService;
+    }
+
+    @GetMapping("/edit/{id}")
+    public String getReplyEdit(@PathVariable Long id, Model model){
+        Optional<Reply> reply = replyService.findById(id);
+        if(reply.isEmpty())
+            return "redirect:/movies";
+        model.addAttribute("reply", reply.get());
+        model.addAttribute("templateContext", "replyEdit");
+        return "template";
+    }
+
+    @PostMapping("/edit/confirm/{id}")
+    public String getReplyEdit(@PathVariable Long id, @RequestParam String text){
+        Optional<Reply> replyOp = replyService.findById(id);
+        if(replyOp.isEmpty())
+            return "redirect:/discussions";
+        Reply reply = replyOp.get();
+        replyService.delete(reply);
+        reply.setText(text);
+        replyService.save(reply);
+        return "redirect:/discussions/"+reply.getDiscussion().getId();
+    }
+}
Index: src/main/java/com/wediscussmovies/project/web/controller/UserController.java
===================================================================
--- src/main/java/com/wediscussmovies/project/web/controller/UserController.java	(revision 2d57cad1a18953bc47becb4f96114a908ecbf03d)
+++ src/main/java/com/wediscussmovies/project/web/controller/UserController.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -1,7 +1,100 @@
 package com.wediscussmovies.project.web.controller;
 
+import com.wediscussmovies.project.model.PasswordEncoder;
+import com.wediscussmovies.project.model.User;
+import com.wediscussmovies.project.model.exception.InvalidUserCredentialsException;
+import com.wediscussmovies.project.service.UserService;
 import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import javax.servlet.http.HttpServletRequest;
+import java.security.NoSuchAlgorithmException;
+import java.util.Optional;
 
 @Controller
+@RequestMapping("/")
 public class UserController {
+    private final UserService userService;
+
+    public UserController(UserService userService) {
+        this.userService = userService;
+    }
+
+    @GetMapping("/login")
+    public String getLoginPage(Model model){
+        return "login";
+    }
+
+    @PostMapping("/login/confirm")
+    public String confirmLogin(HttpServletRequest request, Model model,
+                               @RequestParam String username,
+                               @RequestParam String password){
+        Optional<User> user;
+        try{
+            password = PasswordEncoder.getEncodedPasswordString(password);
+        }
+        catch (NoSuchAlgorithmException ex){
+            model.addAttribute("hasError", true);
+            model.addAttribute("error", ex.getMessage());
+            return "login";
+        }
+
+        try{
+            user = this.userService.login(username, password);
+            request.getSession().setAttribute("user", user);
+            request.getSession().setAttribute("loggedIn",true);
+            return "redirect:/movies";
+        }
+        catch (InvalidUserCredentialsException ex){
+            model.addAttribute("hasError", true);
+            model.addAttribute("error", ex.getMessage());
+            return "login";
+        }
+    }
+
+    @GetMapping("/register")
+    public String getRegisterPage(){
+        return "register";
+    }
+
+    @PostMapping("/login/confirm")
+    public String confirmRegister(HttpServletRequest request,
+                                  @RequestParam String username,
+                                  @RequestParam String email,
+                                  @RequestParam String password,
+                                  @RequestParam String confirmPassword,
+                                  @RequestParam String name,
+                                  @RequestParam String surname){
+        Optional<User> user;
+
+        try{
+            password = PasswordEncoder.getEncodedPasswordString(password);
+            confirmPassword = PasswordEncoder.getEncodedPasswordString(confirmPassword);
+        }
+        catch (NoSuchAlgorithmException ex){
+            request.getSession().setAttribute("error", "Contact the administrators!");
+            request.getSession().setAttribute("hasError", "true");
+            return "redirect:/movies";
+        }
+
+        user = this.userService.register(request, email, password, confirmPassword, username, name, surname);
+        if(user.isEmpty()){
+            request.setAttribute("hasError", "true");
+        }else{
+            request.getSession().setAttribute("hasError", "false");
+            request.getSession().setAttribute("user", user.get());
+            request.getSession().setAttribute("loggedIn",true);
+        }
+        return "redirect:/movies";
+    }
+
+    @GetMapping
+    public String logout(HttpServletRequest request){
+        request.getSession().invalidate();
+        return "redirect:/login";
+    }
 }
Index: target/classes/application-prod.properties
===================================================================
--- target/classes/application-prod.properties	(revision 2d57cad1a18953bc47becb4f96114a908ecbf03d)
+++ target/classes/application-prod.properties	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
@@ -1,4 +1,4 @@
 spring.datasource.url=jdbc:postgresql://localhost:5432/db_202122z_va_prj_wediscussmovies
-spring.datasource.username=db_202122z_va_prj_wediscussmovies_owner
+spring.datasource.username=db_202122z_va_prj_wediscussmovies_owner_193113
 spring.datasource.password=7d8fb26b5697
 
