Index: src/main/java/com/wediscussmovies/project/LoggedUser.java
===================================================================
--- src/main/java/com/wediscussmovies/project/LoggedUser.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/java/com/wediscussmovies/project/LoggedUser.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,20 @@
+package com.wediscussmovies.project;
+
+import com.wediscussmovies.project.model.User;
+import org.springframework.security.authentication.AnonymousAuthenticationToken;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.security.core.userdetails.UserDetails;
+
+public class LoggedUser {
+
+    static  public User getLoggedUser(){
+
+        Authentication auth = SecurityContextHolder.getContext().getAuthentication();
+        if (!(auth instanceof AnonymousAuthenticationToken)) {
+            UserDetails userDetails = (UserDetails) auth.getPrincipal();
+            return (User) userDetails;
+        }
+        return null;
+    }
+}
Index: src/main/java/com/wediscussmovies/project/ajaxmodels/Grade.java
===================================================================
--- src/main/java/com/wediscussmovies/project/ajaxmodels/Grade.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/java/com/wediscussmovies/project/ajaxmodels/Grade.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,14 @@
+package com.wediscussmovies.project.ajaxmodels;
+
+import lombok.Data;
+
+@Data
+public class Grade {
+    private Integer rating;
+    private String reason;
+
+    public Grade(String rating, String reason) {
+        this.rating = Integer.parseInt(rating);
+        this.reason = reason;
+    }
+}
Index: src/main/java/com/wediscussmovies/project/configuration/CustomUsernamePasswordAuthenticationProvider.java
===================================================================
--- src/main/java/com/wediscussmovies/project/configuration/CustomUsernamePasswordAuthenticationProvider.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/java/com/wediscussmovies/project/configuration/CustomUsernamePasswordAuthenticationProvider.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,48 @@
+package com.wediscussmovies.project.configuration;
+
+import com.wediscussmovies.project.service.UserService;
+import org.springframework.security.authentication.AuthenticationProvider;
+import org.springframework.security.authentication.BadCredentialsException;
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.security.crypto.password.PasswordEncoder;
+import org.springframework.stereotype.Component;
+
+import javax.naming.AuthenticationException;
+
+@Component
+public class CustomUsernamePasswordAuthenticationProvider implements AuthenticationProvider {
+
+    private final UserService userService;
+    private final PasswordEncoder passwordEncoder;
+
+    public CustomUsernamePasswordAuthenticationProvider(UserService userService, PasswordEncoder passwordEncoder) {
+        this.userService = userService;
+        this.passwordEncoder = passwordEncoder;
+    }
+
+    @Override
+    public Authentication authenticate(Authentication authentication){
+        String username = authentication.getName();
+        String password = authentication.getCredentials().toString();
+
+        if ("".equals(username) || "".equals(password)) {
+            throw new BadCredentialsException("Invalid Credentials");
+        }
+
+        UserDetails userDetails = this.userService.loadUserByUsername(username);
+
+        if (!passwordEncoder.matches(password, userDetails.getPassword())) {
+            throw new BadCredentialsException("Password is incorrect!");
+        }
+        return new UsernamePasswordAuthenticationToken(userDetails, userDetails.getPassword(), userDetails.getAuthorities());
+
+    }
+
+    @Override
+    public boolean supports(Class<?> aClass) {
+        return aClass.equals(UsernamePasswordAuthenticationToken.class);
+    }
+}
+
Index: src/main/java/com/wediscussmovies/project/configuration/SecurityConfig.java
===================================================================
--- src/main/java/com/wediscussmovies/project/configuration/SecurityConfig.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/java/com/wediscussmovies/project/configuration/SecurityConfig.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,46 @@
+package com.wediscussmovies.project.configuration;
+
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
+
+@Configuration
+public class SecurityConfig extends WebSecurityConfigurerAdapter {
+    private final CustomUsernamePasswordAuthenticationProvider authenticationProvider;
+
+    public SecurityConfig(CustomUsernamePasswordAuthenticationProvider authenticationProvider) {
+        this.authenticationProvider = authenticationProvider;
+    }
+
+
+    @Override
+    public void configure(HttpSecurity http) throws Exception {
+        // TODO: If you are implementing the security requirements, remove this following line
+        http.csrf().disable()
+                .authorizeRequests()
+                .antMatchers("/movies","/actors","/directors","/discussions","/replies","/register","/genres").permitAll()
+                .anyRequest()
+                .authenticated()
+                .and()
+                .formLogin()
+                .loginPage("/login")
+                .permitAll()
+                .failureUrl("/login?error=BadCredentials")
+                .defaultSuccessUrl("/movies", true)
+                .and()
+                .logout()
+                .logoutUrl("/logout")
+                .clearAuthentication(true)
+                .invalidateHttpSession(true)
+                .deleteCookies("JSESSIONID")
+                .logoutSuccessUrl("/movies");
+
+    }
+
+    @Override
+    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
+        auth.authenticationProvider(authenticationProvider);
+    }
+}
Index: src/main/java/com/wediscussmovies/project/model/Discussion.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/Discussion.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/java/com/wediscussmovies/project/model/Discussion.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,90 @@
+package com.wediscussmovies.project.model;
+
+import lombok.Data;
+
+import javax.persistence.*;
+import java.sql.Date;
+import java.util.Objects;
+
+@Entity
+@Table(name = "discussions", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
+@Data
+public class Discussion {
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Id
+    @Column(name = "discussion_id")
+    private int discussionId;
+    @Basic
+    @Column(name = "type")
+    private Character type;
+    @Basic
+    @Column(name = "text")
+    private String text;
+    @Basic
+    @Column(name = "title")
+    private String title;
+    @Basic
+    @Column(name = "date")
+    private Date date;
+
+
+    @ManyToOne
+    @JoinColumn(name = "movie_id")
+    private Movie movie;
+
+    @ManyToOne
+    @JoinColumn(name = "user_id")
+    private User user;
+
+    @ManyToOne
+    @JoinColumn(name = "person_id")
+    private Person person;
+
+    public Discussion(Character type, String text, String title, Date date, User user) {
+        this.type = type;
+        this.text = text;
+        this.title = title;
+        this.date = date;
+        this.user = user;
+    }
+
+    public Discussion() {
+    }
+
+    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;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        Discussion that = (Discussion) o;
+        return discussionId == that.discussionId;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(discussionId);
+    }
+}
Index: src/main/java/com/wediscussmovies/project/model/Genre.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/Genre.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/java/com/wediscussmovies/project/model/Genre.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,40 @@
+package com.wediscussmovies.project.model;
+
+import lombok.Data;
+
+import javax.persistence.*;
+import java.util.Objects;
+
+@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
+    @Column(name = "genre_type")
+    private String genreType;
+
+    public Genre() {
+
+    }
+
+    public Genre(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 genre = (Genre) o;
+        return genreId == genre.genreId;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(genreId);
+    }
+}
Index: src/main/java/com/wediscussmovies/project/model/Movie.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/Movie.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/java/com/wediscussmovies/project/model/Movie.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,88 @@
+package com.wediscussmovies.project.model;
+
+import com.wediscussmovies.project.model.relation.MovieLikes;
+import com.wediscussmovies.project.model.relation.MovieActors;
+import com.wediscussmovies.project.model.relation.MovieGenres;
+import com.wediscussmovies.project.model.relation.MovieRates;
+import lombok.Data;
+
+import javax.persistence.*;
+import java.sql.Date;
+import java.util.Collection;
+import java.util.Comparator;
+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 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
+    @Column(name = "imdb_rating")
+    private Double imdbRating;
+
+    @OneToMany(mappedBy = "movie")
+    private Collection<MovieActors> actors;
+    @OneToMany(mappedBy = "movie")
+    private Collection<MovieGenres> genres;
+    @OneToMany(mappedBy = "movie")
+    private Collection<MovieLikes> likes;
+    @OneToMany(mappedBy = "movie")
+    private Collection<MovieRates> rates;
+
+    @ManyToOne
+    @JoinColumn(name = "director_id")
+    private Person director;
+
+    public Movie() {
+
+    }
+
+    public Movie(String title, String description, String imageUrl, Date airingDate,
+                 Double imdbRating, Person director) {
+        this.title = title;
+        this.description = description;
+        this.imageUrl = imageUrl;
+        this.airingDate = airingDate;
+        this.imdbRating = imdbRating;
+        this.director = director;
+
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        Movie movie = (Movie) o;
+        return movieId == movie.movieId;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(movieId);
+    }
+
+    public static Comparator<Movie> comparatorTitle = Comparator.comparing(Movie::getTitle);
+
+
+
+
+
+
+
+}
Index: src/main/java/com/wediscussmovies/project/model/Person.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/Person.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/java/com/wediscussmovies/project/model/Person.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,85 @@
+package com.wediscussmovies.project.model;
+
+import com.wediscussmovies.project.model.relation.MovieActors;
+import com.wediscussmovies.project.model.relation.PersonRates;
+import lombok.Data;
+
+import javax.persistence.*;
+import java.sql.Date;
+import java.util.Collection;
+
+@Entity
+@Table(name = "persons", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
+@Data
+public class Person {
+
+    /*
+    ni fale tabela za person koj zanrovi gi ima - ako e potrebno
+     */
+
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Id
+    @Column(name = "person_id")
+    private int personId;
+    @Basic
+    @Column(name = "name")
+    private String name;
+    @Basic
+    @Column(name = "surname")
+    private String surname;
+    @Basic
+    @Column(name = "type")
+    private Character type;
+    @Basic
+    @Column(name = "date_of_birth")
+    private Date dateOfBirth;
+    @Basic
+    @Column(name = "image_url")
+    private String imageUrl;
+    @Basic
+    @Column(name = "description")
+    private String description;
+    @OneToMany(mappedBy = "person")
+    private Collection<Discussion> discussions;
+    @OneToMany(mappedBy = "person")
+    private Collection<MovieActors> movieActors;
+    @OneToMany(mappedBy = "director")
+    private Collection<Movie> movies;
+    @OneToMany(mappedBy = "person")
+    private Collection<PersonRates> personRates;
+
+
+
+    public Person() {
+
+    }
+
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        Person that = (Person) o;
+
+        return personId == that.getPersonId();
+    }
+
+    @Override
+    public int hashCode() {
+
+        return personId * 31;
+    }
+
+
+
+    public Person(String name, String surname, Character type, Date dateOfBirth, String imageUrl, String description) {
+        this.name = name;
+        this.surname = surname;
+        this.type = type;
+        this.dateOfBirth = dateOfBirth;
+        this.imageUrl = imageUrl;
+        this.description = description;
+    }
+
+}
Index: src/main/java/com/wediscussmovies/project/model/Reply.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/Reply.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/java/com/wediscussmovies/project/model/Reply.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,57 @@
+package com.wediscussmovies.project.model;
+
+import com.wediscussmovies.project.model.primarykeys.ReplyPK;
+import lombok.Data;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.sql.Date;
+import java.util.Objects;
+
+@Entity
+@Table(name = "replies", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
+@Data
+@IdClass(ReplyPK.class)
+public class Reply implements Serializable {
+
+    @Column(name = "discussion_id")
+    @Id
+    private int discussionId;
+
+    @Column(name = "reply_id")
+    @Id
+    private int replyId;
+
+    @Basic
+    @Column(name = "text")
+    private String text;
+
+    @Basic
+    @Column(name = "date")
+    private Date date;
+
+
+
+    @ManyToOne
+    @MapsId("discussion_id")
+    @JoinColumn(name = "discussion_id")
+    private Discussion discussion;
+
+
+    @ManyToOne
+    @JoinColumn(name = "user_id")
+    private User user;
+
+    public Reply() {
+    }
+
+    public Reply(Discussion discussion, String text, Date date, User user) {
+        this.discussion = discussion;
+        this.discussionId = discussion.getDiscussionId();
+        this.text = text;
+        this.date = date;
+        this.user = user;
+    }
+
+
+}
Index: src/main/java/com/wediscussmovies/project/model/User.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/User.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/java/com/wediscussmovies/project/model/User.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,104 @@
+package com.wediscussmovies.project.model;
+
+import com.wediscussmovies.project.model.relation.MovieLikes;
+import com.wediscussmovies.project.model.relation.UserGenres;
+import com.wediscussmovies.project.model.relation.MovieRates;
+import com.wediscussmovies.project.model.relation.PersonRates;
+import lombok.Data;
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.security.core.userdetails.UserDetails;
+
+import javax.persistence.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Objects;
+
+@Entity
+@Table(name = "users", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
+@Data
+public class User implements UserDetails {
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Id
+    @Column(name = "user_id")
+    private int userId;
+    @Basic
+    @Column(name = "username")
+    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 = "user")
+    private Collection<Discussion> discussions;
+    @OneToMany(mappedBy = "user")
+    private Collection<MovieLikes> movieLikes;
+    @OneToMany(mappedBy = "user")
+    private Collection<MovieRates> movieRates;
+    @OneToMany(mappedBy = "user")
+    private Collection<PersonRates> personRates;
+    @OneToMany(mappedBy = "user")
+    private Collection<Reply> replies;
+    @OneToMany(mappedBy = "user")
+    private Collection<UserGenres> userGenres;
+
+    public User() {
+
+    }
+
+
+
+    @Override
+    public boolean isAccountNonExpired() {
+        return true;
+    }
+
+    @Override
+    public boolean isAccountNonLocked() {
+        return true;
+    }
+
+    @Override
+    public boolean isCredentialsNonExpired() {
+        return true;
+    }
+
+    @Override
+    public boolean isEnabled() {
+        return true;
+    }
+
+
+    @Override
+    public Collection<? extends GrantedAuthority> getAuthorities() {
+        return new ArrayList<>();
+    }
+
+    public User( String email,String username , String password, String name,String surname)  {
+        this.username = username;
+        this.name = name;
+        this.surname = surname;
+        this.email = email;
+        this.password = password;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        User user = (User) o;
+        return userId == user.userId;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(userId);
+    }
+}
Index: src/main/java/com/wediscussmovies/project/model/exception/DiscussionNotExistException.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/exception/DiscussionNotExistException.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/java/com/wediscussmovies/project/model/exception/DiscussionNotExistException.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,7 @@
+package com.wediscussmovies.project.model.exception;
+
+public class DiscussionNotExistException extends RuntimeException{
+    public DiscussionNotExistException(Integer id){
+        super("Дискусијата со број " + id +" не постои!");
+    }
+}
Index: src/main/java/com/wediscussmovies/project/model/exception/GenreNotExistException.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/exception/GenreNotExistException.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/java/com/wediscussmovies/project/model/exception/GenreNotExistException.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,7 @@
+package com.wediscussmovies.project.model.exception;
+
+public class GenreNotExistException extends RuntimeException {
+    public GenreNotExistException(Integer id){
+        super("Жанрот со дадениот идентификатор " + id + " не постои!");
+    }
+}
Index: src/main/java/com/wediscussmovies/project/model/exception/InvalidArgumentsException.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/exception/InvalidArgumentsException.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/java/com/wediscussmovies/project/model/exception/InvalidArgumentsException.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,7 @@
+package com.wediscussmovies.project.model.exception;
+
+public class InvalidArgumentsException extends RuntimeException{
+    public InvalidArgumentsException(){
+        super("Невалидна најава!");
+    }
+}
Index: src/main/java/com/wediscussmovies/project/model/exception/MovieHasAlreadyDirector.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/exception/MovieHasAlreadyDirector.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/java/com/wediscussmovies/project/model/exception/MovieHasAlreadyDirector.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,8 @@
+package com.wediscussmovies.project.model.exception;
+
+public class MovieHasAlreadyDirector extends RuntimeException{
+
+    public MovieHasAlreadyDirector(String title,String name, String surname){
+        super("За режисер на филмот " + title + " е поставен " + name + " " + surname);
+    }
+}
Index: src/main/java/com/wediscussmovies/project/model/exception/PasswordsDoNotMatchException.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/exception/PasswordsDoNotMatchException.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/java/com/wediscussmovies/project/model/exception/PasswordsDoNotMatchException.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,7 @@
+package com.wediscussmovies.project.model.exception;
+
+public class PasswordsDoNotMatchException extends RuntimeException{
+    public PasswordsDoNotMatchException(){
+        super("Лозинките не се совпаѓаат!");
+    }
+}
Index: src/main/java/com/wediscussmovies/project/model/exception/PersonNotExistException.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/exception/PersonNotExistException.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/java/com/wediscussmovies/project/model/exception/PersonNotExistException.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,7 @@
+package com.wediscussmovies.project.model.exception;
+
+public class PersonNotExistException extends RuntimeException{
+    public PersonNotExistException(Integer id){
+        super("Личност со број " + id + " не постои!");
+    }
+}
Index: src/main/java/com/wediscussmovies/project/model/exception/ReplyNotExistException.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/exception/ReplyNotExistException.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/java/com/wediscussmovies/project/model/exception/ReplyNotExistException.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,9 @@
+package com.wediscussmovies.project.model.exception;
+
+import com.wediscussmovies.project.model.primarykeys.ReplyPK;
+
+public class ReplyNotExistException extends RuntimeException{
+    public ReplyNotExistException(ReplyPK id){
+        super("Репликата со број " + id + " не постои!");
+    }
+}
Index: src/main/java/com/wediscussmovies/project/model/exception/UserNotExistException.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/exception/UserNotExistException.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/java/com/wediscussmovies/project/model/exception/UserNotExistException.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,7 @@
+package com.wediscussmovies.project.model.exception;
+
+public class UserNotExistException extends RuntimeException{
+    public UserNotExistException(String username){
+        super("Корисник со корисничко име " + username + " не постои!");
+    }
+}
Index: src/main/java/com/wediscussmovies/project/model/exception/UsernameAlreadyExistsException.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/exception/UsernameAlreadyExistsException.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/java/com/wediscussmovies/project/model/exception/UsernameAlreadyExistsException.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,7 @@
+package com.wediscussmovies.project.model.exception;
+
+public class UsernameAlreadyExistsException extends RuntimeException{
+    public UsernameAlreadyExistsException(String username){
+        super("Корисничкото име е зафатено " + username);
+    }
+}
Index: src/main/java/com/wediscussmovies/project/model/primarykeys/MovieActorsPK.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/primarykeys/MovieActorsPK.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/java/com/wediscussmovies/project/model/primarykeys/MovieActorsPK.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,43 @@
+package com.wediscussmovies.project.model.primarykeys;
+
+import lombok.Data;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+
+@Data
+@Embeddable
+public class MovieActorsPK implements Serializable {
+
+    @Column(name = "movie_id")
+    private int movieId;
+
+    @Column(name = "actor_id")
+    private int actorId;
+
+    public MovieActorsPK(int movieId, int actorId) {
+        this.movieId = movieId;
+        this.actorId = actorId;
+    }
+
+    public MovieActorsPK() {
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        MovieActorsPK that = (MovieActorsPK) o;
+
+        return actorId == that.actorId && movieId == that.movieId;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = movieId;
+        result = 31 * result + actorId;
+        return result;
+    }
+}
Index: src/main/java/com/wediscussmovies/project/model/primarykeys/MovieGenresPK.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/primarykeys/MovieGenresPK.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/java/com/wediscussmovies/project/model/primarykeys/MovieGenresPK.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,44 @@
+package com.wediscussmovies.project.model.primarykeys;
+
+import lombok.Data;
+
+import javax.persistence.Column;
+import javax.persistence.Embeddable;
+import javax.persistence.Id;
+import java.io.Serializable;
+
+@Embeddable
+@Data
+public class MovieGenresPK implements Serializable {
+
+    @Column(name = "movie_id")
+    private int movieId;
+
+    @Column(name = "genre_id")
+    private int genreId;
+
+    public MovieGenresPK(int movieId, int genreId) {
+        this.movieId = movieId;
+        this.genreId = genreId;
+    }
+
+    public MovieGenresPK() {
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        MovieGenresPK that = (MovieGenresPK) o;
+
+        return genreId == that.genreId && movieId == that.movieId;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = movieId;
+        result = 31 * result + genreId;
+        return result;
+    }
+}
Index: src/main/java/com/wediscussmovies/project/model/primarykeys/MovieLikesPK.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/primarykeys/MovieLikesPK.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/java/com/wediscussmovies/project/model/primarykeys/MovieLikesPK.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,44 @@
+package com.wediscussmovies.project.model.primarykeys;
+
+import lombok.Data;
+
+import javax.persistence.Column;
+import javax.persistence.Embeddable;
+import javax.persistence.Id;
+import java.io.Serializable;
+
+@Embeddable
+@Data
+public class MovieLikesPK implements Serializable {
+
+    @Column(name = "movie_id")
+    private int movieId;
+
+    @Column(name = "user_id")
+    private int userId;
+
+    public MovieLikesPK() {
+    }
+
+    public MovieLikesPK(int movieId, int userId) {
+        this.movieId = movieId;
+        this.userId = userId;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        MovieLikesPK that = (MovieLikesPK) o;
+
+        return userId == that.userId && movieId == that.movieId;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = movieId;
+        result = 31 * result + userId;
+        return result;
+    }
+}
Index: src/main/java/com/wediscussmovies/project/model/primarykeys/MovieRatesPK.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/primarykeys/MovieRatesPK.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/java/com/wediscussmovies/project/model/primarykeys/MovieRatesPK.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,47 @@
+package com.wediscussmovies.project.model.primarykeys;
+
+import lombok.Data;
+
+import javax.persistence.Column;
+import javax.persistence.Embeddable;
+import javax.persistence.Id;
+import java.io.Serializable;
+
+@Embeddable
+@Data
+public class MovieRatesPK implements Serializable {
+
+    @Column(name = "movie_id")
+    private int movieId;
+
+    @Column(name = "user_id")
+    private int userId;
+
+
+    public MovieRatesPK() {
+    }
+
+    public MovieRatesPK(int movieId, int userId) {
+        this.movieId = movieId;
+        this.userId = userId;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        MovieRatesPK that = (MovieRatesPK) o;
+
+
+
+        return movieId == that.movieId && userId == that.userId;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = movieId;
+        result = 31 * result + userId;
+        return result;
+    }
+}
Index: src/main/java/com/wediscussmovies/project/model/primarykeys/PersonRatesPK.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/primarykeys/PersonRatesPK.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/java/com/wediscussmovies/project/model/primarykeys/PersonRatesPK.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,45 @@
+package com.wediscussmovies.project.model.primarykeys;
+
+import lombok.Data;
+
+import javax.persistence.Column;
+import javax.persistence.Embeddable;
+import javax.persistence.Id;
+import java.io.Serializable;
+
+@Embeddable
+@Data
+public class PersonRatesPK implements Serializable {
+
+    @Column(name = "person_id")
+    private int personId;
+
+    @Column(name = "user_id")
+    private int userId;
+
+    public PersonRatesPK() {
+    }
+
+    public PersonRatesPK(int personId, int userId) {
+        this.personId = personId;
+        this.userId = userId;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        PersonRatesPK that = (PersonRatesPK) o;
+
+
+        return personId == that.personId && userId == that.userId;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = personId;
+        result = 31 * result + userId;
+        return result;
+    }
+}
Index: src/main/java/com/wediscussmovies/project/model/primarykeys/ReplyPK.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/primarykeys/ReplyPK.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/java/com/wediscussmovies/project/model/primarykeys/ReplyPK.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,45 @@
+package com.wediscussmovies.project.model.primarykeys;
+
+import lombok.Data;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.Objects;
+
+@Data
+public class ReplyPK implements Serializable {
+
+    @Column(name = "discussion_id")
+    private int discussionId;
+
+    @Column(name = "reply_id")
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private int replyId;
+
+    public ReplyPK(int discussionId) {
+        this.discussionId = discussionId;
+    }
+
+    public ReplyPK(int discussionId, int replyId) {
+        this.discussionId = discussionId;
+        this.replyId = replyId;
+    }
+
+    public ReplyPK() {
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        ReplyPK replyPK = (ReplyPK) o;
+        return discussionId == replyPK.discussionId && replyId == replyPK.replyId;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(discussionId, replyId);
+    }
+
+
+}
Index: src/main/java/com/wediscussmovies/project/model/primarykeys/UserGenresPK.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/primarykeys/UserGenresPK.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/java/com/wediscussmovies/project/model/primarykeys/UserGenresPK.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,43 @@
+package com.wediscussmovies.project.model.primarykeys;
+
+import javax.persistence.Column;
+import javax.persistence.Embeddable;
+import javax.persistence.Id;
+import java.io.Serializable;
+
+@Embeddable
+public class UserGenresPK implements Serializable {
+
+    @Column(name = "user_id")
+    private int userId;
+
+    @Column(name = "genre_id")
+    private int genreId;
+
+    public UserGenresPK() {
+    }
+
+    public UserGenresPK(int userId, int genreId) {
+        this.userId = userId;
+        this.genreId = genreId;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        UserGenresPK that = (UserGenresPK) o;
+
+
+
+        return userId == that.userId && genreId == that.genreId;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = userId;
+        result = 31 * result + genreId;
+        return result;
+    }
+}
Index: src/main/java/com/wediscussmovies/project/model/relation/MovieActors.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/relation/MovieActors.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/java/com/wediscussmovies/project/model/relation/MovieActors.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,52 @@
+package com.wediscussmovies.project.model.relation;
+
+import com.wediscussmovies.project.model.Movie;
+import com.wediscussmovies.project.model.Person;
+import com.wediscussmovies.project.model.primarykeys.MovieActorsPK;
+import lombok.Data;
+
+import javax.persistence.*;
+import java.util.Objects;
+
+@Entity
+@Table(name = "movie_actors", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
+@Data
+public class MovieActors {
+
+    @EmbeddedId
+    private MovieActorsPK id;
+
+
+    @ManyToOne
+    @MapsId("movie_id")
+    @JoinColumn(name = "movie_id")
+    private Movie movie;
+
+
+    @ManyToOne
+    @MapsId("actor_id")
+    @JoinColumn(name = "actor_id")
+    private Person person;
+
+    public MovieActors(Movie movie, Person person) {
+        this.id = new MovieActorsPK(movie.getMovieId(),person.getPersonId());
+        this.movie = movie;
+        this.person = person;
+    }
+
+    public MovieActors() {
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        MovieActors that = (MovieActors) o;
+        return Objects.equals(id, that.id);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(id);
+    }
+}
Index: src/main/java/com/wediscussmovies/project/model/relation/MovieGenres.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/relation/MovieGenres.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/java/com/wediscussmovies/project/model/relation/MovieGenres.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,41 @@
+package com.wediscussmovies.project.model.relation;
+
+import com.wediscussmovies.project.model.Genre;
+import com.wediscussmovies.project.model.Movie;
+import com.wediscussmovies.project.model.primarykeys.MovieGenresPK;
+import lombok.Data;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name = "movie_genres", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
+@Data
+public class MovieGenres {
+
+    @EmbeddedId
+    private MovieGenresPK id;
+
+    @ManyToOne
+    @MapsId(value = "genre_id")
+    @JoinColumn(name = "genre_id")
+    private Genre genre;
+
+    @ManyToOne
+    @MapsId("movie_id")
+    @JoinColumn(name = "movie_id")
+    private Movie movie;
+
+    public MovieGenres() {
+    }
+
+    public MovieGenres(Movie movie, Genre genre) {
+        this.id = new MovieGenresPK(movie.getMovieId(),genre.getGenreId());
+        this.genre = genre;
+        this.movie = movie;
+    }
+
+
+
+
+
+}
Index: src/main/java/com/wediscussmovies/project/model/relation/MovieLikes.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/relation/MovieLikes.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/java/com/wediscussmovies/project/model/relation/MovieLikes.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,50 @@
+package com.wediscussmovies.project.model.relation;
+
+import com.wediscussmovies.project.model.Movie;
+import com.wediscussmovies.project.model.User;
+import com.wediscussmovies.project.model.primarykeys.MovieLikesPK;
+import lombok.Data;
+
+import javax.persistence.*;
+import java.util.Objects;
+
+@Entity
+@Table(name = "movie_likes", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
+@Data
+public class MovieLikes {
+   @EmbeddedId
+   private MovieLikesPK id;
+
+    @ManyToOne
+    @MapsId("movie_id")
+    @JoinColumn(name = "movie_id")
+    private Movie movie;
+
+
+    @ManyToOne
+    @MapsId("user_id")
+    @JoinColumn(name = "user_id")
+    private User user;
+
+    public MovieLikes(Movie movie, User user) {
+        this.id = new MovieLikesPK(movie.getMovieId(), user.getUserId());
+        this.movie = movie;
+        this.user = user;
+    }
+
+    public MovieLikes() {
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        MovieLikes that = (MovieLikes) o;
+        return Objects.equals(id, that.id);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(id);
+    }
+}
Index: src/main/java/com/wediscussmovies/project/model/relation/MovieRates.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/relation/MovieRates.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/java/com/wediscussmovies/project/model/relation/MovieRates.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,47 @@
+package com.wediscussmovies.project.model.relation;
+
+import com.wediscussmovies.project.model.Movie;
+import com.wediscussmovies.project.model.User;
+import com.wediscussmovies.project.model.primarykeys.MovieRatesPK;
+import lombok.Data;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name = "movie_rates", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
+@Data
+public class MovieRates {
+
+    @EmbeddedId
+    private MovieRatesPK id;
+
+    @Basic
+    @Column(name = "reason")
+    private String reason;
+    @Basic
+    @Column(name = "stars_rated")
+    private int starsRated;
+
+
+    @ManyToOne
+    @MapsId("movie_id")
+    @JoinColumn(name = "movie_id")
+    private Movie movie;
+
+
+    @ManyToOne
+    @MapsId("user_id")
+    @JoinColumn(name = "user_id")
+    private User user;
+
+    public MovieRates() {
+    }
+
+    public MovieRates(User user,Movie movie,String reason,Integer starsRated) {
+        this.id = new MovieRatesPK(movie.getMovieId(), user.getUserId());
+        this.reason = reason;
+        this.starsRated = starsRated;
+        this.movie = movie;
+        this.user = user;
+    }
+}
Index: src/main/java/com/wediscussmovies/project/model/relation/PersonRates.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/relation/PersonRates.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/java/com/wediscussmovies/project/model/relation/PersonRates.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,62 @@
+package com.wediscussmovies.project.model.relation;
+
+import com.wediscussmovies.project.model.Person;
+import com.wediscussmovies.project.model.User;
+import com.wediscussmovies.project.model.primarykeys.PersonRatesPK;
+import lombok.Data;
+
+import javax.persistence.*;
+import java.util.Objects;
+
+@Entity
+@Table(name = "person_rates", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
+@Data
+public class PersonRates {
+
+    @EmbeddedId
+    private PersonRatesPK id;
+
+    @Basic
+    @Column(name = "reason")
+    private String reason;
+    @Basic
+    @Column(name = "stars_rated")
+    private int starsRated;
+
+
+    @ManyToOne
+    @JoinColumn(name = "person_id")
+    @MapsId("person_id")
+    private Person person;
+
+
+    @ManyToOne
+    @JoinColumn(name = "user_id")
+    @MapsId("user_id")
+    private User user;
+
+
+    public PersonRates() {
+    }
+
+    public PersonRates(User user, Person person, String reason, Integer starsRated) {
+        this.id = new PersonRatesPK(person.getPersonId(), user.getUserId());
+        this.reason = reason;
+        this.starsRated = starsRated;
+        this.person = person;
+        this.user = user;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        PersonRates that = (PersonRates) o;
+        return Objects.equals(id, that.id);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(id);
+    }
+}
Index: src/main/java/com/wediscussmovies/project/model/relation/UserGenres.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/relation/UserGenres.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/java/com/wediscussmovies/project/model/relation/UserGenres.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,50 @@
+package com.wediscussmovies.project.model.relation;
+
+import com.wediscussmovies.project.model.Genre;
+import com.wediscussmovies.project.model.User;
+import com.wediscussmovies.project.model.primarykeys.UserGenresPK;
+import lombok.Data;
+
+import javax.persistence.*;
+import java.util.Objects;
+
+@Entity
+@Table(name = "user_genres", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
+@Data
+public class UserGenres {
+
+    @EmbeddedId
+    private UserGenresPK id;
+
+    @ManyToOne
+    @MapsId("genre_id")
+    @JoinColumn(name = "genre_id")
+    private Genre genre;
+
+    @ManyToOne
+    @MapsId("user_id")
+    @JoinColumn(name = "user_id")
+    private User user;
+
+    public UserGenres() {
+    }
+
+    public UserGenres(Genre genre, User user) {
+        this.id = new UserGenresPK(user.getUserId(), genre.getGenreId());
+        this.genre = genre;
+        this.user = user;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        UserGenres that = (UserGenres) o;
+        return Objects.equals(id, that.id);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(id);
+    }
+}
Index: src/main/java/com/wediscussmovies/project/querymodels/GenreLikes.java
===================================================================
--- src/main/java/com/wediscussmovies/project/querymodels/GenreLikes.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/java/com/wediscussmovies/project/querymodels/GenreLikes.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,15 @@
+package com.wediscussmovies.project.querymodels;
+
+import lombok.Data;
+
+@Data
+public class GenreLikes {
+
+    private String name;
+    private Long likes;
+
+    public GenreLikes(String name, Long likes) {
+        this.name = name;
+        this.likes = likes;
+    }
+}
Index: src/main/java/com/wediscussmovies/project/repository/MovieActorsRepository.java
===================================================================
--- src/main/java/com/wediscussmovies/project/repository/MovieActorsRepository.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/java/com/wediscussmovies/project/repository/MovieActorsRepository.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,19 @@
+package com.wediscussmovies.project.repository;
+
+import com.wediscussmovies.project.model.Movie;
+import com.wediscussmovies.project.model.Person;
+import com.wediscussmovies.project.model.relation.MovieActors;
+import com.wediscussmovies.project.model.primarykeys.MovieActorsPK;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface MovieActorsRepository extends JpaRepository<MovieActors, MovieActorsPK> {
+
+    List<MovieActors> deleteAllByMovie(Movie movie);
+    List<MovieActors> findAllByMovie(Movie movie);
+    List<MovieActors> findAllByPerson(Person person);
+    void deleteAllByPerson(Person person);
+}
Index: src/main/java/com/wediscussmovies/project/repository/MovieGenresRepository.java
===================================================================
--- src/main/java/com/wediscussmovies/project/repository/MovieGenresRepository.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/java/com/wediscussmovies/project/repository/MovieGenresRepository.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,15 @@
+package com.wediscussmovies.project.repository;
+
+import com.wediscussmovies.project.model.Movie;
+import com.wediscussmovies.project.model.relation.MovieGenres;
+import com.wediscussmovies.project.model.primarykeys.MovieGenresPK;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface MovieGenresRepository extends JpaRepository<MovieGenres, MovieGenresPK> {
+    List<MovieGenres> deleteAllByMovie(Movie movie);
+    List<MovieGenres> findAllByMovie(Movie movie);
+}
Index: src/main/java/com/wediscussmovies/project/repository/MovieLikesRepository.java
===================================================================
--- src/main/java/com/wediscussmovies/project/repository/MovieLikesRepository.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/java/com/wediscussmovies/project/repository/MovieLikesRepository.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,14 @@
+package com.wediscussmovies.project.repository;
+
+import com.wediscussmovies.project.model.User;
+import com.wediscussmovies.project.model.primarykeys.MovieLikesPK;
+import com.wediscussmovies.project.model.relation.MovieLikes;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface MovieLikesRepository extends JpaRepository<MovieLikes, MovieLikesPK> {
+    List<MovieLikes> findAllByUser(User user);
+}
Index: src/main/java/com/wediscussmovies/project/repository/MovieRatesRepository.java
===================================================================
--- src/main/java/com/wediscussmovies/project/repository/MovieRatesRepository.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/java/com/wediscussmovies/project/repository/MovieRatesRepository.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,10 @@
+package com.wediscussmovies.project.repository;
+
+import com.wediscussmovies.project.model.primarykeys.MovieRatesPK;
+import com.wediscussmovies.project.model.relation.MovieRates;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface MovieRatesRepository extends JpaRepository<MovieRates, MovieRatesPK> {
+}
Index: src/main/java/com/wediscussmovies/project/repository/PersonRatesRepository.java
===================================================================
--- src/main/java/com/wediscussmovies/project/repository/PersonRatesRepository.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/java/com/wediscussmovies/project/repository/PersonRatesRepository.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,10 @@
+package com.wediscussmovies.project.repository;
+
+import com.wediscussmovies.project.model.primarykeys.PersonRatesPK;
+import com.wediscussmovies.project.model.relation.PersonRates;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface PersonRatesRepository extends JpaRepository<PersonRates, PersonRatesPK> {
+}
Index: src/main/java/com/wediscussmovies/project/web/controller/GenreController.java
===================================================================
--- src/main/java/com/wediscussmovies/project/web/controller/GenreController.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/java/com/wediscussmovies/project/web/controller/GenreController.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,23 @@
+package com.wediscussmovies.project.web.controller;
+
+import com.wediscussmovies.project.service.GenreService;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+@Controller
+@RequestMapping("/genres")
+public class GenreController {
+    private final GenreService genreService;
+
+    public GenreController(GenreService genreService) {
+        this.genreService = genreService;
+    }
+    @GetMapping
+    public String getGenres(Model model){
+        model.addAttribute("genres",genreService.findAllWithLikes());
+        model.addAttribute("contentTemplate","genres");
+        return "template";
+    }
+}
Index: src/main/java/com/wediscussmovies/project/web/controller/rest/DiscussionRestController.java
===================================================================
--- src/main/java/com/wediscussmovies/project/web/controller/rest/DiscussionRestController.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/java/com/wediscussmovies/project/web/controller/rest/DiscussionRestController.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,46 @@
+package com.wediscussmovies.project.web.controller.rest;
+
+import com.wediscussmovies.project.service.DiscussionService;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+
+@RestController
+@RequestMapping("api/discussions")
+public class DiscussionRestController {
+    private final DiscussionService discussionService;
+
+    public DiscussionRestController(DiscussionService discussionService) {
+        this.discussionService = discussionService;
+    }
+    @DeleteMapping("/delete/{id}")
+    public ResponseEntity deleteById(@PathVariable Integer id){
+        try {
+            this.discussionService.deleteById(id);
+            return ResponseEntity.ok(true);
+        }
+        catch (RuntimeException exception){
+            return ResponseEntity.ok(false);
+
+        }
+    }
+    @GetMapping("/like/{discussionId}")
+    public ResponseEntity likeDiscussion(@PathVariable Integer discussionId, @RequestParam Integer userId){
+        try {
+            this.discussionService.likeDiscussion(discussionId,userId);
+            return ResponseEntity.ok(true);
+        }
+        catch (RuntimeException exception){
+            return ResponseEntity.ok(false);
+        }
+    }
+    @GetMapping("/unlike/{discussionId}")
+    public ResponseEntity unlikeDiscussion(@PathVariable Integer discussionId, @RequestParam Integer userId){
+        try {
+            this.discussionService.unlikeDiscussion(discussionId,userId);
+            return ResponseEntity.ok(true);
+        }
+        catch (RuntimeException exception){
+            return ResponseEntity.ok(false);
+        }
+    }
+}
Index: src/main/java/com/wediscussmovies/project/web/controller/rest/MovieRestController.java
===================================================================
--- src/main/java/com/wediscussmovies/project/web/controller/rest/MovieRestController.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/java/com/wediscussmovies/project/web/controller/rest/MovieRestController.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,63 @@
+package com.wediscussmovies.project.web.controller.rest;
+
+import com.wediscussmovies.project.LoggedUser;
+import com.wediscussmovies.project.ajaxmodels.Grade;
+import com.wediscussmovies.project.service.MovieService;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+
+@RestController
+@RequestMapping("/api/movies")
+public class MovieRestController {
+
+    private final MovieService movieService;
+
+
+    public MovieRestController(MovieService movieService) {
+        this.movieService = movieService;
+    }
+
+    @DeleteMapping("/delete/{id}")
+    public ResponseEntity deleteById(@PathVariable Integer id){
+        try {
+            this.movieService.deleteById(id);
+            return ResponseEntity.ok(true);
+        }
+        catch (RuntimeException exception){
+            return ResponseEntity.ok(false);
+
+        }
+    }
+    @GetMapping("/like/{movieId}")
+    public ResponseEntity likeMovie(@PathVariable Integer movieId, @RequestParam Integer userId){
+        try {
+            this.movieService.likeMovie(movieId,userId);
+            return ResponseEntity.ok(true);
+        }
+        catch (RuntimeException exception){
+            return ResponseEntity.ok(false);
+        }
+    }
+    @GetMapping("/unlike/{movieId}")
+    public ResponseEntity unlikeMovie(@PathVariable Integer movieId, @RequestParam Integer userId){
+        try {
+            this.movieService.unlikeMovie(movieId,userId);
+            return ResponseEntity.ok(true);
+        }
+        catch (RuntimeException exception){
+            return ResponseEntity.ok(false);
+        }
+    }
+    @PostMapping("/grade/{movieId}")
+    public ResponseEntity addGrade(@PathVariable Integer movieId, @RequestBody Grade grade){
+        try {
+            this.movieService.addGradeMovie(movieId, LoggedUser.getLoggedUser(),grade);
+            return ResponseEntity.ok(true);
+        }
+        catch (RuntimeException exception){
+            return ResponseEntity.ok(false);
+        }
+
+    }
+
+}
Index: src/main/java/com/wediscussmovies/project/web/controller/rest/PersonRestController.java
===================================================================
--- src/main/java/com/wediscussmovies/project/web/controller/rest/PersonRestController.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/java/com/wediscussmovies/project/web/controller/rest/PersonRestController.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,41 @@
+package com.wediscussmovies.project.web.controller.rest;
+
+import com.wediscussmovies.project.LoggedUser;
+import com.wediscussmovies.project.ajaxmodels.Grade;
+import com.wediscussmovies.project.service.PersonService;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+
+@RestController
+@RequestMapping("/api/persons")
+public class PersonRestController {
+
+    private final PersonService personService;
+
+    public PersonRestController(PersonService personService) {
+        this.personService = personService;
+    }
+
+    @DeleteMapping("/delete/{id}")
+    public ResponseEntity deletePerson(@PathVariable Integer id){
+
+        try {
+            this.personService.deleteById(id);
+            return ResponseEntity.ok(true);
+        }
+        catch (RuntimeException exception){
+            return ResponseEntity.ok(false);
+        }
+    }
+    @PostMapping("/grade/{personId}")
+    public ResponseEntity addGrade(@PathVariable Integer personId, @RequestBody Grade grade){
+        try {
+            this.personService.addGradePerson(personId, LoggedUser.getLoggedUser(),grade);
+            return ResponseEntity.ok(true);
+        }
+        catch (RuntimeException exception){
+            return ResponseEntity.ok(false);
+        }
+
+    }
+}
Index: src/main/java/com/wediscussmovies/project/web/controller/rest/ReplyRestController.java
===================================================================
--- src/main/java/com/wediscussmovies/project/web/controller/rest/ReplyRestController.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/java/com/wediscussmovies/project/web/controller/rest/ReplyRestController.java	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,51 @@
+package com.wediscussmovies.project.web.controller.rest;
+
+import com.wediscussmovies.project.model.primarykeys.ReplyPK;
+import com.wediscussmovies.project.service.ReplyService;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+
+@RestController
+@RequestMapping("api/replies")
+public class ReplyRestController {
+
+    private final ReplyService replyService;
+
+    public ReplyRestController(ReplyService replyService) {
+        this.replyService = replyService;
+    }
+
+    @PostMapping("/delete/{discussionId}")
+    public ResponseEntity deleteById(@RequestParam Integer replyId,@PathVariable Integer discussionId){
+        try {
+            this.replyService.delete(discussionId,replyId);
+            return ResponseEntity.ok(true);
+        }
+        catch (RuntimeException exception){
+            return ResponseEntity.ok(false);
+
+        }
+    }
+    @GetMapping("/like/{replyId}")
+    public ResponseEntity likeReply(@PathVariable Integer replyId,
+                                    @RequestParam Integer userId){
+        try {
+            this.replyService.likeReply(replyId,userId);
+            return ResponseEntity.ok(true);
+        }
+        catch (RuntimeException exception){
+            return ResponseEntity.ok(false);
+        }
+    }
+    @GetMapping("/unlike/{replyId}")
+    public ResponseEntity unlikeReply(@PathVariable Integer replyId,
+                                 @RequestParam Integer userId){
+        try {
+            this.replyService.unlikeReply(replyId,userId);
+            return ResponseEntity.ok(true);
+        }
+        catch (RuntimeException exception){
+            return ResponseEntity.ok(false);
+        }
+    }
+}
