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);
+        }
+    }
+}
Index: src/main/resources/static/css/shared.css
===================================================================
--- src/main/resources/static/css/shared.css	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/resources/static/css/shared.css	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,3 @@
+.col{
+    max-width: 5vw;
+}
Index: src/main/resources/static/js/sharedScript.js
===================================================================
--- src/main/resources/static/js/sharedScript.js	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/resources/static/js/sharedScript.js	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,196 @@
+var urlRating;
+
+$(document).ready(function (){
+    var elements = $(".elements")
+    var elementGrade;
+
+    $("#dialog-rating").dialog({
+        autoOpen: false,
+        modal: true,
+        buttons: [
+            {
+                text: "Потврди",
+                click: function () {
+                    $("#dialog-rating").dialog("close")
+                    ajaxCallRating(urlRating,elementGrade)
+                }
+            },
+            {
+                text: "Откажи",
+                click: function () {
+                    $("#dialog-rating").dialog("close")
+                }
+            }
+        ]
+    });
+    $(".button-add-grade-movie").on("click",function (){
+        elementGrade = $(this)
+        urlRating ="api/movies/grade/"+$(this).attr("movie-id")
+        $("#dialog-rating").dialog("open")
+    })
+    $(".button-add-grade-person").on("click",function (){
+        elementGrade = $(this)
+        urlRating ="api/persons/grade/"+$(this).attr("person-id")
+        $("#dialog-rating").dialog("open")
+    })
+
+
+    $(".search-button-title").on("click",function (){
+        let filter = $("#searchTitle").val()
+        for (let item of elements){
+            let title = item.cells[0].innerText
+            if (title.toLowerCase() === filter.toLowerCase()){
+                $(item).css("display","block")
+            }
+            else{
+                $(item).css("display","none")
+            }
+        }
+
+    })
+
+
+   $(".search-button").on("click",function () {
+        let filter = $("#searchGenre").val()
+        for (let item of elements) {
+            let genre = item.cells[4].children;
+            let visible = false;
+
+            for (g of genre) {
+
+                if ($(g).text().toLowerCase() === filter.toLowerCase()) {
+                    visible = true
+                    $(item).css("display","block")
+                    break;
+                }
+            }
+            if (!visible)
+                $(item).css("display","none")
+        }
+    });
+
+    $(".button-delete-movie").on("click",function (){
+        let button = $(this)
+        let url = "api/movies/delete/" + $(button).attr("movie-id")
+        ajaxCallDelete(url,button)
+    })
+    $(".button-delete-actor").on("click",function (){
+        let button = $(this)
+        let url  = "api/persons/delete/" + $(button).attr("person-id")
+        ajaxCallDelete(url,button)
+    })
+    $(".button-delete-discussion").on("click",function (){
+        let button = $(this)
+        let url = "api/discussions/delete/" + $(button).attr("discussion-id")
+        ajaxCallDelete(url,button)
+    })
+
+    $(document.body).on("click",".button-confirm",function (){
+
+        $(this).parent().parent().fadeOut(2000)
+    })
+    $(".person-movies").change(function (){
+        if (this.value === "A"){
+            $(".movie-directors").attr("hidden",true).prop("selected",false)
+
+
+            $(".movies-actors").attr("hidden",false)
+
+        }
+        else{
+            $(".movies-actors").attr("hidden",true).prop("selected",false)
+            $(".movie-directors").attr("hidden",false)
+        }
+    })
+    $(document.body).on("click",".button-add-favourite-list",function (){
+        let button = $(this)
+        let url = "api/movies/like/"+ $(this).attr("movie-id") + "?userId="+ $(this).attr("user-id")
+        ajaxCallLike(url,button,'like','Веќе е филмот допаднат!')
+    })
+    $(document.body).on("click",".button-remove-favourite-list",function (){
+        let button = $(this)
+        let url = "api/movies/unlike/"+ $(this).attr("movie-id")+"?userId="+ $(this).attr("user-id")
+        ajaxCallLike(url,button,'unlike','Немате оставено допаѓање на филмот!')
+    })
+    $(".discussion-type").change(function (){
+        if (this.value === "M"){
+            $(".persons-discussion").hide()
+            $(".movies-discussion").show()
+
+
+        }
+        else{
+            $(".movies-discussion").hide()
+            $(".persons-discussion").show()
+        }
+    })
+
+
+})
+function ajaxCallLike(url,button,type,message){
+    $.ajax({
+        url:url,
+        success:function (data){
+            if (data){
+                let el = $(button).parent().siblings().eq(3)
+                console.log(el)
+                if (type=="like") {
+                    $(el).html(parseInt($(el).text()) + 1)
+                    console.log("da")
+                }
+                else
+                    $(el).html(parseInt($(el).text()) - 1)
+                $(button).css("display","none")
+                let userId = $(button).attr("user-id")
+                let movieId=$(button).attr("movie-id")
+                if (type==='like') {
+                    $(button).parent().append("<a class='btn btn-primary button-remove-favourite-list' movie-id=" + movieId + " user-id=" + userId + ">Избриши од омилена листа</a>")
+                    console.log("da")
+                }
+                else{
+                    $(button).parent().append("<a class='btn btn-primary button-add-favourite-list' movie-id=" + movieId + " user-id=" + userId + ">Додади во омилена листа</a>")
+
+                }
+            }
+            else {
+                $(button).parent().append("<div>" + message +" <button class='button-confirm'>Ок</button></div>")
+            }
+        }
+    })
+}
+function ajaxCallDelete(url,button){
+    $.ajax({
+        url:url,
+        method:"DELETE",
+        success: function (data){
+            if (data){
+                console.log(data)
+                $(button).parent().parent().html("<div>Бришењето е успешно!<button class='button-confirm'>Ок</button></div>")
+            }
+            else {
+                var div = "<div>Веќе е избришан записот! <button class='button-confirm'>Ок</button></div>"
+                button.parent().html(button.parent().html() + div)
+            }
+        }
+    })
+}
+function  ajaxCallRating(url,button,type){
+    model = {
+        rating:$("#grade").val(),
+        reason:$("#reason").val()
+    }
+    $.ajax({
+        url:urlRating,
+        method: "POST",
+        dataType:"json",
+        data:JSON.stringify(model),
+        contentType : 'application/json; charset=utf-8',
+        success: function (data){
+            if (data){
+                console.log(data)
+                $(button).text("Промени оцена и мислење")
+            }
+
+        }
+    })
+}
Index: src/main/resources/templates/discussion.html
===================================================================
--- src/main/resources/templates/discussion.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/resources/templates/discussion.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,44 @@
+<div xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.w3.org/1999/xhtml">
+    <div th:text="${disc.getMovie() != null ? disc.getMovie().getTitle() : disc.getPerson().getName() + ' ' + disc.getPerson().getSurname()}"></div>
+    <div th:text="${disc.getTitle()}"></div>
+    <div th:text="${disc.getText()}"></div>
+    <div th:text="${disc.getDate()}"></div>
+    <div th:text="${disc.getUser().getUsername()}"></div>
+    <div th:if="${disc.getUser().equals(user)}"><a class="btn btn-primary" th:href="@{'/discussions/add/{id}' (id=${disc.getDiscussionId()})}">Промени</a> </div>
+    <div th:if="${disc.getUser().equals(user)}"><a class="btn btn-primary button-delete-discussion" th:discussion-id="${disc.getDiscussionId()}">Избриши</a> </div>
+    <table class="table table-striped">
+        <thead>
+        <tr>
+
+            <th scope="col">Опис</th>
+            <th scope="col">Датум</th>
+            <th scope="col">Корисник</th>
+            <th:block  sec:authorize="isAuthenticated()">
+
+                <th scope="col"></th>
+                <th scope="col"></th>
+            </th:block>
+
+        </tr>
+        </thead>
+        <tbody>
+        <tr th:each="reply : ${replies}" class="movie">
+            <td th:text="${reply.getText()}"></td>
+            <td th:text="${reply.getDate()}"></td>
+            <td th:text="${reply.getUser().getUsername()}"></td>
+            <td th:if="${reply.getUser().equals(user)}"><a class="btn btn-primary" th:href="@{'/replies/edit/{discussionId}/{replyId}' (discussionId=${disc.getDiscussionId()},replyId=${reply.getReplyId()})}">Промени</a> </td>
+            <td th:if="${reply.getUser().equals(user)}"><a class="btn btn-primary button-delete-reply" th:reply-id="${reply.getReplyId()}" th:dicsussion-id="${disc.getDiscussionId()}">Избриши</a> </td>
+
+            <th:block sec:authorize="isAuthenticated()">
+                <td th:if="${!reply.getUser().equals(user)}"><a class="btn btn-primary" th:href="@{'/replies/add/{discussionId}' (discussionId=${disc.getDiscussionId()})}">Реплицирај</a> </td>
+                <td th:if="${!reply.getUser().equals(user)}">
+                    <a class="btn btn-primary">Ми се допаѓа</a>
+                    <a class="btn btn-primary">Не ми се допаѓа</a>
+                </td>
+            </th:block>
+
+
+        </tr>
+        </tbody>
+    </table>
+</div>
Index: src/main/resources/templates/discussionForType.html
===================================================================
--- src/main/resources/templates/discussionForType.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/resources/templates/discussionForType.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,53 @@
+<div xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.w3.org/1999/xhtml">
+
+    <div class="container mb-4">
+        <div class="row">
+            <div class="col-12" th:if="${discussions.size() > 0}">
+                <div class="table-responsive">
+                    <table class="table table-striped">
+                        <thead>
+                        <tr>
+                            <th scope="col">Наменета</th>
+                            <th scope="col">Наслов</th>
+                            <th scope="col">Опис</th>
+                            <th scope="col">Датум</th>
+                            <th scope="col">Корисник</th>
+                            <th:block  sec:authorize="isAuthenticated()">
+                                <th:block>
+                                    <th scope="col"></th>
+                                    <th scope="col"></th>
+                                </th:block>
+                                <th scope="col"></th>
+                                <th scope="col"></th>
+                            </th:block>
+
+                        </tr>
+                        </thead>
+                        <tbody>
+                        <tr th:each="disc : ${discussions}" class="movie">
+                            <td th:text="${disc.getMovie() != null ? disc.getMovie().getTitle() : disc.getPerson().getName() + ' ' + disc.getPerson().getSurname()}"></td>
+                            <td th:text="${disc.getTitle()}"></td>
+                            <td th:text="${disc.getText()}"></td>
+                            <td th:text="${disc.getDate()}"></td>
+                            <td th:text="${disc.getUser().getUsername()}"></td>
+                            <td th:if="${disc.getUser().equals(user)}"><a class="btn btn-primary" th:href="@{'/discussions/add/{id}' (id=${disc.getDiscussionId()})}">Промени</a> </td>
+                            <td th:if="${disc.getUser().equals(user)}"><a class="btn btn-primary button-delete-discussion" th:discussion-id="${disc.getDiscussionId()}">Избриши</a> </td>
+
+                            <th:block sec:authorize="isAuthenticated()">
+                                <td th:if="${!disc.getUser().equals(user)}"><a class="btn btn-primary" th:href="@{'/replies/add/{discussionId}' (discussionId=${disc.getDiscussionId()})}">Реплицирај</a> </td>
+                                <td th:if="${!disc.getUser().equals(user)}">
+                                    <a class="btn btn-primary">Ми се допаѓа</a>
+                                    <a class="btn btn-primary">Не ми се допаѓа</a>
+                                </td>
+                            </th:block>
+
+
+                        </tr>
+                        </tbody>
+                    </table>
+                </div>
+            </div>
+        </div>
+    </div>
+
+</div>
Index: src/main/resources/templates/discussionsAdd.html
===================================================================
--- src/main/resources/templates/discussionsAdd.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/resources/templates/discussionsAdd.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,72 @@
+<main xmlns:th="http://www.thymeleaf.org">
+
+    <div class="container">
+        <div class="row">
+            <div class="col-md-5">
+                <form th:action="@{'/discussions/save/{discussionId}' (discussionId = ${discussion?.getDiscussionId()})}" method="POST">
+                    <div class="form-group">
+
+                        <label for="title">Наслов</label>
+                        <input type="text"
+                               class="form-control"
+                               id="title"
+                               name="title"
+                               th:value="${discussion?.getTitle()}"
+                               required
+                               placeholder="Наслов">
+                    </div>
+                    <div class="form-group">
+                        <label for="text">Опис</label>
+                        <input type="text"
+                               class="form-control"
+                               id="text"
+                               name="text"
+                               th:value="${discussion?.getText()}"
+                               multiple
+                               placeholder="Опис">
+                    </div>
+
+                    <div>
+                        <input type="radio"
+                               class="form-control discussion-type"
+                               name="type"
+                               th:value="M"
+                               th:text="Филм"
+                               th:checked="${discussion?.getType() != null && discussion.getType().toString().equals('M')}"
+
+                        >
+                        <input type="radio"
+                               class="form-control discussion-type"
+                               name="type"
+                               th:value="P"
+                               th:text="Личност"
+                               th:checked="${discussion?.getType() != null && discussion.getType().toString().equals('P')}">
+                    </div>
+
+
+
+
+                    <div class="form-group">
+                        <select name="idDiscussed" class="selected-discussion">
+                            <option></option>
+                            <option class="movies-discussion" th:each="movie:${movies}" th:value="${movie.getMovieId()}"
+                                    th:text="${movie.getTitle()}"
+                                    th:selected="${discussion?.getMovie()?.equals(movie)}"></option>
+
+                            <option class="persons-discussion" th:each="person:${persons}" th:value="${person.getPersonId()}"
+                                    th:text="${person.getName() + ' ' + person.getSurname()}"
+                                    th:selected="${discussion?.getPerson()?.equals(person)}"></option>
+
+                        </select>
+                    </div>
+
+
+                    <button id="submit" type="submit" class="btn btn-primary">Submit</button>
+                    <a type="button" class="btn btn-primary" th:href="@{/discussions}">Back</a>
+                </form>
+            </div>
+        </div>
+    </div>
+
+
+</main>
Index: src/main/resources/templates/discussionsList.html
===================================================================
--- src/main/resources/templates/discussionsList.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/resources/templates/discussionsList.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,55 @@
+<div xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.w3.org/1999/xhtml">
+    <div class="container mb-4">
+        <a sec:authorize="isAuthenticated()" th:href="@{/discussions/add}">Додади нова дискусија</a>
+    </div>
+    <div class="container mb-4">
+        <div class="row">
+            <div class="col-12" th:if="${discussions.size() > 0}">
+                <div class="table-responsive">
+                    <table class="table table-striped">
+                        <thead>
+                        <tr>
+                            <th scope="col">Наменета</th>
+                            <th scope="col">Наслов</th>
+                            <th scope="col">Опис</th>
+                            <th scope="col">Датум</th>
+                            <th scope="col">Корисник</th>
+                            <th:block  sec:authorize="isAuthenticated()">
+                                <th:block>
+                                    <th scope="col"></th>
+                                    <th scope="col"></th>
+                                </th:block>
+                            <th scope="col"></th>
+                            <th scope="col"></th>
+                            </th:block>
+
+                        </tr>
+                        </thead>
+                        <tbody>
+                        <tr th:each="disc : ${discussions}" class="movie">
+                            <td th:text="${disc.getMovie() != null ? disc.getMovie().getTitle() : disc.getPerson().getName() + ' ' + disc.getPerson().getSurname()}"></td>
+                            <td th:text="${disc.getTitle()}"></td>
+                            <td th:text="${disc.getText()}"></td>
+                            <td th:text="${disc.getDate()}"></td>
+                            <td th:text="${disc.getUser().getUsername()}"></td>
+                            <td th:if="${disc.getUser().equals(user)}"><a class="btn btn-primary" th:href="@{'/discussions/add/{id}' (id=${disc.getDiscussionId()})}">Промени</a> </td>
+                            <td th:if="${disc.getUser().equals(user)}"><a class="btn btn-primary button-delete-discussion" th:discussion-id="${disc.getDiscussionId()}">Избриши</a> </td>
+
+                            <th:block sec:authorize="isAuthenticated()">
+                            <td th:if="${!disc.getUser().equals(user)}"><a class="btn btn-primary" th:href="@{'/replies/add/{discussionId}' (discussionId=${disc.getDiscussionId()})}">Реплицирај</a> </td>
+                            <td th:if="${!disc.getUser().equals(user)}">
+                                <a class="btn btn-primary">Ми се допаѓа</a>
+                                <a class="btn btn-primary">Не ми се допаѓа</a>
+                            </td>
+                            </th:block>
+
+
+                        </tr>
+                        </tbody>
+                    </table>
+                </div>
+            </div>
+        </div>
+    </div>
+
+</div>
Index: src/main/resources/templates/favoriteList.html
===================================================================
--- src/main/resources/templates/favoriteList.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/resources/templates/favoriteList.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,42 @@
+<div class="container mb-4">
+    <div class="row">
+        <div class="col-12" th:if="${movies.size() > 0}">
+            <div class="table-responsive">
+                <table class="table table-striped">
+                    <thead>
+                    <tr>
+                        <th scope="col">Наслов</th>
+                        <th scope="col">Опис</th>
+                        <th scope="col">Датум издавање</th>
+                        <th scope="col">Допаѓања</th>
+                        <th scope="col">Занрови</th>
+                        <th scope="col">Актери</th>
+                        <th scope="col">Режисер</th>
+
+
+
+                    </tr>
+                    </thead>
+                    <tbody>
+                    <tr th:each="movie : ${movies}" class="elements">
+                        <td th:text="${movie.getTitle()}"></td>
+                        <td th:text="${movie.getDescription()}"></td>
+                        <td th:text="${movie.getAiringDate()}"></td>
+                        <td th:text="${movie.getLikes() != null  ? movie.getLikes().size() : 0}">
+
+                        </td>
+                        <td class="genre">
+                            <div th:each="g: ${movie.getGenres()}" th:text="${g.getGenre().genreType }"></div>
+                        </td>
+                        <td>
+                            <div th:each="a: ${movie.getActors()}" th:text="${a.getPerson().getName()} "></div>
+                        </td>
+                        <td th:text="${movie.getDirector() != null ? movie.getDirector()?.getName() + ' '+ movie.getDirector()?.getSurname() : 'Не е додаен директор'}"></td>
+
+                    </tr>
+                    </tbody>
+                </table>
+            </div>
+        </div>
+    </div>
+</div>
Index: src/main/resources/templates/fragments/header.html
===================================================================
--- src/main/resources/templates/fragments/header.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/resources/templates/fragments/header.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,64 @@
+<header xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.w3.org/1999/xhtml">
+    <nav class="navbar navbar-expand-md navbar-dark bg-dark">
+        <div class="container">
+            <a class="navbar-brand" href="/">Форум за филмови</a>
+            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault"
+                    aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
+                <span class="navbar-toggler-icon"></span>
+            </button>
+            <div class="collapse navbar-collapse justify-content-end" id="navbarsExampleDefault">
+                <ul class="navbar-nav m-auto">
+                    <li class="nav-item m-auto">
+                        <a class="nav-link active" href="/movies">Филмови</a>
+                    </li>
+                    <li class="nav-item m-auto">
+                        <a class="nav-link active" href="/actors">Актери</a>
+                    </li>
+                    <li class="nav-item m-auto">
+                        <a class="nav-link active" href="/directors">Директори</a>
+                    </li>
+                    <li class="nav-item m-auto">
+                        <a class="nav-link active" href="/discussions">Дискусии</a>
+                    </li>
+                    <li class="nav-item m-auto">
+                        <a class="nav-link active" href="/genres">Жанрови</a>
+                    </li>
+                    <li class="nav-item m-auto" sec:authorize="isAuthenticated()">
+                        <a class="nav-link active" href="/favoriteList">Омилена листа</a>
+                    </li>
+                </ul>
+                <form class="form-inline my-2 my-lg-0">
+                    <div class="input-group input-group-sm">
+                        <input type="text" class="form-control" aria-label="Small"
+                               aria-describedby="inputGroup-sizing-sm"
+                               placeholder="Search...">
+                        <div class="input-group-append">
+                            <button type="button" class="btn btn-secondary btn-number">
+                                <i class="fa fa-search"></i>
+                            </button>
+                        </div>
+                    </div>
+                </form>
+                <ul class="nav navbar-nav navbar-right">
+                    <li class="nav-item" sec:authorize="isAuthenticated()">
+                        <a class="nav-link" href="#">
+                            <th:block th:if="${#request.getRemoteUser() != null}"
+                                      th:text="${#request.getRemoteUser()}"></th:block>
+                        </a>
+                    </li>
+
+                    <li class="nav-item" sec:authorize="isAuthenticated()">
+                        <a class="btn btn-light btn-sm ml-3" href="/logout">
+                            <i class="fa fa-shopping-cart"></i> Одјави се
+                        </a>
+                    </li>
+                    <li class="nav-item" sec:authorize="!isAuthenticated()">
+                        <a class="btn btn-light btn-sm ml-3" href="/login">
+                            <i class="fa fa-shopping-cart"></i> Најави се
+                        </a>
+                    </li>
+                </ul>
+            </div>
+        </div>
+    </nav>
+</header>
Index: src/main/resources/templates/fragments/searchBarGenre.html
===================================================================
--- src/main/resources/templates/fragments/searchBarGenre.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/resources/templates/fragments/searchBarGenre.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,5 @@
+<div>
+      <label for="searchGenre">жанр</label>
+        <input id="searchGenre" type="text" placeholder="жанр">
+        <button class="search-button">Пребарај</button>
+</div>
Index: src/main/resources/templates/fragments/searchBarName.html
===================================================================
--- src/main/resources/templates/fragments/searchBarName.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/resources/templates/fragments/searchBarName.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,5 @@
+<div>
+    <label for="searchTitle">Прабарај по име</label>
+    <input id="searchTitle" type="text" placeholder="име">
+    <button class="search-button-title">Пребарај</button>
+</div>
Index: src/main/resources/templates/genres.html
===================================================================
--- src/main/resources/templates/genres.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/resources/templates/genres.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,23 @@
+<div class="container mb-4">
+  <div class="row">
+    <div class="col-12">
+      <div class="table-responsive">
+        <table class="table table-striped">
+          <thead>
+          <tr>
+            <th scope="col">Име</th>
+            <th scope="col">Лајкови</th>
+          </tr>
+          </thead>
+          <tbody>
+          <tr th:each="genre : ${genres}" class="elements">
+            <td th:text="${genre.getName()}"></td>
+            <td th:text="${genre.getLikes()}"></td>
+
+          </tr>
+          </tbody>
+        </table>
+      </div>
+    </div>
+  </div>
+</div>
Index: src/main/resources/templates/login.html
===================================================================
--- src/main/resources/templates/login.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/resources/templates/login.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,20 @@
+<div class="container" xmlns:th="http://www.thymeleaf.org">
+    <form class="form-signin mt-xl-5" method="post" action="/login">
+        <h2 class="form-signin-heading">Sign in</h2>
+        <p>
+            <label for="username" class="sr-only">Username</label>
+            <input type="text" id="username" name="username" class="form-control" placeholder="Username" required=""
+                   autofocus="">
+        </p>
+        <p>
+            <label for="password" class="sr-only">Password</label>
+            <input type="password" id="password" name="password" class="form-control" placeholder="Password"
+                   required="">
+        </p>
+
+        <div th:text="${param.error}" class="text-danger"></div>
+
+        <button class="btn btn-lg btn-primary btn-block" type="submit">Sign in</button>
+    </form>
+    <a th:href="@{/register}" class="btn btn-block btn-light">Register here</a>
+</div>
Index: src/main/resources/templates/moviesAdd.html
===================================================================
--- src/main/resources/templates/moviesAdd.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/resources/templates/moviesAdd.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,90 @@
+<main xmlns:th="http://www.thymeleaf.org">
+
+    <div class="container">
+        <div class="row">
+            <div class="col-md-5">
+                <form th:action="@{'/movies/save/{movieId}' (movieId = ${movie?.getMovieId()})}" method="POST">
+                    <div class="form-group">
+                        <label for="title">Наслов</label>
+                        <input type="text"
+                               class="form-control"
+                               id="title"
+                               name="title"
+                               th:value="${movie?.getTitle()}"
+                               required
+                               placeholder="Наслов">
+                    </div>
+                    <div class="form-group">
+                        <label for="description">Опис</label>
+                        <input type="text"
+                               multiple
+                               class="form-control"
+                               id="description"
+                               name="description"
+                               th:value="${movie?.getDescription()}"
+                               placeholder="Опис">
+                    </div>
+                    <div class="form-group">
+                        <label for="imageUrl">Слика</label>
+                        <input type="text"
+                               class="form-control"
+                               id="imageUrl"
+                               name="imageUrl"
+                               th:value="${movie?.getImageUrl()}"
+                               placeholder="Слика">
+                    </div>
+                    <div class="form-group">
+                        <label for="airingDate">Датум на издавање</label>
+                        <input type="date"
+                               class="form-control"
+                               id="airingDate"
+                               name="airingDate"
+                               th:value="${movie?.getAiringDate()}"
+                               placeholder="Датум на издавање">
+                    </div>
+                    <div class="form-group">
+                        <label for="rating">Рејтинг</label>
+                        <input type="number"
+                               step="0.01"
+                               class="form-control"
+                               id="rating"
+                               name="rating"
+                               th:value="${movie?.getImdbRating()}"
+                               placeholder="Рејтинг">
+                    </div>
+                    <div class="form-group">
+                        <select name="directorId">
+                            <option></option>
+                            <option th:each="dir:${directors}" th:value="${dir.getPersonId()}" th:text="${dir.getName() + ' ' + dir.getSurname()}"
+                            th:selected="${director?.equals(dir)}"></option>
+
+                        </select>
+                    </div>
+                    <div class="form-group">
+                        <select name="actors" multiple>
+                            <option></option>
+                            <option th:each="act:${actors}" th:value="${act.getPersonId()}"
+                                    th:text="${act.getName() + ' ' + act.getSurname()}"
+                                    th:selected="${movieActors?.contains(act)}"></option>
+
+                        </select>
+                    </div>
+                    <div class="form-group">
+                        <select name="genres" multiple>
+                            <option></option>
+                            <option th:each="genr:${genres}" th:value="${genr.getGenreId()}"
+                                    th:text="${genr.getGenreType()}"
+                                    th:selected="${movieGenres?.contains(genr)}"></option>
+
+                        </select>
+                    </div>
+
+                    <button id="submit" type="submit" class="btn btn-primary">Submit</button>
+                    <a type="button" class="btn btn-primary" href="/products">Back</a>
+                </form>
+            </div>
+        </div>
+    </div>
+
+
+</main>
Index: src/main/resources/templates/moviesList.html
===================================================================
--- src/main/resources/templates/moviesList.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/resources/templates/moviesList.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,79 @@
+<div xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.w3.org/1999/xhtml">
+    <div th:replace="fragments/searchBarGenre">
+
+    </div>
+
+    <div class="container mb-4">
+        <a  sec:authorize="isAuthenticated()" th:href="@{/movies/add}">Додади нов филм</a>
+    </div>
+
+    <div class="container mb-4">
+        <div class="row">
+            <div class="col-12" th:if="${movies.size() > 0}">
+                <div class="table-responsive">
+                    <table class="table table-striped">
+                        <thead>
+                        <tr>
+                            <th scope="col">Наслов</th>
+                            <th scope="col">Опис</th>
+                            <th scope="col">Датум издавање</th>
+                            <th scope="col">Допаѓања</th>
+                            <th scope="col">Занрови</th>
+                            <th scope="col">Актери</th>
+                            <th scope="col">Режисер</th>
+                            <th  scope="col"></th>
+
+                            <th:block sec:authorize="isAuthenticated()">
+                            <th scope="col"></th>
+                            <th scope="col"></th>
+                            <th scope="col"></th>
+                            <th scope="col"></th>
+                            </th:block>
+
+
+
+                        </tr>
+                        </thead>
+                        <tbody>
+                        <tr th:each="movie : ${movies}" class="elements">
+                            <td th:text="${movie.getTitle()}"></td>
+                            <td th:text="${movie.getDescription()}"></td>
+                            <td th:text="${movie.getAiringDate()}"></td>
+                            <td th:text="${movie.getLikes() != null  ? movie.getLikes().size() : 0}">
+
+                            </td>
+                            <td class="genre">
+                                <div th:each="g: ${movie.getGenres()}" th:text="${g.getGenre().genreType }"></div>
+                            </td>
+                            <td>
+                                <div th:each="a: ${movie.getActors()}" th:text="${a.getPerson().getName()} "></div>
+                            </td>
+                            <td th:text="${movie.getDirector() != null ? movie.getDirector()?.getName() + ' '+ movie.getDirector()?.getSurname() : 'Не е додаен директор'}"></td>
+                            <td>
+                                <a class="btn btn-primary" th:href="@{'discussions/all/{id}?type=M' (id=${movie.getMovieId()})}" >Прегледај дискусии</a>
+                            </td>
+                            <th:block sec:authorize="isAuthenticated()">
+                            <td>
+                                <a class="btn btn-primary button-add-favourite-list" th:movie-id="${movie.getMovieId()}" th:user-id="${user.getUserId()}" th:if="${!likedMovies.contains(movie)}">Додади во омилена листа</a>
+                                <a class="btn btn-primary button-remove-favourite-list" th:movie-id="${movie.getMovieId()}" th:user-id="${user.getUserId()}" th:if="${likedMovies.contains(movie)}">Избриши од омилена листа</a>
+
+                            </td>
+                            <td>
+                                <a class="btn btn-primary button-add-grade-movie" th:movie-id="${movie.getMovieId()}">Остави оценка</a>
+                            </td>
+                            <td>
+                                <a class="btn btn-primary" th:href="@{'/movies/{id}/edit' (id=${movie.getMovieId()})}">Промени</a>
+                            </td>
+                            <td>
+                                <a class="btn btn-primary button-delete-movie" th:movie-id="${movie.getMovieId()}">Избриши филм</a>
+                            </td>
+                            </th:block>
+                        </tr>
+                        </tbody>
+                    </table>
+                </div>
+            </div>
+        </div>
+    </div>
+
+</div>
Index: src/main/resources/templates/personsAdd.html
===================================================================
--- src/main/resources/templates/personsAdd.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/resources/templates/personsAdd.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,99 @@
+<main xmlns:th="http://www.thymeleaf.org">
+
+    <div class="container">
+        <div class="row">
+            <div class="col-md-5">
+                <form th:action="@{'/persons/save/{personId}' (personId = ${person?.getPersonId()})}" method="POST">
+                    <div class="form-group">
+
+                        <label for="name">Име</label>
+                        <input type="text"
+                               class="form-control"
+                               id="name"
+                               name="name"
+                               th:value="${person?.getName()}"
+                               required
+                               placeholder="Име">
+                    </div>
+                    <div class="form-group">
+                        <label for="surname">Презиме</label>
+                        <input type="text"
+                               class="form-control"
+                               id="surname"
+                               name="surname"
+                               th:value="${person?.getSurname()}"
+                               placeholder="Презиме">
+                    </div>
+                    <div class="form-group">
+                        <label for="description">Опис</label>
+                        <input type="text"
+                               class="form-control"
+                               id="description"
+                               name="description"
+                               th:value="${person?.getDescription()}"
+                               placeholder="Опис">
+                    </div>
+                    <div>
+                        <input type="radio"
+                               class="form-control person-movies"
+                               name="type"
+                               th:value="A"
+                               th:text="Актер"
+                               th:checked="${person?.getType() != null && person.getType().toString().equals('A')}"
+
+                        >
+                        <input type="radio"
+                               class="form-control person-movies"
+                               name="type"
+                               th:value="D"
+                               th:text="Режисер"
+                               th:checked="${person?.getType() != null && person.getType().toString().equals('D') }">
+                    </div>
+                    <div class="form-group">
+                        <label for="imageUrl">Слика</label>
+                        <input type="text"
+                               class="form-control"
+                               id="imageUrl"
+                               name="imageUrl"
+                               th:value="${person?.getImageUrl()}"
+                               placeholder="Слика">
+                    </div>
+                    <div class="form-group">
+                        <label for="birthDate">Датум на раѓање</label>
+                        <input type="date"
+                               class="form-control"
+                               id="birthDate"
+                               name="birthDate"
+                               th:value="${person?.getDateOfBirth()}"
+                               placeholder="Датум на раѓање">
+                    </div>
+
+
+                    <div class="form-group">
+                        <select name="movieIds" multiple>
+                            <option></option>
+                            <option th:each="movie:${moviesActors}" th:value="${movie.getMovieId()}"
+                                    th:text="${movie.getTitle()}"
+                                    th:selected="${movieActors?.contains(movie)}"
+                                    th:hidden="${person != null && person.getType().toString()=='D'}"
+                            class="movies-actors"></option>
+
+                            <option th:each="movie:${moviesDirectors}" th:value="${movie.getMovieId()}"
+                                    th:text="${movie.getTitle()}"
+                                    th:selected="${movieActors?.contains(movie)}"
+                                    th:hidden="${person != null && person.getType().toString()=='A'}"
+                            class="movie-directors"></option>
+
+                        </select>
+                    </div>
+
+
+                    <button id="submit" type="submit" class="btn btn-primary">Submit</button>
+                    <a type="button" class="btn btn-primary" th:href="@{/actors}">Back</a>
+                </form>
+            </div>
+        </div>
+    </div>
+
+
+</main>
Index: src/main/resources/templates/personsList.html
===================================================================
--- src/main/resources/templates/personsList.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/resources/templates/personsList.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,69 @@
+<div xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.w3.org/1999/xhtml">
+
+    <div>
+        <a sec:authorize="isAuthenticated()" th:href="@{'persons/add'}">Додади актер или режисер</a>
+    </div>
+    <div class="container mb-4">
+        <div class="row">
+            <div class="col-12" th:if="${persons.size() > 0}">
+                <div class="table-responsive">
+                    <table class="table table-striped">
+                        <thead>
+                        <tr>
+                            <th scope="col">Име</th>
+                            <th scope="col">Презиме</th>
+                            <th scope="col">Датум рагање</th>
+                            <th scope="col">Опис</th>
+<!--                            <th scope="col">Занрови</th>-->
+                            <th scope="col">Слика</th>
+
+                            <th scope="col">Филмови</th>
+                            <th scope="col"></th>
+                            <th:block sec:authorize="isAuthenticated()">
+                            <th scope="col"></th>
+                            <th scope="col"></th>
+                                <th scope="col"></th>
+
+                            </th:block>
+
+                        </tr>
+                        </thead>
+                        <tbody>
+                        <tr th:each="person : ${persons}" class="elements">
+                            <td th:text="${person.getName()}"></td>
+                            <td th:text="${person.getSurname()}"></td>
+                            <td th:text="${person.getDateOfBirth()}"></td>
+                            <td th:text="${person.getDescription()}"></td>
+
+<!--                            <td>-->
+<!--                                <div th:each="g: ${person.getGenres()}" th:text="${g.getGenre().genreType }"></div>-->
+<!--                            </td>-->
+                            <td><img th:src="${person.getImageUrl()}" style="width: 20%; height: 20%"/></td>
+                            <td>
+                                <div th:each="m: ${person.getMovieActors().size() > 0 ? person.getMovieActors() : person.getMovies()}"
+                                     th:text="${m.getClass().getName() == 'com.wediscussmovies.project.model.relation.MovieActors'  ? m.getMovie().getTitle() : m.getTitle()} "></div>
+                            </td>
+                            <td> <a class="btn btn-primary" th:href="@{'discussions/all/{id}?type=P' (id=${person.getPersonId()})}" >Прегледај дискусии</a></td>
+                            <th:block sec:authorize="isAuthenticated()">
+                                <td>
+                                    <a class="btn btn-primary button-add-grade-person" th:person-id="${person.getPersonId()}">Остави оценка</a>
+
+                                </td>
+                            <td>
+                                <a class="btn btn-primary" th:href="@{'persons/edit/{personId}' (personId = ${person.getPersonId()})}">Промени</a>
+                            </td>
+                            <td>
+                                <a class="btn btn-primary button-delete-actor" th:person-id="${person.getPersonId()}">Избриши</a>
+
+                            </td>
+                            </th:block>
+
+                        </tr>
+                        </tbody>
+                    </table>
+                </div>
+            </div>
+        </div>
+    </div>
+
+</div>
Index: src/main/resources/templates/register.html
===================================================================
--- src/main/resources/templates/register.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/resources/templates/register.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,40 @@
+<div class="container">
+    <h1 th:text="${error?.toString()}"></h1>
+</div>
+<div class="container">
+    <form class="form-signin mt-xl-5" method="post" action="/register">
+        <h2 class="form-signin-heading">Register</h2>
+        <p>
+            <label for="email" class="sr-only">Емаил</label>
+            <input type="text" id="email" name="email" class="form-control" placeholder="Емаил" required=""
+                   autofocus="">
+        </p>
+        <p>
+            <label for="username" class="sr-only">Корисничко име</label>
+            <input type="text" id="username" name="username" class="form-control" placeholder="Корисничко име" required=""
+                   autofocus="">
+        </p>
+        <p>
+            <label for="password" class="sr-only">Лозинка</label>
+            <input type="password" id="password" name="password" class="form-control" placeholder="Лозинка"
+                   required="">
+        </p>
+        <p>
+            <label for="repeatedPassword" class="sr-only">Потврди лозинка</label>
+            <input type="password" id="repeatedPassword" name="repeatedPassword" class="form-control"
+                   placeholder="Потврди лозинка" required="">
+        </p>
+        <p>
+            <label for="name" class="sr-only">Име</label>
+            <input type="text" id="name" name="name" class="form-control" placeholder="Име" required="" autofocus="">
+        </p>
+        <p>
+            <label for="surname" class="sr-only">Презиме</label>
+            <input type="text" id="surname" name="surname" class="form-control" placeholder="Презиме" required=""
+                   autofocus="">
+        </p>
+
+        <button class="btn btn-lg btn-primary btn-block" type="submit">Регистрирај се</button>
+    </form>
+    <a href="/login" class="btn btn-block btn-light">Најави се</a>
+</div>
Index: src/main/resources/templates/repliesAdd.html
===================================================================
--- src/main/resources/templates/repliesAdd.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/resources/templates/repliesAdd.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,38 @@
+<main xmlns:th="http://www.thymeleaf.org">
+
+    <div class="container">
+        <div class="row">
+            <div class="col-md-5">
+                <form th:action="@{'/replies/save/{replyId}' (replyId = ${reply?.getReplyId()})}" method="POST">
+
+                    <div class="form-group">
+                        <label for="text">Опис</label>
+                        <input type="text"
+                               class="form-control"
+                               id="text"
+                               name="text"
+                               th:value="${reply?.getText()}"
+                               multiple
+                               placeholder="Опис">
+                    </div>
+                    <input type="hidden"
+                            id="discussionId"
+                           name="discussionId"
+                           th:value="${reply != null ? reply.getDiscussionId() : discussionId}"
+                    >
+
+
+
+
+
+
+
+                    <button id="submit" type="submit" class="btn btn-primary">Submit</button>
+                    <a type="button" class="btn btn-primary" th:href="@{/discussions}">Back</a>
+                </form>
+            </div>
+        </div>
+    </div>
+
+
+</main>
Index: src/main/resources/templates/template.html
===================================================================
--- src/main/resources/templates/template.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ src/main/resources/templates/template.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
+<head>
+    <meta charset="UTF-8"/>
+    <title>Products</title>
+    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
+    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
+    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
+    <script type="text/javascript" th:src="@{/js/sharedScript.js}" src=""></script>
+    <script src="https://code.jquery.com/jquery-3.6.0.js"></script>
+    <script src="https://code.jquery.com/ui/1.13.0/jquery-ui.js"></script>
+    <link rel="stylesheet" href="//code.jquery.com/ui/1.13.0/themes/base/jquery-ui.css">
+
+    <link rel="stylesheet" th:href="@{/css/shared.css}" >
+</head>
+<body>
+<section class="jumbotron text-center">
+    <div class="container">
+        <h1 class="jumbotron-heading">WEB PROGRAMMING SHOP</h1>
+        <h3 class="jumbotron-heading">All products</h3>
+    </div>
+</section>
+
+<header th:replace="fragments/header"></header>
+<div class="container md-4">
+    <h1 class="danger" th:text="${error?.toString()}"></h1>
+</div>
+<div th:replace="fragments/searchBarName"></div>
+<section th:include="${contentTemplate}"></section>
+<div id="dialog-rating" style="display: none">
+    <label for="reason">Причина</label><textarea id="reason"></textarea>
+    <label for="grade">Рејтинг</label><input type="number" id="grade" max="10" min="5">
+</div>
+</body>
+</html>
+
+
Index: target/classes/static/css/shared.css
===================================================================
--- target/classes/static/css/shared.css	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ target/classes/static/css/shared.css	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,3 @@
+.col{
+    max-width: 5vw;
+}
Index: target/classes/static/js/sharedScript.js
===================================================================
--- target/classes/static/js/sharedScript.js	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ target/classes/static/js/sharedScript.js	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,196 @@
+var urlRating;
+
+$(document).ready(function (){
+    var elements = $(".elements")
+    var elementGrade;
+
+    $("#dialog-rating").dialog({
+        autoOpen: false,
+        modal: true,
+        buttons: [
+            {
+                text: "Потврди",
+                click: function () {
+                    $("#dialog-rating").dialog("close")
+                    ajaxCallRating(urlRating,elementGrade)
+                }
+            },
+            {
+                text: "Откажи",
+                click: function () {
+                    $("#dialog-rating").dialog("close")
+                }
+            }
+        ]
+    });
+    $(".button-add-grade-movie").on("click",function (){
+        elementGrade = $(this)
+        urlRating ="api/movies/grade/"+$(this).attr("movie-id")
+        $("#dialog-rating").dialog("open")
+    })
+    $(".button-add-grade-person").on("click",function (){
+        elementGrade = $(this)
+        urlRating ="api/persons/grade/"+$(this).attr("person-id")
+        $("#dialog-rating").dialog("open")
+    })
+
+
+    $(".search-button-title").on("click",function (){
+        let filter = $("#searchTitle").val()
+        for (let item of elements){
+            let title = item.cells[0].innerText
+            if (title.toLowerCase() === filter.toLowerCase()){
+                $(item).css("display","block")
+            }
+            else{
+                $(item).css("display","none")
+            }
+        }
+
+    })
+
+
+   $(".search-button").on("click",function () {
+        let filter = $("#searchGenre").val()
+        for (let item of elements) {
+            let genre = item.cells[4].children;
+            let visible = false;
+
+            for (g of genre) {
+
+                if ($(g).text().toLowerCase() === filter.toLowerCase()) {
+                    visible = true
+                    $(item).css("display","block")
+                    break;
+                }
+            }
+            if (!visible)
+                $(item).css("display","none")
+        }
+    });
+
+    $(".button-delete-movie").on("click",function (){
+        let button = $(this)
+        let url = "api/movies/delete/" + $(button).attr("movie-id")
+        ajaxCallDelete(url,button)
+    })
+    $(".button-delete-actor").on("click",function (){
+        let button = $(this)
+        let url  = "api/persons/delete/" + $(button).attr("person-id")
+        ajaxCallDelete(url,button)
+    })
+    $(".button-delete-discussion").on("click",function (){
+        let button = $(this)
+        let url = "api/discussions/delete/" + $(button).attr("discussion-id")
+        ajaxCallDelete(url,button)
+    })
+
+    $(document.body).on("click",".button-confirm",function (){
+
+        $(this).parent().parent().fadeOut(2000)
+    })
+    $(".person-movies").change(function (){
+        if (this.value === "A"){
+            $(".movie-directors").attr("hidden",true).prop("selected",false)
+
+
+            $(".movies-actors").attr("hidden",false)
+
+        }
+        else{
+            $(".movies-actors").attr("hidden",true).prop("selected",false)
+            $(".movie-directors").attr("hidden",false)
+        }
+    })
+    $(document.body).on("click",".button-add-favourite-list",function (){
+        let button = $(this)
+        let url = "api/movies/like/"+ $(this).attr("movie-id") + "?userId="+ $(this).attr("user-id")
+        ajaxCallLike(url,button,'like','Веќе е филмот допаднат!')
+    })
+    $(document.body).on("click",".button-remove-favourite-list",function (){
+        let button = $(this)
+        let url = "api/movies/unlike/"+ $(this).attr("movie-id")+"?userId="+ $(this).attr("user-id")
+        ajaxCallLike(url,button,'unlike','Немате оставено допаѓање на филмот!')
+    })
+    $(".discussion-type").change(function (){
+        if (this.value === "M"){
+            $(".persons-discussion").hide()
+            $(".movies-discussion").show()
+
+
+        }
+        else{
+            $(".movies-discussion").hide()
+            $(".persons-discussion").show()
+        }
+    })
+
+
+})
+function ajaxCallLike(url,button,type,message){
+    $.ajax({
+        url:url,
+        success:function (data){
+            if (data){
+                let el = $(button).parent().siblings().eq(3)
+                console.log(el)
+                if (type=="like") {
+                    $(el).html(parseInt($(el).text()) + 1)
+                    console.log("da")
+                }
+                else
+                    $(el).html(parseInt($(el).text()) - 1)
+                $(button).css("display","none")
+                let userId = $(button).attr("user-id")
+                let movieId=$(button).attr("movie-id")
+                if (type==='like') {
+                    $(button).parent().append("<a class='btn btn-primary button-remove-favourite-list' movie-id=" + movieId + " user-id=" + userId + ">Избриши од омилена листа</a>")
+                    console.log("da")
+                }
+                else{
+                    $(button).parent().append("<a class='btn btn-primary button-add-favourite-list' movie-id=" + movieId + " user-id=" + userId + ">Додади во омилена листа</a>")
+
+                }
+            }
+            else {
+                $(button).parent().append("<div>" + message +" <button class='button-confirm'>Ок</button></div>")
+            }
+        }
+    })
+}
+function ajaxCallDelete(url,button){
+    $.ajax({
+        url:url,
+        method:"DELETE",
+        success: function (data){
+            if (data){
+                console.log(data)
+                $(button).parent().parent().html("<div>Бришењето е успешно!<button class='button-confirm'>Ок</button></div>")
+            }
+            else {
+                var div = "<div>Веќе е избришан записот! <button class='button-confirm'>Ок</button></div>"
+                button.parent().html(button.parent().html() + div)
+            }
+        }
+    })
+}
+function  ajaxCallRating(url,button,type){
+    model = {
+        rating:$("#grade").val(),
+        reason:$("#reason").val()
+    }
+    $.ajax({
+        url:urlRating,
+        method: "POST",
+        dataType:"json",
+        data:JSON.stringify(model),
+        contentType : 'application/json; charset=utf-8',
+        success: function (data){
+            if (data){
+                console.log(data)
+                $(button).text("Промени оцена и мислење")
+            }
+
+        }
+    })
+}
Index: target/classes/templates/discussion.html
===================================================================
--- target/classes/templates/discussion.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ target/classes/templates/discussion.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,44 @@
+<div xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.w3.org/1999/xhtml">
+    <div th:text="${disc.getMovie() != null ? disc.getMovie().getTitle() : disc.getPerson().getName() + ' ' + disc.getPerson().getSurname()}"></div>
+    <div th:text="${disc.getTitle()}"></div>
+    <div th:text="${disc.getText()}"></div>
+    <div th:text="${disc.getDate()}"></div>
+    <div th:text="${disc.getUser().getUsername()}"></div>
+    <div th:if="${disc.getUser().equals(user)}"><a class="btn btn-primary" th:href="@{'/discussions/add/{id}' (id=${disc.getDiscussionId()})}">Промени</a> </div>
+    <div th:if="${disc.getUser().equals(user)}"><a class="btn btn-primary button-delete-discussion" th:discussion-id="${disc.getDiscussionId()}">Избриши</a> </div>
+    <table class="table table-striped">
+        <thead>
+        <tr>
+
+            <th scope="col">Опис</th>
+            <th scope="col">Датум</th>
+            <th scope="col">Корисник</th>
+            <th:block  sec:authorize="isAuthenticated()">
+
+                <th scope="col"></th>
+                <th scope="col"></th>
+            </th:block>
+
+        </tr>
+        </thead>
+        <tbody>
+        <tr th:each="reply : ${replies}" class="movie">
+            <td th:text="${reply.getText()}"></td>
+            <td th:text="${reply.getDate()}"></td>
+            <td th:text="${reply.getUser().getUsername()}"></td>
+            <td th:if="${reply.getUser().equals(user)}"><a class="btn btn-primary" th:href="@{'/replies/edit/{discussionId}/{replyId}' (discussionId=${disc.getDiscussionId()},replyId=${reply.getReplyId()})}">Промени</a> </td>
+            <td th:if="${reply.getUser().equals(user)}"><a class="btn btn-primary button-delete-reply" th:reply-id="${reply.getReplyId()}" th:dicsussion-id="${disc.getDiscussionId()}">Избриши</a> </td>
+
+            <th:block sec:authorize="isAuthenticated()">
+                <td th:if="${!reply.getUser().equals(user)}"><a class="btn btn-primary" th:href="@{'/replies/add/{discussionId}' (discussionId=${disc.getDiscussionId()})}">Реплицирај</a> </td>
+                <td th:if="${!reply.getUser().equals(user)}">
+                    <a class="btn btn-primary">Ми се допаѓа</a>
+                    <a class="btn btn-primary">Не ми се допаѓа</a>
+                </td>
+            </th:block>
+
+
+        </tr>
+        </tbody>
+    </table>
+</div>
Index: target/classes/templates/discussionForType.html
===================================================================
--- target/classes/templates/discussionForType.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ target/classes/templates/discussionForType.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,53 @@
+<div xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.w3.org/1999/xhtml">
+
+    <div class="container mb-4">
+        <div class="row">
+            <div class="col-12" th:if="${discussions.size() > 0}">
+                <div class="table-responsive">
+                    <table class="table table-striped">
+                        <thead>
+                        <tr>
+                            <th scope="col">Наменета</th>
+                            <th scope="col">Наслов</th>
+                            <th scope="col">Опис</th>
+                            <th scope="col">Датум</th>
+                            <th scope="col">Корисник</th>
+                            <th:block  sec:authorize="isAuthenticated()">
+                                <th:block>
+                                    <th scope="col"></th>
+                                    <th scope="col"></th>
+                                </th:block>
+                                <th scope="col"></th>
+                                <th scope="col"></th>
+                            </th:block>
+
+                        </tr>
+                        </thead>
+                        <tbody>
+                        <tr th:each="disc : ${discussions}" class="movie">
+                            <td th:text="${disc.getMovie() != null ? disc.getMovie().getTitle() : disc.getPerson().getName() + ' ' + disc.getPerson().getSurname()}"></td>
+                            <td th:text="${disc.getTitle()}"></td>
+                            <td th:text="${disc.getText()}"></td>
+                            <td th:text="${disc.getDate()}"></td>
+                            <td th:text="${disc.getUser().getUsername()}"></td>
+                            <td th:if="${disc.getUser().equals(user)}"><a class="btn btn-primary" th:href="@{'/discussions/add/{id}' (id=${disc.getDiscussionId()})}">Промени</a> </td>
+                            <td th:if="${disc.getUser().equals(user)}"><a class="btn btn-primary button-delete-discussion" th:discussion-id="${disc.getDiscussionId()}">Избриши</a> </td>
+
+                            <th:block sec:authorize="isAuthenticated()">
+                                <td th:if="${!disc.getUser().equals(user)}"><a class="btn btn-primary" th:href="@{'/replies/add/{discussionId}' (discussionId=${disc.getDiscussionId()})}">Реплицирај</a> </td>
+                                <td th:if="${!disc.getUser().equals(user)}">
+                                    <a class="btn btn-primary">Ми се допаѓа</a>
+                                    <a class="btn btn-primary">Не ми се допаѓа</a>
+                                </td>
+                            </th:block>
+
+
+                        </tr>
+                        </tbody>
+                    </table>
+                </div>
+            </div>
+        </div>
+    </div>
+
+</div>
Index: target/classes/templates/discussionsAdd.html
===================================================================
--- target/classes/templates/discussionsAdd.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ target/classes/templates/discussionsAdd.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,72 @@
+<main xmlns:th="http://www.thymeleaf.org">
+
+    <div class="container">
+        <div class="row">
+            <div class="col-md-5">
+                <form th:action="@{'/discussions/save/{discussionId}' (discussionId = ${discussion?.getDiscussionId()})}" method="POST">
+                    <div class="form-group">
+
+                        <label for="title">Наслов</label>
+                        <input type="text"
+                               class="form-control"
+                               id="title"
+                               name="title"
+                               th:value="${discussion?.getTitle()}"
+                               required
+                               placeholder="Наслов">
+                    </div>
+                    <div class="form-group">
+                        <label for="text">Опис</label>
+                        <input type="text"
+                               class="form-control"
+                               id="text"
+                               name="text"
+                               th:value="${discussion?.getText()}"
+                               multiple
+                               placeholder="Опис">
+                    </div>
+
+                    <div>
+                        <input type="radio"
+                               class="form-control discussion-type"
+                               name="type"
+                               th:value="M"
+                               th:text="Филм"
+                               th:checked="${discussion?.getType() != null && discussion.getType().toString().equals('M')}"
+
+                        >
+                        <input type="radio"
+                               class="form-control discussion-type"
+                               name="type"
+                               th:value="P"
+                               th:text="Личност"
+                               th:checked="${discussion?.getType() != null && discussion.getType().toString().equals('P')}">
+                    </div>
+
+
+
+
+                    <div class="form-group">
+                        <select name="idDiscussed" class="selected-discussion">
+                            <option></option>
+                            <option class="movies-discussion" th:each="movie:${movies}" th:value="${movie.getMovieId()}"
+                                    th:text="${movie.getTitle()}"
+                                    th:selected="${discussion?.getMovie()?.equals(movie)}"></option>
+
+                            <option class="persons-discussion" th:each="person:${persons}" th:value="${person.getPersonId()}"
+                                    th:text="${person.getName() + ' ' + person.getSurname()}"
+                                    th:selected="${discussion?.getPerson()?.equals(person)}"></option>
+
+                        </select>
+                    </div>
+
+
+                    <button id="submit" type="submit" class="btn btn-primary">Submit</button>
+                    <a type="button" class="btn btn-primary" th:href="@{/discussions}">Back</a>
+                </form>
+            </div>
+        </div>
+    </div>
+
+
+</main>
Index: target/classes/templates/discussionsList.html
===================================================================
--- target/classes/templates/discussionsList.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ target/classes/templates/discussionsList.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,55 @@
+<div xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.w3.org/1999/xhtml">
+    <div class="container mb-4">
+        <a sec:authorize="isAuthenticated()" th:href="@{/discussions/add}">Додади нова дискусија</a>
+    </div>
+    <div class="container mb-4">
+        <div class="row">
+            <div class="col-12" th:if="${discussions.size() > 0}">
+                <div class="table-responsive">
+                    <table class="table table-striped">
+                        <thead>
+                        <tr>
+                            <th scope="col">Наменета</th>
+                            <th scope="col">Наслов</th>
+                            <th scope="col">Опис</th>
+                            <th scope="col">Датум</th>
+                            <th scope="col">Корисник</th>
+                            <th:block  sec:authorize="isAuthenticated()">
+                                <th:block>
+                                    <th scope="col"></th>
+                                    <th scope="col"></th>
+                                </th:block>
+                            <th scope="col"></th>
+                            <th scope="col"></th>
+                            </th:block>
+
+                        </tr>
+                        </thead>
+                        <tbody>
+                        <tr th:each="disc : ${discussions}" class="movie">
+                            <td th:text="${disc.getMovie() != null ? disc.getMovie().getTitle() : disc.getPerson().getName() + ' ' + disc.getPerson().getSurname()}"></td>
+                            <td th:text="${disc.getTitle()}"></td>
+                            <td th:text="${disc.getText()}"></td>
+                            <td th:text="${disc.getDate()}"></td>
+                            <td th:text="${disc.getUser().getUsername()}"></td>
+                            <td th:if="${disc.getUser().equals(user)}"><a class="btn btn-primary" th:href="@{'/discussions/add/{id}' (id=${disc.getDiscussionId()})}">Промени</a> </td>
+                            <td th:if="${disc.getUser().equals(user)}"><a class="btn btn-primary button-delete-discussion" th:discussion-id="${disc.getDiscussionId()}">Избриши</a> </td>
+
+                            <th:block sec:authorize="isAuthenticated()">
+                            <td th:if="${!disc.getUser().equals(user)}"><a class="btn btn-primary" th:href="@{'/replies/add/{discussionId}' (discussionId=${disc.getDiscussionId()})}">Реплицирај</a> </td>
+                            <td th:if="${!disc.getUser().equals(user)}">
+                                <a class="btn btn-primary">Ми се допаѓа</a>
+                                <a class="btn btn-primary">Не ми се допаѓа</a>
+                            </td>
+                            </th:block>
+
+
+                        </tr>
+                        </tbody>
+                    </table>
+                </div>
+            </div>
+        </div>
+    </div>
+
+</div>
Index: target/classes/templates/favoriteList.html
===================================================================
--- target/classes/templates/favoriteList.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ target/classes/templates/favoriteList.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,42 @@
+<div class="container mb-4">
+    <div class="row">
+        <div class="col-12" th:if="${movies.size() > 0}">
+            <div class="table-responsive">
+                <table class="table table-striped">
+                    <thead>
+                    <tr>
+                        <th scope="col">Наслов</th>
+                        <th scope="col">Опис</th>
+                        <th scope="col">Датум издавање</th>
+                        <th scope="col">Допаѓања</th>
+                        <th scope="col">Занрови</th>
+                        <th scope="col">Актери</th>
+                        <th scope="col">Режисер</th>
+
+
+
+                    </tr>
+                    </thead>
+                    <tbody>
+                    <tr th:each="movie : ${movies}" class="elements">
+                        <td th:text="${movie.getTitle()}"></td>
+                        <td th:text="${movie.getDescription()}"></td>
+                        <td th:text="${movie.getAiringDate()}"></td>
+                        <td th:text="${movie.getLikes() != null  ? movie.getLikes().size() : 0}">
+
+                        </td>
+                        <td class="genre">
+                            <div th:each="g: ${movie.getGenres()}" th:text="${g.getGenre().genreType }"></div>
+                        </td>
+                        <td>
+                            <div th:each="a: ${movie.getActors()}" th:text="${a.getPerson().getName()} "></div>
+                        </td>
+                        <td th:text="${movie.getDirector() != null ? movie.getDirector()?.getName() + ' '+ movie.getDirector()?.getSurname() : 'Не е додаен директор'}"></td>
+
+                    </tr>
+                    </tbody>
+                </table>
+            </div>
+        </div>
+    </div>
+</div>
Index: target/classes/templates/fragments/header.html
===================================================================
--- target/classes/templates/fragments/header.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ target/classes/templates/fragments/header.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,64 @@
+<header xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.w3.org/1999/xhtml">
+    <nav class="navbar navbar-expand-md navbar-dark bg-dark">
+        <div class="container">
+            <a class="navbar-brand" href="/">Форум за филмови</a>
+            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault"
+                    aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
+                <span class="navbar-toggler-icon"></span>
+            </button>
+            <div class="collapse navbar-collapse justify-content-end" id="navbarsExampleDefault">
+                <ul class="navbar-nav m-auto">
+                    <li class="nav-item m-auto">
+                        <a class="nav-link active" href="/movies">Филмови</a>
+                    </li>
+                    <li class="nav-item m-auto">
+                        <a class="nav-link active" href="/actors">Актери</a>
+                    </li>
+                    <li class="nav-item m-auto">
+                        <a class="nav-link active" href="/directors">Директори</a>
+                    </li>
+                    <li class="nav-item m-auto">
+                        <a class="nav-link active" href="/discussions">Дискусии</a>
+                    </li>
+                    <li class="nav-item m-auto">
+                        <a class="nav-link active" href="/genres">Жанрови</a>
+                    </li>
+                    <li class="nav-item m-auto" sec:authorize="isAuthenticated()">
+                        <a class="nav-link active" href="/favoriteList">Омилена листа</a>
+                    </li>
+                </ul>
+                <form class="form-inline my-2 my-lg-0">
+                    <div class="input-group input-group-sm">
+                        <input type="text" class="form-control" aria-label="Small"
+                               aria-describedby="inputGroup-sizing-sm"
+                               placeholder="Search...">
+                        <div class="input-group-append">
+                            <button type="button" class="btn btn-secondary btn-number">
+                                <i class="fa fa-search"></i>
+                            </button>
+                        </div>
+                    </div>
+                </form>
+                <ul class="nav navbar-nav navbar-right">
+                    <li class="nav-item" sec:authorize="isAuthenticated()">
+                        <a class="nav-link" href="#">
+                            <th:block th:if="${#request.getRemoteUser() != null}"
+                                      th:text="${#request.getRemoteUser()}"></th:block>
+                        </a>
+                    </li>
+
+                    <li class="nav-item" sec:authorize="isAuthenticated()">
+                        <a class="btn btn-light btn-sm ml-3" href="/logout">
+                            <i class="fa fa-shopping-cart"></i> Одјави се
+                        </a>
+                    </li>
+                    <li class="nav-item" sec:authorize="!isAuthenticated()">
+                        <a class="btn btn-light btn-sm ml-3" href="/login">
+                            <i class="fa fa-shopping-cart"></i> Најави се
+                        </a>
+                    </li>
+                </ul>
+            </div>
+        </div>
+    </nav>
+</header>
Index: target/classes/templates/fragments/searchBarGenre.html
===================================================================
--- target/classes/templates/fragments/searchBarGenre.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ target/classes/templates/fragments/searchBarGenre.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,5 @@
+<div>
+      <label for="searchGenre">жанр</label>
+        <input id="searchGenre" type="text" placeholder="жанр">
+        <button class="search-button">Пребарај</button>
+</div>
Index: target/classes/templates/fragments/searchBarName.html
===================================================================
--- target/classes/templates/fragments/searchBarName.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ target/classes/templates/fragments/searchBarName.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,5 @@
+<div>
+    <label for="searchTitle">Прабарај по име</label>
+    <input id="searchTitle" type="text" placeholder="име">
+    <button class="search-button-title">Пребарај</button>
+</div>
Index: target/classes/templates/genres.html
===================================================================
--- target/classes/templates/genres.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ target/classes/templates/genres.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,23 @@
+<div class="container mb-4">
+  <div class="row">
+    <div class="col-12">
+      <div class="table-responsive">
+        <table class="table table-striped">
+          <thead>
+          <tr>
+            <th scope="col">Име</th>
+            <th scope="col">Лајкови</th>
+          </tr>
+          </thead>
+          <tbody>
+          <tr th:each="genre : ${genres}" class="elements">
+            <td th:text="${genre.getName()}"></td>
+            <td th:text="${genre.getLikes()}"></td>
+
+          </tr>
+          </tbody>
+        </table>
+      </div>
+    </div>
+  </div>
+</div>
Index: target/classes/templates/login.html
===================================================================
--- target/classes/templates/login.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ target/classes/templates/login.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,20 @@
+<div class="container" xmlns:th="http://www.thymeleaf.org">
+    <form class="form-signin mt-xl-5" method="post" action="/login">
+        <h2 class="form-signin-heading">Sign in</h2>
+        <p>
+            <label for="username" class="sr-only">Username</label>
+            <input type="text" id="username" name="username" class="form-control" placeholder="Username" required=""
+                   autofocus="">
+        </p>
+        <p>
+            <label for="password" class="sr-only">Password</label>
+            <input type="password" id="password" name="password" class="form-control" placeholder="Password"
+                   required="">
+        </p>
+
+        <div th:text="${param.error}" class="text-danger"></div>
+
+        <button class="btn btn-lg btn-primary btn-block" type="submit">Sign in</button>
+    </form>
+    <a th:href="@{/register}" class="btn btn-block btn-light">Register here</a>
+</div>
Index: target/classes/templates/moviesAdd.html
===================================================================
--- target/classes/templates/moviesAdd.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ target/classes/templates/moviesAdd.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,90 @@
+<main xmlns:th="http://www.thymeleaf.org">
+
+    <div class="container">
+        <div class="row">
+            <div class="col-md-5">
+                <form th:action="@{'/movies/save/{movieId}' (movieId = ${movie?.getMovieId()})}" method="POST">
+                    <div class="form-group">
+                        <label for="title">Наслов</label>
+                        <input type="text"
+                               class="form-control"
+                               id="title"
+                               name="title"
+                               th:value="${movie?.getTitle()}"
+                               required
+                               placeholder="Наслов">
+                    </div>
+                    <div class="form-group">
+                        <label for="description">Опис</label>
+                        <input type="text"
+                               multiple
+                               class="form-control"
+                               id="description"
+                               name="description"
+                               th:value="${movie?.getDescription()}"
+                               placeholder="Опис">
+                    </div>
+                    <div class="form-group">
+                        <label for="imageUrl">Слика</label>
+                        <input type="text"
+                               class="form-control"
+                               id="imageUrl"
+                               name="imageUrl"
+                               th:value="${movie?.getImageUrl()}"
+                               placeholder="Слика">
+                    </div>
+                    <div class="form-group">
+                        <label for="airingDate">Датум на издавање</label>
+                        <input type="date"
+                               class="form-control"
+                               id="airingDate"
+                               name="airingDate"
+                               th:value="${movie?.getAiringDate()}"
+                               placeholder="Датум на издавање">
+                    </div>
+                    <div class="form-group">
+                        <label for="rating">Рејтинг</label>
+                        <input type="number"
+                               step="0.01"
+                               class="form-control"
+                               id="rating"
+                               name="rating"
+                               th:value="${movie?.getImdbRating()}"
+                               placeholder="Рејтинг">
+                    </div>
+                    <div class="form-group">
+                        <select name="directorId">
+                            <option></option>
+                            <option th:each="dir:${directors}" th:value="${dir.getPersonId()}" th:text="${dir.getName() + ' ' + dir.getSurname()}"
+                            th:selected="${director?.equals(dir)}"></option>
+
+                        </select>
+                    </div>
+                    <div class="form-group">
+                        <select name="actors" multiple>
+                            <option></option>
+                            <option th:each="act:${actors}" th:value="${act.getPersonId()}"
+                                    th:text="${act.getName() + ' ' + act.getSurname()}"
+                                    th:selected="${movieActors?.contains(act)}"></option>
+
+                        </select>
+                    </div>
+                    <div class="form-group">
+                        <select name="genres" multiple>
+                            <option></option>
+                            <option th:each="genr:${genres}" th:value="${genr.getGenreId()}"
+                                    th:text="${genr.getGenreType()}"
+                                    th:selected="${movieGenres?.contains(genr)}"></option>
+
+                        </select>
+                    </div>
+
+                    <button id="submit" type="submit" class="btn btn-primary">Submit</button>
+                    <a type="button" class="btn btn-primary" href="/products">Back</a>
+                </form>
+            </div>
+        </div>
+    </div>
+
+
+</main>
Index: target/classes/templates/moviesList.html
===================================================================
--- target/classes/templates/moviesList.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ target/classes/templates/moviesList.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,79 @@
+<div xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.w3.org/1999/xhtml">
+    <div th:replace="fragments/searchBarGenre">
+
+    </div>
+
+    <div class="container mb-4">
+        <a  sec:authorize="isAuthenticated()" th:href="@{/movies/add}">Додади нов филм</a>
+    </div>
+
+    <div class="container mb-4">
+        <div class="row">
+            <div class="col-12" th:if="${movies.size() > 0}">
+                <div class="table-responsive">
+                    <table class="table table-striped">
+                        <thead>
+                        <tr>
+                            <th scope="col">Наслов</th>
+                            <th scope="col">Опис</th>
+                            <th scope="col">Датум издавање</th>
+                            <th scope="col">Допаѓања</th>
+                            <th scope="col">Занрови</th>
+                            <th scope="col">Актери</th>
+                            <th scope="col">Режисер</th>
+                            <th  scope="col"></th>
+
+                            <th:block sec:authorize="isAuthenticated()">
+                            <th scope="col"></th>
+                            <th scope="col"></th>
+                            <th scope="col"></th>
+                            <th scope="col"></th>
+                            </th:block>
+
+
+
+                        </tr>
+                        </thead>
+                        <tbody>
+                        <tr th:each="movie : ${movies}" class="elements">
+                            <td th:text="${movie.getTitle()}"></td>
+                            <td th:text="${movie.getDescription()}"></td>
+                            <td th:text="${movie.getAiringDate()}"></td>
+                            <td th:text="${movie.getLikes() != null  ? movie.getLikes().size() : 0}">
+
+                            </td>
+                            <td class="genre">
+                                <div th:each="g: ${movie.getGenres()}" th:text="${g.getGenre().genreType }"></div>
+                            </td>
+                            <td>
+                                <div th:each="a: ${movie.getActors()}" th:text="${a.getPerson().getName()} "></div>
+                            </td>
+                            <td th:text="${movie.getDirector() != null ? movie.getDirector()?.getName() + ' '+ movie.getDirector()?.getSurname() : 'Не е додаен директор'}"></td>
+                            <td>
+                                <a class="btn btn-primary" th:href="@{'discussions/all/{id}?type=M' (id=${movie.getMovieId()})}" >Прегледај дискусии</a>
+                            </td>
+                            <th:block sec:authorize="isAuthenticated()">
+                            <td>
+                                <a class="btn btn-primary button-add-favourite-list" th:movie-id="${movie.getMovieId()}" th:user-id="${user.getUserId()}" th:if="${!likedMovies.contains(movie)}">Додади во омилена листа</a>
+                                <a class="btn btn-primary button-remove-favourite-list" th:movie-id="${movie.getMovieId()}" th:user-id="${user.getUserId()}" th:if="${likedMovies.contains(movie)}">Избриши од омилена листа</a>
+
+                            </td>
+                            <td>
+                                <a class="btn btn-primary button-add-grade-movie" th:movie-id="${movie.getMovieId()}">Остави оценка</a>
+                            </td>
+                            <td>
+                                <a class="btn btn-primary" th:href="@{'/movies/{id}/edit' (id=${movie.getMovieId()})}">Промени</a>
+                            </td>
+                            <td>
+                                <a class="btn btn-primary button-delete-movie" th:movie-id="${movie.getMovieId()}">Избриши филм</a>
+                            </td>
+                            </th:block>
+                        </tr>
+                        </tbody>
+                    </table>
+                </div>
+            </div>
+        </div>
+    </div>
+
+</div>
Index: target/classes/templates/personsAdd.html
===================================================================
--- target/classes/templates/personsAdd.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ target/classes/templates/personsAdd.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,99 @@
+<main xmlns:th="http://www.thymeleaf.org">
+
+    <div class="container">
+        <div class="row">
+            <div class="col-md-5">
+                <form th:action="@{'/persons/save/{personId}' (personId = ${person?.getPersonId()})}" method="POST">
+                    <div class="form-group">
+
+                        <label for="name">Име</label>
+                        <input type="text"
+                               class="form-control"
+                               id="name"
+                               name="name"
+                               th:value="${person?.getName()}"
+                               required
+                               placeholder="Име">
+                    </div>
+                    <div class="form-group">
+                        <label for="surname">Презиме</label>
+                        <input type="text"
+                               class="form-control"
+                               id="surname"
+                               name="surname"
+                               th:value="${person?.getSurname()}"
+                               placeholder="Презиме">
+                    </div>
+                    <div class="form-group">
+                        <label for="description">Опис</label>
+                        <input type="text"
+                               class="form-control"
+                               id="description"
+                               name="description"
+                               th:value="${person?.getDescription()}"
+                               placeholder="Опис">
+                    </div>
+                    <div>
+                        <input type="radio"
+                               class="form-control person-movies"
+                               name="type"
+                               th:value="A"
+                               th:text="Актер"
+                               th:checked="${person?.getType() != null && person.getType().toString().equals('A')}"
+
+                        >
+                        <input type="radio"
+                               class="form-control person-movies"
+                               name="type"
+                               th:value="D"
+                               th:text="Режисер"
+                               th:checked="${person?.getType() != null && person.getType().toString().equals('D') }">
+                    </div>
+                    <div class="form-group">
+                        <label for="imageUrl">Слика</label>
+                        <input type="text"
+                               class="form-control"
+                               id="imageUrl"
+                               name="imageUrl"
+                               th:value="${person?.getImageUrl()}"
+                               placeholder="Слика">
+                    </div>
+                    <div class="form-group">
+                        <label for="birthDate">Датум на раѓање</label>
+                        <input type="date"
+                               class="form-control"
+                               id="birthDate"
+                               name="birthDate"
+                               th:value="${person?.getDateOfBirth()}"
+                               placeholder="Датум на раѓање">
+                    </div>
+
+
+                    <div class="form-group">
+                        <select name="movieIds" multiple>
+                            <option></option>
+                            <option th:each="movie:${moviesActors}" th:value="${movie.getMovieId()}"
+                                    th:text="${movie.getTitle()}"
+                                    th:selected="${movieActors?.contains(movie)}"
+                                    th:hidden="${person != null && person.getType().toString()=='D'}"
+                            class="movies-actors"></option>
+
+                            <option th:each="movie:${moviesDirectors}" th:value="${movie.getMovieId()}"
+                                    th:text="${movie.getTitle()}"
+                                    th:selected="${movieActors?.contains(movie)}"
+                                    th:hidden="${person != null && person.getType().toString()=='A'}"
+                            class="movie-directors"></option>
+
+                        </select>
+                    </div>
+
+
+                    <button id="submit" type="submit" class="btn btn-primary">Submit</button>
+                    <a type="button" class="btn btn-primary" th:href="@{/actors}">Back</a>
+                </form>
+            </div>
+        </div>
+    </div>
+
+
+</main>
Index: target/classes/templates/personsList.html
===================================================================
--- target/classes/templates/personsList.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ target/classes/templates/personsList.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,69 @@
+<div xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.w3.org/1999/xhtml">
+
+    <div>
+        <a sec:authorize="isAuthenticated()" th:href="@{'persons/add'}">Додади актер или режисер</a>
+    </div>
+    <div class="container mb-4">
+        <div class="row">
+            <div class="col-12" th:if="${persons.size() > 0}">
+                <div class="table-responsive">
+                    <table class="table table-striped">
+                        <thead>
+                        <tr>
+                            <th scope="col">Име</th>
+                            <th scope="col">Презиме</th>
+                            <th scope="col">Датум рагање</th>
+                            <th scope="col">Опис</th>
+<!--                            <th scope="col">Занрови</th>-->
+                            <th scope="col">Слика</th>
+
+                            <th scope="col">Филмови</th>
+                            <th scope="col"></th>
+                            <th:block sec:authorize="isAuthenticated()">
+                            <th scope="col"></th>
+                            <th scope="col"></th>
+                                <th scope="col"></th>
+
+                            </th:block>
+
+                        </tr>
+                        </thead>
+                        <tbody>
+                        <tr th:each="person : ${persons}" class="elements">
+                            <td th:text="${person.getName()}"></td>
+                            <td th:text="${person.getSurname()}"></td>
+                            <td th:text="${person.getDateOfBirth()}"></td>
+                            <td th:text="${person.getDescription()}"></td>
+
+<!--                            <td>-->
+<!--                                <div th:each="g: ${person.getGenres()}" th:text="${g.getGenre().genreType }"></div>-->
+<!--                            </td>-->
+                            <td><img th:src="${person.getImageUrl()}" style="width: 20%; height: 20%"/></td>
+                            <td>
+                                <div th:each="m: ${person.getMovieActors().size() > 0 ? person.getMovieActors() : person.getMovies()}"
+                                     th:text="${m.getClass().getName() == 'com.wediscussmovies.project.model.relation.MovieActors'  ? m.getMovie().getTitle() : m.getTitle()} "></div>
+                            </td>
+                            <td> <a class="btn btn-primary" th:href="@{'discussions/all/{id}?type=P' (id=${person.getPersonId()})}" >Прегледај дискусии</a></td>
+                            <th:block sec:authorize="isAuthenticated()">
+                                <td>
+                                    <a class="btn btn-primary button-add-grade-person" th:person-id="${person.getPersonId()}">Остави оценка</a>
+
+                                </td>
+                            <td>
+                                <a class="btn btn-primary" th:href="@{'persons/edit/{personId}' (personId = ${person.getPersonId()})}">Промени</a>
+                            </td>
+                            <td>
+                                <a class="btn btn-primary button-delete-actor" th:person-id="${person.getPersonId()}">Избриши</a>
+
+                            </td>
+                            </th:block>
+
+                        </tr>
+                        </tbody>
+                    </table>
+                </div>
+            </div>
+        </div>
+    </div>
+
+</div>
Index: target/classes/templates/register.html
===================================================================
--- target/classes/templates/register.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ target/classes/templates/register.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,40 @@
+<div class="container">
+    <h1 th:text="${error?.toString()}"></h1>
+</div>
+<div class="container">
+    <form class="form-signin mt-xl-5" method="post" action="/register">
+        <h2 class="form-signin-heading">Register</h2>
+        <p>
+            <label for="email" class="sr-only">Емаил</label>
+            <input type="text" id="email" name="email" class="form-control" placeholder="Емаил" required=""
+                   autofocus="">
+        </p>
+        <p>
+            <label for="username" class="sr-only">Корисничко име</label>
+            <input type="text" id="username" name="username" class="form-control" placeholder="Корисничко име" required=""
+                   autofocus="">
+        </p>
+        <p>
+            <label for="password" class="sr-only">Лозинка</label>
+            <input type="password" id="password" name="password" class="form-control" placeholder="Лозинка"
+                   required="">
+        </p>
+        <p>
+            <label for="repeatedPassword" class="sr-only">Потврди лозинка</label>
+            <input type="password" id="repeatedPassword" name="repeatedPassword" class="form-control"
+                   placeholder="Потврди лозинка" required="">
+        </p>
+        <p>
+            <label for="name" class="sr-only">Име</label>
+            <input type="text" id="name" name="name" class="form-control" placeholder="Име" required="" autofocus="">
+        </p>
+        <p>
+            <label for="surname" class="sr-only">Презиме</label>
+            <input type="text" id="surname" name="surname" class="form-control" placeholder="Презиме" required=""
+                   autofocus="">
+        </p>
+
+        <button class="btn btn-lg btn-primary btn-block" type="submit">Регистрирај се</button>
+    </form>
+    <a href="/login" class="btn btn-block btn-light">Најави се</a>
+</div>
Index: target/classes/templates/repliesAdd.html
===================================================================
--- target/classes/templates/repliesAdd.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ target/classes/templates/repliesAdd.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,38 @@
+<main xmlns:th="http://www.thymeleaf.org">
+
+    <div class="container">
+        <div class="row">
+            <div class="col-md-5">
+                <form th:action="@{'/replies/save/{replyId}' (replyId = ${reply?.getReplyId()})}" method="POST">
+
+                    <div class="form-group">
+                        <label for="text">Опис</label>
+                        <input type="text"
+                               class="form-control"
+                               id="text"
+                               name="text"
+                               th:value="${reply?.getText()}"
+                               multiple
+                               placeholder="Опис">
+                    </div>
+                    <input type="hidden"
+                            id="discussionId"
+                           name="discussionId"
+                           th:value="${reply != null ? reply.getDiscussionId() : discussionId}"
+                    >
+
+
+
+
+
+
+
+                    <button id="submit" type="submit" class="btn btn-primary">Submit</button>
+                    <a type="button" class="btn btn-primary" th:href="@{/discussions}">Back</a>
+                </form>
+            </div>
+        </div>
+    </div>
+
+
+</main>
Index: target/classes/templates/template.html
===================================================================
--- target/classes/templates/template.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
+++ target/classes/templates/template.html	(revision 5b447b0d2e718cbed66c944e78e18dd0a5d8bbe3)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
+<head>
+    <meta charset="UTF-8"/>
+    <title>Products</title>
+    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
+    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
+    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
+    <script type="text/javascript" th:src="@{/js/sharedScript.js}" src=""></script>
+    <script src="https://code.jquery.com/jquery-3.6.0.js"></script>
+    <script src="https://code.jquery.com/ui/1.13.0/jquery-ui.js"></script>
+    <link rel="stylesheet" href="//code.jquery.com/ui/1.13.0/themes/base/jquery-ui.css">
+
+    <link rel="stylesheet" th:href="@{/css/shared.css}" >
+</head>
+<body>
+<section class="jumbotron text-center">
+    <div class="container">
+        <h1 class="jumbotron-heading">WEB PROGRAMMING SHOP</h1>
+        <h3 class="jumbotron-heading">All products</h3>
+    </div>
+</section>
+
+<header th:replace="fragments/header"></header>
+<div class="container md-4">
+    <h1 class="danger" th:text="${error?.toString()}"></h1>
+</div>
+<div th:replace="fragments/searchBarName"></div>
+<section th:include="${contentTemplate}"></section>
+<div id="dialog-rating" style="display: none">
+    <label for="reason">Причина</label><textarea id="reason"></textarea>
+    <label for="grade">Рејтинг</label><input type="number" id="grade" max="10" min="5">
+</div>
+</body>
+</html>
+
+
