Index: Sources/src/.idea/dataSources.local.xml
===================================================================
--- Sources/src/.idea/dataSources.local.xml	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/.idea/dataSources.local.xml	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="dataSourceStorageLocal" created-in="IU-213.6461.79">
+    <data-source name="db_202122z_va_prj_wediscussmovies@localhost" uuid="14a5fbd7-f501-41df-a0af-e3b168b536f7">
+      <database-info product="PostgreSQL" version="14.2 (Debian 14.2-1.pgdg110+1)" jdbc-version="4.2" driver-name="PostgreSQL JDBC Driver" driver-version="42.2.22" dbms="POSTGRES" exact-version="14.2" exact-driver-version="42.2">
+        <identifier-quote-string>&quot;</identifier-quote-string>
+      </database-info>
+      <case-sensitivity plain-identifiers="lower" quoted-identifiers="exact" />
+      <secret-storage>master_key</secret-storage>
+      <user-name>db_202122z_va_prj_wediscussmovies_owner</user-name>
+      <schema-mapping>
+        <introspection-scope>
+          <node negative="1">
+            <node kind="database" qname="@">
+              <node kind="schema" qname="@" />
+            </node>
+            <node kind="database" qname="db_202122z_va_prj_wediscussmovies">
+              <node kind="schema" qname="project" />
+            </node>
+          </node>
+        </introspection-scope>
+      </schema-mapping>
+      <ssh-properties>
+        <enabled>true</enabled>
+        <ssh-config-id>9931abea-7a3c-42f6-b05b-a3687248664f</ssh-config-id>
+      </ssh-properties>
+    </data-source>
+  </component>
+</project>
Index: Sources/src/.idea/workspace.xml
===================================================================
--- Sources/src/.idea/workspace.xml	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/.idea/workspace.xml	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,313 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="AutoImportSettings">
+    <option name="autoReloadType" value="SELECTIVE" />
+  </component>
+  <component name="BranchesTreeState">
+    <expand>
+      <path>
+        <item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
+        <item name="LOCAL_ROOT" type="e8cecc67:BranchNodeDescriptor" />
+      </path>
+      <path>
+        <item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
+        <item name="REMOTE_ROOT" type="e8cecc67:BranchNodeDescriptor" />
+      </path>
+      <path>
+        <item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
+        <item name="REMOTE_ROOT" type="e8cecc67:BranchNodeDescriptor" />
+        <item name="GROUP_NODE:origin" type="e8cecc67:BranchNodeDescriptor" />
+      </path>
+    </expand>
+    <select />
+  </component>
+  <component name="ChangeListManager">
+    <list default="true" id="a4a8594b-60d4-405f-854c-bbcb71f3615f" name="Default Changelist" comment="">
+      <change beforePath="$PROJECT_DIR$/../.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/../.idea/workspace.xml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/main/java/com/wediscussmovies/project/model/Person.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/wediscussmovies/project/model/Person.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/main/java/com/wediscussmovies/project/service/impl/MovieServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/wediscussmovies/project/service/impl/MovieServiceImpl.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/main/java/com/wediscussmovies/project/web/controller/MovieController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/wediscussmovies/project/web/controller/MovieController.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/target/classes/com/wediscussmovies/project/model/Person.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/wediscussmovies/project/model/Person.class" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/target/classes/com/wediscussmovies/project/service/impl/MovieServiceImpl.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/wediscussmovies/project/service/impl/MovieServiceImpl.class" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/target/classes/com/wediscussmovies/project/web/controller/MovieController.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/wediscussmovies/project/web/controller/MovieController.class" afterDir="false" />
+    </list>
+    <option name="SHOW_DIALOG" value="false" />
+    <option name="HIGHLIGHT_CONFLICTS" value="true" />
+    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
+    <option name="LAST_RESOLUTION" value="IGNORE" />
+  </component>
+  <component name="FileTemplateManagerImpl">
+    <option name="RECENT_TEMPLATES">
+      <list>
+        <option value="Enum" />
+        <option value="HTML File" />
+        <option value="Class" />
+        <option value="Interface" />
+        <option value="JavaScript File" />
+        <option value="CSS File" />
+      </list>
+    </option>
+  </component>
+  <component name="Git.Settings">
+    <option name="PUSH_TAGS">
+      <GitPushTagMode>
+        <option name="argument" value="--tags" />
+        <option name="title" value="All" />
+      </GitPushTagMode>
+    </option>
+    <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." />
+    <option name="ROOT_SYNC" value="SYNC" />
+  </component>
+  <component name="GitSEFilterConfiguration">
+    <file-type-list>
+      <filtered-out-file-type name="LOCAL_BRANCH" />
+      <filtered-out-file-type name="REMOTE_BRANCH" />
+      <filtered-out-file-type name="TAG" />
+      <filtered-out-file-type name="COMMIT_BY_MESSAGE" />
+    </file-type-list>
+  </component>
+  <component name="HighlightingSettingsPerFile">
+    <setting file="file://$PROJECT_DIR$/src/main/java/com/wediscussmovies/project/service/impl/GenreServiceImpl.java" root0="FORCE_HIGHLIGHTING" />
+  </component>
+  <component name="MarkdownSettingsMigration">
+    <option name="stateVersion" value="1" />
+  </component>
+  <component name="MavenImportPreferences">
+    <option name="generalSettings">
+      <MavenGeneralSettings>
+        <option name="mavenHome" value="C:\Program Files\JetBrains\IntelliJ IDEA 2020.2.3\plugins\maven\lib\maven3" />
+      </MavenGeneralSettings>
+    </option>
+  </component>
+  <component name="ProblemsViewState">
+    <option name="selectedTabId" value="CurrentFile" />
+  </component>
+  <component name="ProjectId" id="23mBzDJUI8qS3mvmlQqwYAyAvEX" />
+  <component name="ProjectLevelVcsManager" settingsEditedManually="true" />
+  <component name="ProjectViewState">
+    <option name="hideEmptyMiddlePackages" value="true" />
+    <option name="showLibraryContents" value="true" />
+    <option name="showMembers" value="true" />
+  </component>
+  <component name="PropertiesComponent">
+    <property name="DatabaseDriversLRU" value="derby&#10;postgresql" />
+    <property name="DefaultHtmlFileTemplate" value="HTML File" />
+    <property name="JPA.DatabaseSchemaImportDialog" value="14a5fbd7-f501-41df-a0af-e3b168b536f7" />
+    <property name="RequestMappingsPanelOrder0" value="0" />
+    <property name="RequestMappingsPanelOrder1" value="1" />
+    <property name="RequestMappingsPanelWidth0" value="75" />
+    <property name="RequestMappingsPanelWidth1" value="75" />
+    <property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
+    <property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
+    <property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
+    <property name="ToolWindowRun.ShowToolbar" value="false" />
+    <property name="WebServerToolWindowFactoryState" value="false" />
+    <property name="aspect.path.notification.shown" value="true" />
+    <property name="database.data.extractors.current.export.id" value="Comma-separated (CSV)_id" />
+    <property name="last_opened_file_path" value="$PROJECT_DIR$" />
+    <property name="list.type.of.created.stylesheet" value="CSS" />
+    <property name="nodejs_package_manager_path" value="npm" />
+    <property name="project.structure.last.edited" value="Modules" />
+    <property name="project.structure.proportion" value="0.15" />
+    <property name="project.structure.side.proportion" value="0.0" />
+    <property name="run.code.analysis.last.selected.profile" value="pProject Default" />
+    <property name="settings.editor.selected.configurable" value="project.propCompiler" />
+    <property name="vue.rearranger.settings.migration" value="true" />
+  </component>
+  <component name="ReactorSettings">
+    <option name="notificationShown" value="true" />
+  </component>
+  <component name="RecentsManager">
+    <key name="MoveFile.RECENT_KEYS">
+      <recent name="D:\FINKI\pet semestar\Bazi na podatoci - Vangel\Proekt\Aplikacija\src\main\resources\templates" />
+      <recent name="D:\FINKI\pet semestar\Bazi na podatoci - Vangel\Proekt\Aplikacija\src\main\resources\templates\addForm" />
+      <recent name="D:\FINKI\pet semestar\Bazi na podatoci - Vangel\Proekt\Aplikacija\src\main\resources\templates\list" />
+      <recent name="D:\FINKI\pet semestar\Bazi na podatoci - Vangel\Proekt\Aplikacija\src\main\resources\static" />
+      <recent name="D:\FINKI\pet semestar\Bazi na podatoci - Vangel\Proekt\Aplikacija\src\main\resources" />
+    </key>
+    <key name="ImportMappingsDialog.RecentPackages">
+      <recent name="com.wediscussmovies.project.model" />
+      <recent name="" />
+    </key>
+  </component>
+  <component name="RunManager">
+    <configuration name="WeDiscussMoviesApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
+      <module name="project" />
+      <option name="SPRING_BOOT_MAIN_CLASS" value="com.wediscussmovies.project.WeDiscussMoviesApplication" />
+      <method v="2">
+        <option name="Make" enabled="true" />
+      </method>
+    </configuration>
+  </component>
+  <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
+  <component name="TaskManager">
+    <task active="true" id="Default" summary="Default task">
+      <changelist id="a4a8594b-60d4-405f-854c-bbcb71f3615f" name="Default Changelist" comment="" />
+      <created>1642329643351</created>
+      <option name="number" value="Default" />
+      <option name="presentableId" value="Default" />
+      <updated>1642329643351</updated>
+      <workItem from="1642329645193" duration="3388000" />
+      <workItem from="1642333165483" duration="65000" />
+      <workItem from="1642333932041" duration="2285000" />
+      <workItem from="1642336266256" duration="7264000" />
+      <workItem from="1642349306319" duration="9640000" />
+      <workItem from="1642359262934" duration="2317000" />
+      <workItem from="1642363004321" duration="310000" />
+      <workItem from="1642365615144" duration="20000" />
+      <workItem from="1642408707962" duration="2484000" />
+      <workItem from="1642416570573" duration="49000" />
+      <workItem from="1642507758659" duration="12611000" />
+      <workItem from="1643668233298" duration="5891000" />
+      <workItem from="1643748587140" duration="15703000" />
+      <workItem from="1643799257380" duration="29336000" />
+      <workItem from="1643843526838" duration="3145000" />
+      <workItem from="1643881602109" duration="3819000" />
+      <workItem from="1643886825761" duration="37019000" />
+      <workItem from="1643995653052" duration="16903000" />
+      <workItem from="1644076897838" duration="1796000" />
+      <workItem from="1644182017143" duration="2618000" />
+      <workItem from="1644188541885" duration="101000" />
+      <workItem from="1644394641877" duration="3000000" />
+      <workItem from="1644413847607" duration="5878000" />
+      <workItem from="1644434959080" duration="3880000" />
+      <workItem from="1644490552754" duration="12346000" />
+      <workItem from="1644512752004" duration="110000" />
+      <workItem from="1644512902919" duration="20000" />
+      <workItem from="1644516085152" duration="60991000" />
+      <workItem from="1644670992588" duration="38631000" />
+      <workItem from="1644751159054" duration="19826000" />
+      <workItem from="1644798201608" duration="83000" />
+      <workItem from="1644834017672" duration="3811000" />
+      <workItem from="1644846305674" duration="494000" />
+      <workItem from="1644848678401" duration="934000" />
+      <workItem from="1645040265988" duration="610000" />
+      <workItem from="1645084657658" duration="2917000" />
+      <workItem from="1645096576209" duration="3594000" />
+      <workItem from="1645129020507" duration="6559000" />
+      <workItem from="1645178345707" duration="8315000" />
+      <workItem from="1645390677675" duration="62000" />
+      <workItem from="1645391262999" duration="6000" />
+      <workItem from="1645398055076" duration="831000" />
+      <workItem from="1645399484372" duration="70000" />
+      <workItem from="1645702078119" duration="657000" />
+      <workItem from="1645899508521" duration="1917000" />
+      <workItem from="1645909508547" duration="641000" />
+      <workItem from="1663275297189" duration="3935000" />
+      <workItem from="1663358017952" duration="3461000" />
+    </task>
+    <task id="LOCAL-00001" summary="Model-database resolved bugs for mapping">
+      <created>1642522697517</created>
+      <option name="number" value="00001" />
+      <option name="presentableId" value="LOCAL-00001" />
+      <option name="project" value="LOCAL" />
+      <updated>1642522697517</updated>
+    </task>
+    <task id="LOCAL-00002" summary="Added CRUD for movies,persons,discussion,replies,genres&#10;Added ajaxcalls">
+      <created>1644013333740</created>
+      <option name="number" value="00002" />
+      <option name="presentableId" value="LOCAL-00002" />
+      <option name="project" value="LOCAL" />
+      <updated>1644013333740</updated>
+    </task>
+    <option name="localTasksCounter" value="3" />
+    <servers />
+  </component>
+  <component name="TypeScriptGeneratedFilesManager">
+    <option name="version" value="3" />
+  </component>
+  <component name="Vcs.Log.History.Properties">
+    <option name="COLUMN_ID_ORDER">
+      <list>
+        <option value="Default.Root" />
+        <option value="Default.Author" />
+        <option value="Default.Date" />
+        <option value="Default.Subject" />
+        <option value="Space.CommitStatus" />
+      </list>
+    </option>
+  </component>
+  <component name="Vcs.Log.Tabs.Properties">
+    <option name="TAB_STATES">
+      <map>
+        <entry key="MAIN">
+          <value>
+            <State />
+          </value>
+        </entry>
+      </map>
+    </option>
+  </component>
+  <component name="VcsManagerConfiguration">
+    <MESSAGE value="Model-database resolved bugs for mapping" />
+    <MESSAGE value="Added CRUD for movies,persons,discussion,replies,genres&#10;Added ajaxcalls" />
+    <option name="LAST_COMMIT_MESSAGE" value="Added CRUD for movies,persons,discussion,replies,genres&#10;Added ajaxcalls" />
+  </component>
+  <component name="XDebuggerManager">
+    <breakpoint-manager>
+      <breakpoints>
+        <line-breakpoint enabled="true" type="java-line">
+          <url>jar://$MAVEN_REPOSITORY$/com/zaxxer/HikariCP/4.0.3/HikariCP-4.0.3.jar!/com/zaxxer/hikari/HikariDataSource.class</url>
+          <line>31</line>
+          <option name="timeStamp" value="1" />
+        </line-breakpoint>
+        <line-breakpoint enabled="true" type="java-line">
+          <url>jar://$MAVEN_REPOSITORY$/com/zaxxer/HikariCP/4.0.3/HikariCP-4.0.3.jar!/com/zaxxer/hikari/HikariDataSource.class</url>
+          <line>111</line>
+          <option name="timeStamp" value="2" />
+        </line-breakpoint>
+        <line-breakpoint enabled="true" type="java-line">
+          <url>file://$PROJECT_DIR$/src/main/java/com/wediscussmovies/project/service/impl/GenreServiceImpl.java</url>
+          <line>58</line>
+          <option name="timeStamp" value="74" />
+        </line-breakpoint>
+        <line-breakpoint enabled="true" type="java-line">
+          <url>file://$PROJECT_DIR$/src/main/java/com/wediscussmovies/project/service/impl/GenreServiceImpl.java</url>
+          <line>63</line>
+          <option name="timeStamp" value="90" />
+        </line-breakpoint>
+        <line-breakpoint enabled="true" type="java-line">
+          <url>file://$PROJECT_DIR$/src/main/java/com/wediscussmovies/project/web/controller/DiscussionController.java</url>
+          <line>94</line>
+          <option name="timeStamp" value="104" />
+        </line-breakpoint>
+        <line-breakpoint enabled="true" type="java-line">
+          <url>file://$PROJECT_DIR$/src/main/java/com/wediscussmovies/project/web/controller/DiscussionController.java</url>
+          <line>163</line>
+          <option name="timeStamp" value="106" />
+        </line-breakpoint>
+        <line-breakpoint enabled="true" type="java-line">
+          <url>file://$PROJECT_DIR$/src/main/java/com/wediscussmovies/project/configuration/PasswordEncoder.java</url>
+          <line>11</line>
+          <option name="timeStamp" value="111" />
+        </line-breakpoint>
+        <breakpoint enabled="true" type="java-exception">
+          <properties class="org.springframework.data.mapping.PropertyReferenceException" package="org.springframework.data.mapping" />
+          <option name="timeStamp" value="6" />
+        </breakpoint>
+        <breakpoint enabled="true" type="java-exception">
+          <properties class="graphql.AssertException" package="graphql" />
+          <option name="timeStamp" value="96" />
+        </breakpoint>
+        <line-breakpoint enabled="true" type="javascript">
+          <url>file://$PROJECT_DIR$/src/main/resources/static/js/sharedScript.js</url>
+          <line>2</line>
+          <option name="timeStamp" value="71" />
+        </line-breakpoint>
+        <line-breakpoint enabled="true" type="javascript">
+          <url>file://$PROJECT_DIR$/src/main/resources/static/js/graphqlmovie.js</url>
+          <line>321</line>
+          <option name="timeStamp" value="101" />
+        </line-breakpoint>
+      </breakpoints>
+    </breakpoint-manager>
+    <pin-to-top-manager>
+      <pinned-members>
+        <PinnedItemInfo parentTag="com.wediscussmovies.project.model.Movie" memberName="director" />
+      </pinned-members>
+    </pin-to-top-manager>
+  </component>
+  <component name="com.intellij.coverage.CoverageDataManagerImpl">
+    <SUITE FILE_PATH="coverage/project$WeDiscussMoviesApplication.ic" NAME="WeDiscussMoviesApplication Coverage Results" MODIFIED="1644519581198" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="idea" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" />
+  </component>
+</project>
Index: Sources/src/main/java/com/wediscussmovies/project/LoggedUser.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/LoggedUser.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/LoggedUser.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,21 @@
+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: Sources/src/main/java/com/wediscussmovies/project/WeDiscussMoviesApplication.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/WeDiscussMoviesApplication.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/WeDiscussMoviesApplication.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,23 @@
+package com.wediscussmovies.project;
+
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.Bean;
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
+import org.springframework.security.crypto.password.PasswordEncoder;
+
+@SpringBootApplication
+public class WeDiscussMoviesApplication {
+
+    public static void main(String[] args) {
+
+        SpringApplication.run(WeDiscussMoviesApplication.class, args);
+    }
+    @Bean
+    PasswordEncoder getPasswordEncoder(){
+        return new BCryptPasswordEncoder(10);
+    }
+
+
+}
Index: Sources/src/main/java/com/wediscussmovies/project/ajaxmodels/Grade.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/ajaxmodels/Grade.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/ajaxmodels/Grade.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -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: Sources/src/main/java/com/wediscussmovies/project/configuration/CustomUsernamePasswordAuthenticationProvider.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/configuration/CustomUsernamePasswordAuthenticationProvider.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/configuration/CustomUsernamePasswordAuthenticationProvider.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -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: Sources/src/main/java/com/wediscussmovies/project/configuration/SecurityConfig.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/configuration/SecurityConfig.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/configuration/SecurityConfig.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,54 @@
+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.builders.WebSecurity;
+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(WebSecurity web) throws Exception {
+        web.ignoring().antMatchers("/*.jpg");
+        web.ignoring().antMatchers("/*.png");
+        web.ignoring().antMatchers("/*.css");
+        web.ignoring().antMatchers("/*.js");
+    }
+
+    @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","/movies/**/","/actors","/persons/**/","/directors","/discussions","/profiles/**","/discussions/**/","/discussions/all/**/","/replies","/register","/genres", "/css/**","/img/**", "/js/**").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: Sources/src/main/java/com/wediscussmovies/project/model/Discussion.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/model/Discussion.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/model/Discussion.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,77 @@
+package com.wediscussmovies.project.model;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import org.springframework.beans.factory.annotation.Value;
+
+import javax.persistence.*;
+import java.time.LocalDate;
+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 LocalDate 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;
+
+    @Transient
+    private long likes;
+
+    public Discussion(Character type, String text, String title, LocalDate date, User user) {
+        this.type = type;
+        this.text = text;
+        this.title = title;
+        this.date = date;
+        this.user = user;
+    }
+
+
+
+    public Discussion() {
+    }
+
+
+    @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: Sources/src/main/java/com/wediscussmovies/project/model/Genre.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/model/Genre.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/model/Genre.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,45 @@
+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(int genreId, String genreType) {
+        this.genreId = genreId;
+        this.genreType = genreType;
+    }
+
+    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: Sources/src/main/java/com/wediscussmovies/project/model/Movie.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/model/Movie.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/model/Movie.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,110 @@
+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 org.hibernate.annotations.Fetch;
+
+import javax.persistence.*;
+import java.io.Serializable;
+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", fetch = FetchType.LAZY)
+    private Collection<MovieActors> actors;
+    @OneToMany(mappedBy = "movie", fetch = FetchType.LAZY)
+    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;
+
+    }
+
+    public Movie(int movieId, String title, Double imdbRating, String imageUrl) {
+        this.movieId = movieId;
+        this.title = title;
+        this.imdbRating = imdbRating;
+        this.imageUrl = imageUrl;
+    }
+
+    public String getDateFormatted(){
+        String dob = airingDate.toString();
+        String [] parts = dob.split("-");
+        return parts[2]+"/"+parts[1]+"/"+parts[0];
+    }
+
+    @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);
+
+
+    public String getShortTitle(){
+        int to = 20;
+        if (title.length() < to)
+            to = title.length();
+        if(to<20)
+            return title;
+        return title.substring(0, to) + "...";
+    }
+
+
+
+
+}
Index: Sources/src/main/java/com/wediscussmovies/project/model/PasswordEncoder.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/model/PasswordEncoder.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/model/PasswordEncoder.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,36 @@
+package com.wediscussmovies.project.model;
+
+
+import java.math.BigInteger;
+import java.nio.charset.StandardCharsets;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+public class PasswordEncoder {
+    public static byte[] getSHA(String input) throws NoSuchAlgorithmException
+    {
+        MessageDigest md = MessageDigest.getInstance("SHA-512");
+
+        return md.digest(input.getBytes(StandardCharsets.UTF_8));
+    }
+
+    public static String toHexString(byte[] hash)
+    {
+        BigInteger number = new BigInteger(1, hash);
+
+        StringBuilder hexString = new StringBuilder(number.toString(16));
+
+        while (hexString.length() < 32)
+        {
+            hexString.insert(0, '0');
+        }
+
+        return hexString.toString();
+    }
+
+    public static String getEncodedPasswordString(String password) throws NoSuchAlgorithmException {
+        return toHexString(getSHA(password));
+    }
+
+}
+
Index: Sources/src/main/java/com/wediscussmovies/project/model/Person.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/model/Person.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/model/Person.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,103 @@
+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 javax.swing.text.DateFormatter;
+import java.io.Serializable;
+import java.sql.Date;
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
+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 String getDateFormatted(){
+        String dob = dateOfBirth.toString();
+        String [] parts = dob.split("-");
+        return parts[2]+"/"+parts[1]+"/"+parts[0];
+    }
+
+
+    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;
+    }
+
+    public boolean hasGradeFromUser(User user){
+        for(PersonRates p: personRates){
+            if(p.getUser().getUserId() == user.getUserId())
+                return true;
+        }
+        return false;
+    }
+
+}
Index: Sources/src/main/java/com/wediscussmovies/project/model/Reply.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/model/Reply.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/model/Reply.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -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: Sources/src/main/java/com/wediscussmovies/project/model/User.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/model/User.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/model/User.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,105 @@
+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.io.Serializable;
+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: Sources/src/main/java/com/wediscussmovies/project/model/enumerations/DiscussionType.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/model/enumerations/DiscussionType.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/model/enumerations/DiscussionType.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,5 @@
+package com.wediscussmovies.project.model.enumerations;
+
+public enum DiscussionType {
+    M,P
+}
Index: Sources/src/main/java/com/wediscussmovies/project/model/enumerations/PersonType.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/model/enumerations/PersonType.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/model/enumerations/PersonType.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,5 @@
+package com.wediscussmovies.project.model.enumerations;
+
+public enum PersonType {
+    A, D
+}
Index: Sources/src/main/java/com/wediscussmovies/project/model/exception/DiscussionNotExistException.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/model/exception/DiscussionNotExistException.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/model/exception/DiscussionNotExistException.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,7 @@
+package com.wediscussmovies.project.model.exception;
+
+public class DiscussionNotExistException extends RuntimeException{
+    public DiscussionNotExistException(Integer id){
+        super("Дискусијата со број " + id +" не постои!");
+    }
+}
Index: Sources/src/main/java/com/wediscussmovies/project/model/exception/GenreNotExistException.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/model/exception/GenreNotExistException.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/model/exception/GenreNotExistException.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,7 @@
+package com.wediscussmovies.project.model.exception;
+
+public class GenreNotExistException extends RuntimeException {
+    public GenreNotExistException(Integer id){
+        super("Жанрот со дадениот идентификатор " + id + " не постои!");
+    }
+}
Index: Sources/src/main/java/com/wediscussmovies/project/model/exception/InvalidArgumentsException.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/model/exception/InvalidArgumentsException.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/model/exception/InvalidArgumentsException.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,7 @@
+package com.wediscussmovies.project.model.exception;
+
+public class InvalidArgumentsException extends RuntimeException{
+    public InvalidArgumentsException(){
+        super("Невалидна најава!");
+    }
+}
Index: Sources/src/main/java/com/wediscussmovies/project/model/exception/InvalidUserCredentialsException.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/model/exception/InvalidUserCredentialsException.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/model/exception/InvalidUserCredentialsException.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,7 @@
+package com.wediscussmovies.project.model.exception;
+
+public class InvalidUserCredentialsException extends RuntimeException{
+    public InvalidUserCredentialsException(String username) {
+        super("The user with the username {" + username +"} cannot be authenticated.");
+    }
+}
Index: Sources/src/main/java/com/wediscussmovies/project/model/exception/MovieHasAlreadyDirector.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/model/exception/MovieHasAlreadyDirector.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/model/exception/MovieHasAlreadyDirector.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -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: Sources/src/main/java/com/wediscussmovies/project/model/exception/MovieIdNotFoundException.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/model/exception/MovieIdNotFoundException.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/model/exception/MovieIdNotFoundException.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,7 @@
+package com.wediscussmovies.project.model.exception;
+
+public class MovieIdNotFoundException extends RuntimeException{
+    public MovieIdNotFoundException(Integer id) {
+        super("Movie with id {"+id+"} was not found.");
+    }
+}
Index: Sources/src/main/java/com/wediscussmovies/project/model/exception/NotEnoughArgumentsException.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/model/exception/NotEnoughArgumentsException.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/model/exception/NotEnoughArgumentsException.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,4 @@
+package com.wediscussmovies.project.model.exception;
+
+public class NotEnoughArgumentsException {
+}
Index: Sources/src/main/java/com/wediscussmovies/project/model/exception/PasswordsDoNotMatchException.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/model/exception/PasswordsDoNotMatchException.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/model/exception/PasswordsDoNotMatchException.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,7 @@
+package com.wediscussmovies.project.model.exception;
+
+public class PasswordsDoNotMatchException extends RuntimeException{
+    public PasswordsDoNotMatchException(){
+        super("Лозинките не се совпаѓаат!");
+    }
+}
Index: Sources/src/main/java/com/wediscussmovies/project/model/exception/PasswordsDontMatchException.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/model/exception/PasswordsDontMatchException.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/model/exception/PasswordsDontMatchException.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,7 @@
+package com.wediscussmovies.project.model.exception;
+
+public class PasswordsDontMatchException extends RuntimeException{
+    public PasswordsDontMatchException() {
+        super("The passwords you provided did not match.");
+    }
+}
Index: Sources/src/main/java/com/wediscussmovies/project/model/exception/PersonNotExistException.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/model/exception/PersonNotExistException.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/model/exception/PersonNotExistException.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,7 @@
+package com.wediscussmovies.project.model.exception;
+
+public class PersonNotExistException extends RuntimeException{
+    public PersonNotExistException(Integer id){
+        super("Личност со број " + id + " не постои!");
+    }
+}
Index: Sources/src/main/java/com/wediscussmovies/project/model/exception/ReplyNotExistException.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/model/exception/ReplyNotExistException.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/model/exception/ReplyNotExistException.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -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: Sources/src/main/java/com/wediscussmovies/project/model/exception/UserNotExistException.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/model/exception/UserNotExistException.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/model/exception/UserNotExistException.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,7 @@
+package com.wediscussmovies.project.model.exception;
+
+public class UserNotExistException extends RuntimeException{
+    public UserNotExistException(String username){
+        super("Корисник со корисничко име " + username + " не постои!");
+    }
+}
Index: Sources/src/main/java/com/wediscussmovies/project/model/exception/UserWithEmailAlreadyExists.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/model/exception/UserWithEmailAlreadyExists.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/model/exception/UserWithEmailAlreadyExists.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,7 @@
+package com.wediscussmovies.project.model.exception;
+
+public class UserWithEmailAlreadyExists extends RuntimeException{
+    public UserWithEmailAlreadyExists(String email) {
+        super("User with the email {" + email +"} is already registered");
+    }
+}
Index: Sources/src/main/java/com/wediscussmovies/project/model/exception/UserWithUsernameAlreadyExists.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/model/exception/UserWithUsernameAlreadyExists.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/model/exception/UserWithUsernameAlreadyExists.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,7 @@
+package com.wediscussmovies.project.model.exception;
+
+public class UserWithUsernameAlreadyExists extends RuntimeException{
+    public UserWithUsernameAlreadyExists(String username) {
+        super("User with the username " + username + " is already registered");
+    }
+}
Index: Sources/src/main/java/com/wediscussmovies/project/model/exception/UsernameAlreadyExistsException.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/model/exception/UsernameAlreadyExistsException.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/model/exception/UsernameAlreadyExistsException.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,7 @@
+package com.wediscussmovies.project.model.exception;
+
+public class UsernameAlreadyExistsException extends RuntimeException{
+    public UsernameAlreadyExistsException(String username){
+        super("Корисничкото име е зафатено " + username);
+    }
+}
Index: Sources/src/main/java/com/wediscussmovies/project/model/primarykeys/DiscussionLikesPK.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/model/primarykeys/DiscussionLikesPK.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/model/primarykeys/DiscussionLikesPK.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,40 @@
+package com.wediscussmovies.project.model.primarykeys;
+
+
+import lombok.Data;
+
+import javax.persistence.Column;
+import javax.persistence.Embeddable;
+import java.io.Serializable;
+import java.util.Objects;
+
+@Embeddable
+@Data
+public class DiscussionLikesPK implements Serializable {
+    @Column(name = "discussion_id")
+    private int discussionId;
+
+    @Column(name = "user_id")
+    private int userId;
+
+    public DiscussionLikesPK(int discussionId, int userId) {
+        this.discussionId = discussionId;
+        this.userId = userId;
+    }
+
+    public DiscussionLikesPK() {
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        DiscussionLikesPK that = (DiscussionLikesPK) o;
+        return discussionId == that.discussionId && userId == that.userId;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(discussionId, userId);
+    }
+}
Index: Sources/src/main/java/com/wediscussmovies/project/model/primarykeys/GenreLikesPK.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/model/primarykeys/GenreLikesPK.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/model/primarykeys/GenreLikesPK.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,43 @@
+package com.wediscussmovies.project.model.primarykeys;
+
+import lombok.Data;
+
+import javax.persistence.Column;
+import javax.persistence.Embeddable;
+import java.io.Serializable;
+
+@Embeddable
+@Data
+public class GenreLikesPK implements Serializable {
+
+    @Column(name = "genre_id")
+    private int genreId;
+
+    @Column(name = "user_id")
+    private int userId;
+
+    public GenreLikesPK() {
+    }
+
+    public GenreLikesPK(int genreId, int userId) {
+        this.genreId = genreId;
+        this.userId = userId;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        GenreLikesPK that = (GenreLikesPK) o;
+
+        return userId == that.userId && genreId == that.genreId;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = genreId;
+        result = 31 * result + userId;
+        return result;
+    }
+}
Index: Sources/src/main/java/com/wediscussmovies/project/model/primarykeys/MovieActorsPK.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/model/primarykeys/MovieActorsPK.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/model/primarykeys/MovieActorsPK.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -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: Sources/src/main/java/com/wediscussmovies/project/model/primarykeys/MovieGenresPK.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/model/primarykeys/MovieGenresPK.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/model/primarykeys/MovieGenresPK.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -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: Sources/src/main/java/com/wediscussmovies/project/model/primarykeys/MovieLikesPK.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/model/primarykeys/MovieLikesPK.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/model/primarykeys/MovieLikesPK.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -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: Sources/src/main/java/com/wediscussmovies/project/model/primarykeys/MovieRatesPK.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/model/primarykeys/MovieRatesPK.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/model/primarykeys/MovieRatesPK.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -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: Sources/src/main/java/com/wediscussmovies/project/model/primarykeys/PersonRatesPK.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/model/primarykeys/PersonRatesPK.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/model/primarykeys/PersonRatesPK.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -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: Sources/src/main/java/com/wediscussmovies/project/model/primarykeys/ReplyPK.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/model/primarykeys/ReplyPK.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/model/primarykeys/ReplyPK.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -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: Sources/src/main/java/com/wediscussmovies/project/model/primarykeys/UserGenresPK.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/model/primarykeys/UserGenresPK.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/model/primarykeys/UserGenresPK.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -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;
+
+@Data
+@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: Sources/src/main/java/com/wediscussmovies/project/model/relation/DiscussionLikes.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/model/relation/DiscussionLikes.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/model/relation/DiscussionLikes.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,39 @@
+package com.wediscussmovies.project.model.relation;
+
+
+import com.wediscussmovies.project.model.Discussion;
+import com.wediscussmovies.project.model.Movie;
+import com.wediscussmovies.project.model.User;
+import com.wediscussmovies.project.model.primarykeys.DiscussionLikesPK;
+import com.wediscussmovies.project.model.primarykeys.MovieLikesPK;
+import lombok.Data;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name = "discussion_likes", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
+@Data
+public class DiscussionLikes {
+    @EmbeddedId
+    private DiscussionLikesPK id;
+
+    @ManyToOne
+    @MapsId("discussion_id")
+    @JoinColumn(name = "discussion_id")
+    private Discussion discussion;
+
+
+    @ManyToOne
+    @MapsId("user_id")
+    @JoinColumn(name = "user_id")
+    private User user;
+
+    public DiscussionLikes(Discussion discussion, User user) {
+        this.id = new DiscussionLikesPK(discussion.getDiscussionId(), user.getUserId());
+        this.discussion = discussion;
+        this.user = user;
+    }
+
+    public DiscussionLikes() {
+    }
+}
Index: Sources/src/main/java/com/wediscussmovies/project/model/relation/MovieActors.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/model/relation/MovieActors.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/model/relation/MovieActors.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -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: Sources/src/main/java/com/wediscussmovies/project/model/relation/MovieGenres.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/model/relation/MovieGenres.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/model/relation/MovieGenres.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -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: Sources/src/main/java/com/wediscussmovies/project/model/relation/MovieLikes.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/model/relation/MovieLikes.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/model/relation/MovieLikes.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -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: Sources/src/main/java/com/wediscussmovies/project/model/relation/MovieRates.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/model/relation/MovieRates.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/model/relation/MovieRates.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -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: Sources/src/main/java/com/wediscussmovies/project/model/relation/PersonRates.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/model/relation/PersonRates.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/model/relation/PersonRates.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -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: Sources/src/main/java/com/wediscussmovies/project/model/relation/UserGenres.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/model/relation/UserGenres.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/model/relation/UserGenres.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -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: Sources/src/main/java/com/wediscussmovies/project/querymodels/DiscussionLikesQM.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/querymodels/DiscussionLikesQM.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/querymodels/DiscussionLikesQM.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,34 @@
+package com.wediscussmovies.project.querymodels;
+
+import com.wediscussmovies.project.model.Movie;
+import com.wediscussmovies.project.model.Person;
+import com.wediscussmovies.project.model.User;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.time.LocalDate;
+import java.util.Date;
+import java.util.Objects;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class DiscussionLikesQM {
+
+    private Integer discussionId;
+    private Long likes;
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        DiscussionLikesQM that = (DiscussionLikesQM) o;
+        return Objects.equals(discussionId, that.discussionId) && Objects.equals(likes, that.likes);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(discussionId, likes);
+    }
+}
Index: Sources/src/main/java/com/wediscussmovies/project/querymodels/GenreLikesQM.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/querymodels/GenreLikesQM.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/querymodels/GenreLikesQM.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,34 @@
+package com.wediscussmovies.project.querymodels;
+
+import lombok.Data;
+
+import java.util.Objects;
+
+@Data
+public class GenreLikesQM {
+    private Integer genreId;
+    private String name;
+    private Long likes;
+
+    //public static Comparator<GenreLikes> sorter = Comparator.comparing(GenreLikes::getLikes).thenComparing(GenreLikes::getName).reversed();
+
+    public GenreLikesQM(Integer genreId, String name, Long likes) {
+        this.genreId = genreId;
+        this.name = name;
+        this.likes = likes;
+
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        GenreLikesQM that = (GenreLikesQM) o;
+        return Objects.equals(genreId, that.genreId);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(genreId);
+    }
+}
Index: Sources/src/main/java/com/wediscussmovies/project/querymodels/MovieLikesQM.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/querymodels/MovieLikesQM.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/querymodels/MovieLikesQM.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,29 @@
+package com.wediscussmovies.project.querymodels;
+
+import lombok.Data;
+
+import java.util.Objects;
+
+@Data
+public class MovieLikesQM {
+    private Integer movieId;
+    private Long likes;
+
+    public MovieLikesQM(Integer movieId, Long likes) {
+        this.movieId = movieId;
+        this.likes = likes;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        MovieLikesQM that = (MovieLikesQM) o;
+        return Objects.equals(movieId, that.movieId) && Objects.equals(likes, that.likes);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(movieId, likes);
+    }
+}
Index: Sources/src/main/java/com/wediscussmovies/project/repository/DiscussionLikesRepository.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/repository/DiscussionLikesRepository.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/repository/DiscussionLikesRepository.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,19 @@
+package com.wediscussmovies.project.repository;
+
+import com.wediscussmovies.project.model.User;
+import com.wediscussmovies.project.model.primarykeys.DiscussionLikesPK;
+import com.wediscussmovies.project.model.primarykeys.UserGenresPK;
+import com.wediscussmovies.project.model.relation.DiscussionLikes;
+import com.wediscussmovies.project.model.relation.MovieLikes;
+import com.wediscussmovies.project.model.relation.UserGenres;
+import org.springframework.data.domain.Sort;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface DiscussionLikesRepository extends JpaRepository<DiscussionLikes, DiscussionLikesPK> {
+    List<DiscussionLikes> findAllByUser(User user);
+
+}
Index: Sources/src/main/java/com/wediscussmovies/project/repository/DiscussionRepository.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/repository/DiscussionRepository.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/repository/DiscussionRepository.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,35 @@
+package com.wediscussmovies.project.repository;
+
+import com.wediscussmovies.project.model.Discussion;
+import com.wediscussmovies.project.model.Movie;
+import com.wediscussmovies.project.model.Person;
+import com.wediscussmovies.project.querymodels.DiscussionLikesQM;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
+import org.springframework.stereotype.Repository;
+
+import javax.transaction.Transactional;
+import java.util.List;
+
+@Repository
+public interface DiscussionRepository extends JpaRepository<Discussion, Integer> {
+     List<Discussion> findAllByTitleLike(String title);
+     List<Discussion> findAllByMovie(Movie movie);
+     List<Discussion> findAllByPerson (Person person);
+
+     @Query(value = "select new com.wediscussmovies.project.querymodels.DiscussionLikesQM(d.discussionId, count (dl.user) ) from Discussion d" +
+             " left join DiscussionLikes dl on dl.id.discussionId = d.discussionId" +
+             " where :id = d.discussionId" +
+             " group by d.discussionId")
+     @Transactional
+     DiscussionLikesQM findDiscussionWithLikes(@Param("id") Integer discussionId);
+
+     @Query(value = "select new com.wediscussmovies.project.querymodels.DiscussionLikesQM (d.discussionId, count(dl.user))  from Discussion d" +
+             " left join DiscussionLikes dl on dl.id.discussionId = d.discussionId" +
+             " group by d.discussionId"+
+               " order by d.discussionId asc")
+     @Transactional
+     List<DiscussionLikesQM
+             > findAllDiscussionsWithLikes();
+}
Index: Sources/src/main/java/com/wediscussmovies/project/repository/GenreLikesRepository.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/repository/GenreLikesRepository.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/repository/GenreLikesRepository.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,14 @@
+package com.wediscussmovies.project.repository;
+
+import com.wediscussmovies.project.model.User;
+import com.wediscussmovies.project.model.primarykeys.UserGenresPK;
+import com.wediscussmovies.project.model.relation.UserGenres;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface GenreLikesRepository  extends JpaRepository<UserGenres, UserGenresPK> {
+    List<UserGenres> findAllByUser(User user);
+}
Index: Sources/src/main/java/com/wediscussmovies/project/repository/GenreRepository.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/repository/GenreRepository.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/repository/GenreRepository.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,33 @@
+package com.wediscussmovies.project.repository;
+
+import com.wediscussmovies.project.model.Genre;
+import com.wediscussmovies.project.querymodels.GenreLikesQM;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
+import org.springframework.stereotype.Repository;
+
+import javax.transaction.Transactional;
+import java.util.List;
+
+@Repository
+public interface GenreRepository extends JpaRepository<Genre, Integer> {
+     List<Genre> findAllByGenreType(String genre);
+
+     @Query(value = "select new com.wediscussmovies.project.querymodels.GenreLikesQM(g.genreId, g.genreType, count(ug.id.userId)) from Genre g" +
+             " left join UserGenres ug on ug.id.genreId = g.genreId" +
+             " group by g.genreId, g.genreType" +
+             " order by count(ug.id.userId) desc, g.genreType asc")
+     @Transactional
+     List<GenreLikesQM> findAllWithLikes();
+
+     @Modifying
+     @Query(value = "insert into project.user_genres (user_id,genre_id) values(:user_id,:genre_id)",nativeQuery = true)
+     @Transactional
+     void insertInto(@Param("user_id")Integer userId, @Param("genre_id")Integer genreId);
+
+     @Query(value = "select new com.wediscussmovies.project.model.Genre (g.genreId, g.genreType) from Genre g" +
+     " ORDER BY g.genreType DESC")
+     List<Genre> findAllSorted();
+}
Index: Sources/src/main/java/com/wediscussmovies/project/repository/MovieActorsRepository.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/repository/MovieActorsRepository.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/repository/MovieActorsRepository.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -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: Sources/src/main/java/com/wediscussmovies/project/repository/MovieGenresRepository.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/repository/MovieGenresRepository.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/repository/MovieGenresRepository.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -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: Sources/src/main/java/com/wediscussmovies/project/repository/MovieLikesRepository.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/repository/MovieLikesRepository.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/repository/MovieLikesRepository.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -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: Sources/src/main/java/com/wediscussmovies/project/repository/MovieRatesRepository.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/repository/MovieRatesRepository.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/repository/MovieRatesRepository.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -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: Sources/src/main/java/com/wediscussmovies/project/repository/MovieRepository.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/repository/MovieRepository.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/repository/MovieRepository.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,43 @@
+package com.wediscussmovies.project.repository;
+
+import com.wediscussmovies.project.model.Movie;
+import com.wediscussmovies.project.model.Person;
+import com.wediscussmovies.project.querymodels.MovieLikesQM;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
+import org.springframework.stereotype.Repository;
+
+import javax.transaction.Transactional;
+import java.util.List;
+import java.util.Optional;
+
+@Repository
+public interface MovieRepository extends JpaRepository<Movie, Integer> {
+     List<Movie> findAllByTitleLike(String Title);
+     List<Movie> findAllByDirector(Person director);
+     List<Movie> findAllByDirectorIsNull();
+     @Query(value="select m.movieId from Movie m")
+     List<Integer> findAllMovieIds();
+
+     @Query(value="select new com.wediscussmovies.project.model.Movie(m.movieId, m.title, m.imdbRating, m.imageUrl) from Movie m" +
+               " where m.movieId = :index")
+     Optional<Movie> findBasicById(@Param("index")Integer index);
+
+
+     @Query(value = "select new com.wediscussmovies.project.querymodels.MovieLikesQM(m.movieId, count(ml.id.userId)) from Movie m" +
+             " left join MovieLikes ml on ml.id.movieId = m.movieId" +
+             " group by m.movieId" +
+             " order by count(ml.id.userId) desc")
+     @Transactional
+     List<MovieLikesQM> findAllWithLikes();
+
+     @Query(value = "select new com.wediscussmovies.project.querymodels.MovieLikesQM(m.movieId, count(ml.id.userId)) from Movie m" +
+             " left join MovieLikes ml on ml.id.movieId = m.movieId" +
+             " group by m.movieId" +
+             " having m.movieId = :id")
+     @Transactional
+     List<MovieLikesQM> findLikesForMovie(@Param("id") Integer movie_id);
+
+
+}
Index: Sources/src/main/java/com/wediscussmovies/project/repository/PersonRatesRepository.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/repository/PersonRatesRepository.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/repository/PersonRatesRepository.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -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: Sources/src/main/java/com/wediscussmovies/project/repository/PersonRepository.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/repository/PersonRepository.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/repository/PersonRepository.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,16 @@
+package com.wediscussmovies.project.repository;
+
+import com.wediscussmovies.project.model.Person;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface PersonRepository extends JpaRepository<Person, Integer> {
+     List<Person> findAllByType(Character type);
+     List<Person> findAllByTypeAndNameLike(Character type, String name);
+     List<Person> findAllByTypeAndSurnameLike(Character type, String surname);
+    // Optional<Person> findPersonByPersonIdAndType(Integer id, Character type);
+     List<Person> findAllByTypeAndNameLikeOrSurnameLike(Character type,String name, String surname);
+}
Index: Sources/src/main/java/com/wediscussmovies/project/repository/ReplyRepository.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/repository/ReplyRepository.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/repository/ReplyRepository.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,26 @@
+package com.wediscussmovies.project.repository;
+
+import com.wediscussmovies.project.model.Discussion;
+import com.wediscussmovies.project.model.Reply;
+import com.wediscussmovies.project.model.primarykeys.ReplyPK;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
+import org.springframework.stereotype.Repository;
+
+import javax.transaction.Transactional;
+import java.sql.Date;
+import java.util.List;
+
+
+@Repository
+public interface ReplyRepository extends JpaRepository<Reply, ReplyPK> {
+    List<Reply> findAllByDiscussion(Discussion discussion);
+
+    @Modifying
+    @Query(value = "insert into project.replies (text,date,user_id,discussion_id) values(:text,:date,:user_id,:discussion_id)",nativeQuery = true)
+    @Transactional
+    void insertInto(@Param("text") String text, @Param("date")Date date,
+                    @Param("user_id")Integer userId,@Param("discussion_id")Integer discussionId);
+}
Index: Sources/src/main/java/com/wediscussmovies/project/repository/UserRepository.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/repository/UserRepository.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/repository/UserRepository.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,12 @@
+package com.wediscussmovies.project.repository;
+
+import com.wediscussmovies.project.model.User;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+import java.util.Optional;
+
+@Repository
+public interface UserRepository extends JpaRepository<User, Integer> {
+     Optional<User> findByUsername(String username);
+}
Index: Sources/src/main/java/com/wediscussmovies/project/service/DiscussionService.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/service/DiscussionService.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/service/DiscussionService.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,26 @@
+package com.wediscussmovies.project.service;
+
+import com.wediscussmovies.project.model.Discussion;
+import com.wediscussmovies.project.model.User;
+import com.wediscussmovies.project.querymodels.DiscussionLikesQM;
+
+import java.util.List;
+
+public interface DiscussionService {
+    List<Discussion> listAll();
+    List<Discussion> listAllByTitle(String title);
+    Discussion findById(Integer id);
+    void save(Character type,Integer id, String title, String text, User user);
+    void edit(Integer discussionId,Character type,Integer id, String title, String text);
+    void deleteById(Integer discussionId);
+    void likeDiscussion(Integer discussionId,Integer userId);
+    void unlikeDiscussion(Integer discussionId,Integer userId);
+    List<Discussion> findAllForPersonOrMovie(Integer id,Character type);
+
+    List<Discussion> findLikedDiscussionsByUser(User user);
+
+    DiscussionLikesQM findLikesForDiscussionWithId(Integer discussionId);
+
+    List<DiscussionLikesQM> findLikesForAllDiscussions();
+
+}
Index: Sources/src/main/java/com/wediscussmovies/project/service/GenreService.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/service/GenreService.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/service/GenreService.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,19 @@
+package com.wediscussmovies.project.service;
+
+import com.wediscussmovies.project.model.Genre;
+import com.wediscussmovies.project.querymodels.GenreLikesQM;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public interface GenreService {
+    List<Genre> findAll();
+    Genre findById(Integer id);
+    List<Genre> findAllByType(String genre);
+    Genre save(String genreName);
+    List<GenreLikesQM> findAllWithLikes();
+    void likeGenre(Integer genreId,Integer userId);
+    void unlikeGenre(Integer genreId,Integer userId);
+
+}
Index: Sources/src/main/java/com/wediscussmovies/project/service/MovieService.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/service/MovieService.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/service/MovieService.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,41 @@
+package com.wediscussmovies.project.service;
+
+import com.wediscussmovies.project.ajaxmodels.Grade;
+import com.wediscussmovies.project.model.Genre;
+import com.wediscussmovies.project.model.Movie;
+import com.wediscussmovies.project.model.Person;
+import com.wediscussmovies.project.model.User;
+import com.wediscussmovies.project.querymodels.MovieLikesQM;
+import org.springframework.data.jpa.repository.Query;
+
+import java.sql.Date;
+import java.util.List;
+
+public interface MovieService {
+     List<Movie> listAll();
+     List<Movie> listAllByType(Character type);
+     List<Movie> listAllWithoutDirector();
+     List<Movie> searchByTitle(String title);
+     Movie findById(Integer id);
+     Movie findBasicById(Integer id);
+     List<Integer> listAllIds();
+     Movie save(String title, String description, String imageUrl, Date airingDate,Double  rating,
+                Integer directorId,List<Integer> actorIds,List<Integer> genreIds);
+
+     Movie edit(Integer movieId,String title, String description, String imageUrl, Date airingDate,Double  rating,
+                Integer directorId,List<Integer> actorIds, List<Integer> genreIds);
+
+     List<Person> findAllActorsForMovie(Movie movie);
+     List<Genre> findAllGenresForMovie(Movie movie);
+
+     void likeMovie(Integer movieId, Integer userId);
+     void unlikeMovie(Integer movieId,Integer userId);
+
+     List<Movie> findLikedMoviesByUser(User user);
+
+     void deleteById(Integer id);
+
+     void addGradeMovie(Integer movieId, User user, Grade grade);
+
+    MovieLikesQM findLikesForMovieById(int movieId);
+}
Index: Sources/src/main/java/com/wediscussmovies/project/service/PersonService.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/service/PersonService.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/service/PersonService.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,31 @@
+package com.wediscussmovies.project.service;
+
+import com.wediscussmovies.project.ajaxmodels.Grade;
+import com.wediscussmovies.project.model.Movie;
+import com.wediscussmovies.project.model.Person;
+import com.wediscussmovies.project.model.User;
+import com.wediscussmovies.project.model.relation.MovieLikes;
+
+import java.sql.Date;
+import java.util.List;
+import java.util.stream.Collectors;
+
+public interface PersonService {
+    List<Person> findAll();
+     List<Person> findAllDirectors();
+     List<Person> findAllActors();
+    Person findById(Integer person_id);
+
+    Person  save(String name, String surname, Character type,
+                 Date birthDate, String image_url, String description, List<Integer> movieIds);
+
+    Person edit(Integer personId, String name, String surname, Character type,
+                Date birthDate, String image_url, String description, List<Integer> movieIds);
+
+    List<Person> findPersonsByNameOrSurname(Character type,String searchQuery);
+
+    List<Movie> findAllMoviesByPerson(Person person);
+
+    void deleteById(Integer id);
+    void addGradePerson(Integer personId, User user, Grade grade);
+}
Index: Sources/src/main/java/com/wediscussmovies/project/service/ReplyService.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/service/ReplyService.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/service/ReplyService.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,21 @@
+package com.wediscussmovies.project.service;
+
+import com.wediscussmovies.project.model.Discussion;
+import com.wediscussmovies.project.model.Reply;
+import com.wediscussmovies.project.model.User;
+import com.wediscussmovies.project.model.primarykeys.ReplyPK;
+
+import java.util.List;
+
+public interface ReplyService {
+    Reply edit(Integer replyId, Integer discussionId, String text);
+    void delete(Integer discussionId,Integer replyId);
+    Reply findById(Integer discussionId, Integer replyId);
+    void save(Integer discussionId, String text, User user);
+    void likeReply(Integer replyId,Integer userId);
+    void unlikeReply(Integer replyId,Integer userId);
+    List<Reply> findAllByDiscussion(Discussion discussion);
+
+
+
+}
Index: Sources/src/main/java/com/wediscussmovies/project/service/UserService.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/service/UserService.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/service/UserService.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,14 @@
+package com.wediscussmovies.project.service;
+
+import com.wediscussmovies.project.model.User;
+import org.springframework.security.core.userdetails.UserDetailsService;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Optional;
+
+public interface UserService extends UserDetailsService {
+     User findByUsername(String username);
+     User register(String email, String username, String password, String confirmPassword, String name, String surname);
+
+    User findById(Integer id);
+}
Index: Sources/src/main/java/com/wediscussmovies/project/service/impl/DiscussionServiceImpl.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/service/impl/DiscussionServiceImpl.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/service/impl/DiscussionServiceImpl.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,179 @@
+package com.wediscussmovies.project.service.impl;
+
+import com.wediscussmovies.project.model.exception.DiscussionNotExistException;
+import com.wediscussmovies.project.model.exception.MovieIdNotFoundException;
+import com.wediscussmovies.project.model.exception.PersonNotExistException;
+import com.wediscussmovies.project.model.exception.UserNotExistException;
+import com.wediscussmovies.project.model.primarykeys.DiscussionLikesPK;
+import com.wediscussmovies.project.model.relation.DiscussionLikes;
+import com.wediscussmovies.project.querymodels.DiscussionLikesQM;
+import com.wediscussmovies.project.repository.*;
+import com.wediscussmovies.project.model.Discussion;
+import com.wediscussmovies.project.model.Movie;
+import com.wediscussmovies.project.model.Person;
+import com.wediscussmovies.project.model.User;
+import com.wediscussmovies.project.service.DiscussionService;
+import org.springframework.stereotype.Service;
+
+import java.time.LocalDate;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+
+@Service
+public class DiscussionServiceImpl implements DiscussionService {
+
+    private final DiscussionRepository discussionRepository;
+    private final DiscussionLikesRepository discussionLikesRepository;
+    private final UserRepository userRepository;
+
+    private final MovieRepository movieRepository;
+    private final PersonRepository personRepository;
+
+    public DiscussionServiceImpl(DiscussionRepository discussionRepository, DiscussionLikesRepository discussionLikesRepository, UserRepository userRepository,
+                                 MovieRepository movieRepository, PersonRepository personRepository) {
+        this.discussionRepository = discussionRepository;
+        this.discussionLikesRepository = discussionLikesRepository;
+        this.userRepository = userRepository;
+        this.movieRepository = movieRepository;
+        this.personRepository = personRepository;
+    }
+
+
+
+
+    @Override
+    public List<Discussion> listAll() {
+        List<Discussion> discussions = this.discussionRepository.findAll();
+        List<DiscussionLikesQM> discussionLikes  = this.discussionRepository.findAllDiscussionsWithLikes();
+        for (int i = 0; i < discussionLikes.size(); i++){
+            discussions.get(i).setLikes(discussionLikes.get(i).getLikes());
+        }
+        return discussions;
+    }
+
+    @Override
+    public void save(Character type,Integer id,String title, String text,User user) {
+        LocalDate date = LocalDate.now();
+        Discussion discussion;
+
+        if (type.equals('M')) {
+            discussion = new Discussion('M',text,title,date,user);
+            this.addMovieForDiscussion(id,discussion);
+        }
+        else{
+            discussion = new Discussion('P',text,title,date,user);
+            this.addPersonForDiscussion(id,discussion);
+        }
+
+
+
+        discussionRepository.save(discussion);
+    }
+
+    @Override
+    public void edit(Integer discussionId, Character type, Integer id, String title, String text) {
+        Discussion discussion = this.findById(discussionId);
+
+        discussion.setText(text);
+        discussion.setTitle(title);
+        discussion.setType(type);
+        discussion.setMovie(null);
+        discussion.setPerson(null);
+
+        if (type.equals('M')) {
+            this.addMovieForDiscussion(id,discussion);
+        }
+        else{
+          this.addPersonForDiscussion(id,discussion);
+        }
+        this.discussionRepository.save(discussion);
+
+    }
+
+    @Override
+    public void deleteById(Integer discussionId) {
+        this.discussionRepository.deleteById(discussionId);
+    }
+
+    @Override
+    public void likeDiscussion(Integer discussionId, Integer userId) {
+        Discussion discussion = discussionRepository.findById(discussionId).orElseThrow(() -> new DiscussionNotExistException(discussionId));
+        User user = userRepository.findById(userId).orElseThrow(() -> new UserNotExistException(userId.toString()));
+        this.discussionLikesRepository.save(new DiscussionLikes(discussion, user));
+    }
+
+    @Override
+    public List<Discussion> findLikedDiscussionsByUser(User user) {
+        List<DiscussionLikes> likes = discussionLikesRepository.findAllByUser(user);
+        List<Discussion> discussions = new ArrayList<>();
+        for(DiscussionLikes dl: likes){
+            discussions.add(dl.getDiscussion());
+        }
+        return discussions;
+    }
+
+    @Override
+    public void unlikeDiscussion(Integer discussionId, Integer userId) {
+        DiscussionLikesPK pk = new DiscussionLikesPK(discussionId, userId);
+        this.discussionLikesRepository.deleteById(pk);
+    }
+
+    @Override
+    public DiscussionLikesQM findLikesForDiscussionWithId(Integer discussionId) {
+//        return discussionRepository.findAllWithLikes().stream().filter(d ->  d.getDiscussionId().equals(discussionId)).findFirst().get();
+                return this.discussionRepository.findDiscussionWithLikes(discussionId);
+
+    }
+
+    @Override
+    public List<DiscussionLikesQM> findLikesForAllDiscussions() {
+           // return this.discussionRepository.findAllDiscussionsWithLikes();
+        return this.discussionRepository.findAllDiscussionsWithLikes();
+    }
+
+
+    @Override
+    public List<Discussion> findAllForPersonOrMovie(Integer id,Character type) {
+        if (type.equals('M'))
+        {
+            Movie movie = this.findMovieById(id);
+            return this.discussionRepository.findAllByMovie(movie);
+        }
+        Person person  = this.findPersonById(id);
+        return this.discussionRepository.findAllByPerson(person);
+
+    }
+
+    @Override
+    public Discussion findById(Integer id) {
+        Discussion disc =  discussionRepository.findById(id).orElseThrow(() -> new DiscussionNotExistException(id));
+        disc.setLikes(this.discussionRepository.findDiscussionWithLikes(id).getLikes());
+        return disc;
+    }
+
+    @Override
+    public List<Discussion> listAllByTitle(String title) {
+        if(title == null || title.isEmpty())
+         return this.listAll();
+        return discussionRepository.findAllByTitleLike("%"+title+"%");
+    }
+    private void addMovieForDiscussion(Integer id,Discussion discussion){
+        Movie movie = findMovieById(id);
+        discussion.setMovie(movie);
+
+    }
+
+    private void addPersonForDiscussion(Integer id, Discussion discussion){
+        Person person = findPersonById(id);
+        discussion.setPerson(person);
+
+    }
+    private Movie findMovieById(Integer id){
+        return this.movieRepository.findById(id).orElseThrow(() -> new MovieIdNotFoundException(id));
+    }
+    private Person findPersonById(Integer id){
+        return this.personRepository.findById(id).orElseThrow(() -> new PersonNotExistException(id));
+
+    }
+}
Index: Sources/src/main/java/com/wediscussmovies/project/service/impl/GenreServiceImpl.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/service/impl/GenreServiceImpl.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/service/impl/GenreServiceImpl.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,71 @@
+package com.wediscussmovies.project.service.impl;
+
+import com.wediscussmovies.project.model.User;
+import com.wediscussmovies.project.model.exception.GenreNotExistException;
+import com.wediscussmovies.project.model.exception.UserNotExistException;
+import com.wediscussmovies.project.model.primarykeys.UserGenresPK;
+import com.wediscussmovies.project.model.relation.UserGenres;
+import com.wediscussmovies.project.querymodels.GenreLikesQM;
+import com.wediscussmovies.project.repository.GenreLikesRepository;
+import com.wediscussmovies.project.repository.GenreRepository;
+import com.wediscussmovies.project.model.Genre;
+import com.wediscussmovies.project.repository.UserRepository;
+import com.wediscussmovies.project.service.GenreService;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class GenreServiceImpl implements GenreService {
+    private final GenreRepository genreRepository;
+    private final UserRepository userRepository;
+    private final GenreLikesRepository genreLikesRepository;
+
+
+    public GenreServiceImpl(GenreRepository genreRepository, UserRepository userRepository, GenreLikesRepository genreLikesRepository) {
+        this.genreRepository = genreRepository;
+        this.userRepository = userRepository;
+        this.genreLikesRepository = genreLikesRepository;
+    }
+
+    @Override
+    public Genre findById(Integer id) {
+        return this.genreRepository.findById(id).orElseThrow(() -> new GenreNotExistException(id));
+    }
+
+    @Override
+    public List<Genre> findAllByType(String genre) {
+        return this.genreRepository.findAllByGenreType(genre);
+    }
+
+    @Override
+    public Genre save(String genreName) {
+       Genre genre = new Genre(genreName);
+        return this.genreRepository.save(genre);
+    }
+
+    @Override
+    public List<GenreLikesQM> findAllWithLikes() {
+        // List<GenreLikes> genreLikesList = this.genreRepository.findAllWithLikes();
+       // genreLikesList.sort(GenreLikes.sorter);
+        return this.genreRepository.findAllWithLikes();
+    }
+
+    @Override
+    public List<Genre> findAll() {
+        return this.genreRepository.findAllSorted();
+    }
+
+    @Override
+    public void likeGenre(Integer genreId, Integer userId) {
+        User user = this.userRepository.findById(userId).orElseThrow(() -> new UserNotExistException(userId.toString()));
+        Genre genre = this.genreRepository.findById(genreId).orElseThrow(() -> new GenreNotExistException(genreId));
+        this.genreLikesRepository.save(new UserGenres(genre, user));
+    }
+
+    @Override
+    public void unlikeGenre(Integer genreId, Integer userId) {
+        UserGenresPK movieLikesPK = new UserGenresPK(userId, genreId);
+        this.genreLikesRepository.deleteById(movieLikesPK);
+    }
+}
Index: Sources/src/main/java/com/wediscussmovies/project/service/impl/MovieServiceImpl.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/service/impl/MovieServiceImpl.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/service/impl/MovieServiceImpl.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,229 @@
+package com.wediscussmovies.project.service.impl;
+
+
+import com.wediscussmovies.project.ajaxmodels.Grade;
+import com.wediscussmovies.project.model.*;
+import com.wediscussmovies.project.model.exception.GenreNotExistException;
+import com.wediscussmovies.project.model.exception.PersonNotExistException;
+import com.wediscussmovies.project.model.exception.UserNotExistException;
+import com.wediscussmovies.project.model.primarykeys.MovieLikesPK;
+import com.wediscussmovies.project.model.primarykeys.MovieRatesPK;
+import com.wediscussmovies.project.model.relation.MovieActors;
+import com.wediscussmovies.project.model.relation.MovieGenres;
+import com.wediscussmovies.project.model.relation.MovieLikes;
+import com.wediscussmovies.project.model.relation.MovieRates;
+import com.wediscussmovies.project.querymodels.MovieLikesQM;
+import com.wediscussmovies.project.repository.*;
+import com.wediscussmovies.project.model.exception.MovieIdNotFoundException;
+import com.wediscussmovies.project.service.MovieService;
+import org.springframework.stereotype.Service;
+
+import javax.swing.text.html.Option;
+import javax.transaction.Transactional;
+import java.sql.Date;
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+@Service
+public class MovieServiceImpl implements MovieService {
+
+    private final MovieRepository movieRepository;
+    private final PersonRepository personRepository;
+    private final GenreRepository genreRepository;
+    private final MovieActorsRepository movieActorsRepository;
+    private final MovieGenresRepository movieGenresRepository;
+    private final UserRepository userRepository;
+    private final MovieLikesRepository movieLikesRepository;
+    private final MovieRatesRepository movieRatesRepository;
+
+    public MovieServiceImpl(MovieRepository movieRepository, PersonRepository personRepository,
+                            GenreRepository genreRepository, MovieActorsRepository movieActorsRepository,
+                            MovieGenresRepository movieGenresRepository,
+                            UserRepository userRepository, MovieLikesRepository movieLikesRepository,
+                            MovieRatesRepository movieRatesRepository) {
+
+        this.movieRepository = movieRepository;
+        this.personRepository = personRepository;
+        this.genreRepository = genreRepository;
+        this.movieActorsRepository = movieActorsRepository;
+        this.movieGenresRepository = movieGenresRepository;
+        this.userRepository = userRepository;
+        this.movieLikesRepository = movieLikesRepository;
+        this.movieRatesRepository = movieRatesRepository;
+    }
+
+    @Override
+    public List<Movie> listAll() {
+        return this.movieRepository.findAll();
+    }
+
+    @Override
+    public List<Movie> listAllByType(Character type) {
+        if (type.equals('A'))
+            return this.listAll();
+        return this.listAllWithoutDirector();
+    }
+
+    @Override
+    public List<Movie> listAllWithoutDirector() {
+        return this.movieRepository.findAllByDirectorIsNull();
+    }
+
+    @Override
+    public Movie findById(Integer id) {
+        return this.movieRepository.findById(id).orElseThrow(() -> new MovieIdNotFoundException(id));
+    }
+
+    @Override
+    public Movie findBasicById(Integer id) {
+        return this.movieRepository.findBasicById(id).orElseThrow(() -> new MovieIdNotFoundException(id));
+    }
+
+    @Override
+    public MovieLikesQM findLikesForMovieById(int movieId) {
+        return this.movieRepository.findLikesForMovie(movieId).get(0);
+    }
+
+    @Override
+    public List<Integer> listAllIds() {
+        return this.movieRepository.findAllMovieIds();
+    }
+
+    @Override
+    @Transactional
+    public Movie save(String title, String description, String imageUrl,
+                      Date airingDate, Double rating, Integer directorId,List<Integer> actorIds,List<Integer> genreIds) {
+
+
+        Person director =getDirector(directorId);
+        Movie movie = new Movie(title,description,imageUrl,airingDate,rating,director);
+       movie = this.movieRepository.saveAndFlush(movie);
+       addActorsAndGenresForMovie(movie,actorIds,genreIds);
+       return movie;
+    }
+
+
+    @Transactional
+    @Override
+    public Movie edit(Integer movieId, String title, String description,
+                      String imageUrl, Date airingDate, Double rating,
+                      Integer directorId, List<Integer> actorIds,List<Integer> genreIds) {
+
+
+        Person director =getDirector(directorId);
+        Movie movie = this.findById(movieId);
+
+        movie.setTitle(title);
+        movie.setDescription(description);
+        movie.setImageUrl(imageUrl);
+        movie.setAiringDate(airingDate);
+        movie.setImdbRating(rating);
+        movie.setDirector(director);
+
+        this.movieActorsRepository.deleteAllByMovie(movie);
+        this.movieGenresRepository.deleteAllByMovie(movie);
+
+        movie = this.movieRepository.save(movie);
+        this.addActorsAndGenresForMovie(movie,actorIds,genreIds);
+
+        return movie;
+    }
+
+    @Override
+    public List<Person> findAllActorsForMovie(Movie movie) {
+        return this.movieActorsRepository.findAllByMovie(movie)
+                .stream()
+                .map(MovieActors::getPerson)
+                .collect(Collectors.toList());
+    }
+
+    @Override
+    public List<Genre> findAllGenresForMovie(Movie movie) {
+        return this.movieGenresRepository.findAllByMovie(movie)
+                .stream()
+                .map(MovieGenres::getGenre)
+                .collect(Collectors.toList());
+    }
+
+    @Override
+    public void likeMovie(Integer movieId, Integer userId) {
+        User user = this.userRepository.findById(userId).orElseThrow(() -> new UserNotExistException(userId.toString()));
+        Movie movie = this.findById(movieId);
+
+        this.movieLikesRepository.save(new MovieLikes(movie, user));
+    }
+
+    @Override
+    public void unlikeMovie(Integer movieId, Integer userId) {
+        MovieLikesPK movieLikesPK = new MovieLikesPK(movieId,userId);
+        this.movieLikesRepository.deleteById(movieLikesPK);
+    }
+
+    @Override
+    public List<Movie> findLikedMoviesByUser(User user) {
+        return
+                this.movieLikesRepository
+                        .findAllByUser(user)
+                        .stream()
+                        .map(MovieLikes::getMovie)
+                        .collect(Collectors.toList());
+    }
+
+
+    @Override
+    public void deleteById(Integer id) {
+        this.movieRepository.deleteById(id);
+    }
+
+    @Override
+    public void addGradeMovie(Integer movieId, User user, Grade grade) {
+        MovieRatesPK key =  new MovieRatesPK(movieId, user.getUserId());
+        Optional<MovieRates> movieRates = this.movieRatesRepository.findById(key);
+        if (movieRates.isPresent()){
+           MovieRates rates = movieRates.get();
+            rates.setReason(grade.getReason());
+            rates.setStarsRated(grade.getRating());
+            this.movieRatesRepository.save(rates);
+        }
+        else{
+            Movie movie = this.findById(movieId);
+            MovieRates rates = new MovieRates(user,movie,grade.getReason(),grade.getRating());
+            this.movieRatesRepository.save(rates);
+        }
+    }
+
+    @Override
+    public List<Movie> searchByTitle(String title) {
+        return this.movieRepository.findAllByTitleLike("%"+title+"%");
+    }
+
+    @Transactional
+    void addActorsAndGenresForMovie(Movie movie, List<Integer> actorIds, List<Integer> genreIds)
+    {
+
+        actorIds.stream()
+                .map(this::findPersonById)
+                .forEach(actor -> this.movieActorsRepository.save(new MovieActors(movie,actor)));
+
+        genreIds.stream()
+                .map(this::findGenreById)
+                .forEach(genre -> this.movieGenresRepository.save(new MovieGenres(movie,genre)));
+
+    }
+    private Person getDirector(Integer directorId){
+
+        if (directorId != null)
+            return this.findPersonById(directorId);
+        return null;
+
+    }
+    private Person findPersonById(Integer id){
+        return this.personRepository.findById(id).orElseThrow(() -> new PersonNotExistException(id));
+    }
+    private Genre findGenreById(Integer id){
+        return this.genreRepository.findById(id).orElseThrow(() -> new GenreNotExistException(id));
+    }
+}
+
+
Index: Sources/src/main/java/com/wediscussmovies/project/service/impl/PersonServiceImpl.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/service/impl/PersonServiceImpl.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/service/impl/PersonServiceImpl.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,183 @@
+package com.wediscussmovies.project.service.impl;
+
+import com.wediscussmovies.project.ajaxmodels.Grade;
+import com.wediscussmovies.project.model.Movie;
+import com.wediscussmovies.project.model.User;
+import com.wediscussmovies.project.model.exception.MovieHasAlreadyDirector;
+import com.wediscussmovies.project.model.exception.MovieIdNotFoundException;
+import com.wediscussmovies.project.model.exception.PersonNotExistException;
+import com.wediscussmovies.project.model.primarykeys.PersonRatesPK;
+import com.wediscussmovies.project.model.relation.MovieActors;
+import com.wediscussmovies.project.model.relation.MovieLikes;
+import com.wediscussmovies.project.model.relation.PersonRates;
+import com.wediscussmovies.project.repository.*;
+import com.wediscussmovies.project.model.Person;
+import com.wediscussmovies.project.service.PersonService;
+import org.springframework.stereotype.Service;
+
+import javax.transaction.Transactional;
+import java.sql.Date;
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+@Service
+public class PersonServiceImpl implements PersonService {
+
+    private final PersonRepository personRepository;
+    private final MovieRepository movieRepository;
+    private final MovieActorsRepository movieActorsRepository;
+    private final PersonRatesRepository personRatesRepository;
+    public PersonServiceImpl(PersonRepository personRepository,
+                             MovieRepository movieRepository, MovieActorsRepository movieActorsRepository,
+                             PersonRatesRepository personRatesRepository) {
+        this.personRepository = personRepository;
+        this.movieRepository = movieRepository;
+        this.movieActorsRepository = movieActorsRepository;
+        this.personRatesRepository = personRatesRepository;
+    }
+
+    @Override
+    public List<Person> findAll() {
+        return this.personRepository.findAll();
+    }
+
+    @Override
+    public List<Person> findAllDirectors() {
+        return this.personRepository.findAllByType('D');
+    }
+
+    @Override
+    public Person findById(Integer id) {
+        return this.personRepository.findById(id).orElseThrow(() -> new PersonNotExistException(id));
+    }
+
+
+
+    @Override
+    public List<Person> findAllActors() {
+        return this.personRepository.findAllByType('A');
+    }
+
+    @Override
+    @Transactional
+    public Person save(String name, String surname, Character type, Date birthDate, String image_url,
+                       String description,List<Integer> movieIds) {
+
+        Person person = this.personRepository.saveAndFlush(new Person(name,surname,type,birthDate,image_url,description));
+
+        if (movieIds!= null) {
+            if (type.equals('A'))
+                this.addActorForMovies(person, movieIds);
+            else
+                this.addDirectorForMovies(person, movieIds);
+        }
+         return person;
+
+    }
+
+    @Override
+    @Transactional
+    public Person edit(Integer personId, String name, String surname,
+                       Character type, Date birthDate, String image_url, String description, List<Integer> movieIds) {
+        Person person = this.findById(personId);
+
+        person.setName(name);
+        person.setSurname(surname);
+        person.setDateOfBirth(birthDate);
+        person.setImageUrl(image_url);
+        person.setType(type);
+        person.setDescription(description);
+
+
+        person = this.personRepository.saveAndFlush(person);
+
+            this.movieActorsRepository.deleteAllByPerson(person);
+            this.removeMovieDirectorsBeforeEdit(person);
+        if (movieIds != null) {
+            if (type.equals('A'))
+                this.addActorForMovies(person, movieIds);
+            else
+                this.addDirectorForMovies(person, movieIds);
+        }
+
+        return person;
+
+    }
+
+    @Override
+    public List<Person> findPersonsByNameOrSurname(Character type,String searchQuery) {
+        if (searchQuery != null && searchQuery.isEmpty())
+            return this.personRepository.findAllByTypeAndNameLikeOrSurnameLike(type,searchQuery,searchQuery);
+        if (type.equals('D'))
+            return this.findAllDirectors();
+        return this.findAllActors();
+
+    }
+
+    @Override
+    public List<Movie> findAllMoviesByPerson(Person person) {
+        if (person.getType().equals('A'))
+            return this.movieActorsRepository
+                .findAllByPerson(person)
+                .stream()
+                .map(MovieActors::getMovie)
+                .collect(Collectors.toList());
+        return this.movieRepository.findAllByDirector(person);
+    }
+
+    @Override
+    public void deleteById(Integer id) {
+        this.personRepository.deleteById(id);
+    }
+
+    @Override
+    public void addGradePerson(Integer personId, User user, Grade grade) {
+        PersonRatesPK key =  new PersonRatesPK(personId, user.getUserId());
+        Optional<PersonRates> personRates = this.personRatesRepository.findById(key);
+        if (personRates.isPresent()){
+            PersonRates rates = personRates.get();
+            rates.setReason(grade.getReason());
+            rates.setStarsRated(grade.getRating());
+            this.personRatesRepository.save(rates);
+        }
+        else{
+            Person person = this.findById(personId);
+            PersonRates rates = new PersonRates(user,person,grade.getReason(),grade.getRating());
+            this.personRatesRepository.save(rates);
+        }
+
+    }
+
+
+
+    private void addActorForMovies(Person person, List<Integer> movieIds){
+
+        movieIds.stream()
+                .map(this::findMovieById)
+                .forEach(m -> this.movieActorsRepository.save(new MovieActors(m,person)));
+
+    }
+    private void addDirectorForMovies(Person person, List<Integer> movieIds){
+        movieIds.stream()
+                .map(this::findMovieById)
+                .forEach(m -> this.addMovieDirector(m,person));
+    }
+    private void addMovieDirector(Movie movie,Person person){
+        Person director = movie.getDirector();
+        if (director != null)
+            throw new MovieHasAlreadyDirector(movie.getTitle(),director.getName(),director.getSurname());
+        movie.setDirector(person);
+        this.movieRepository.save(movie);
+    }
+    private void removeMovieDirectorsBeforeEdit(Person person){
+        this.movieRepository.findAllByDirector(person)
+                .forEach(m ->{ m.setDirector(null); this.movieRepository.save(m); });
+
+    }
+
+    private Movie findMovieById(Integer id){
+        return this.movieRepository.findById(id).orElseThrow(() -> new MovieIdNotFoundException(id));
+    }
+
+}
Index: Sources/src/main/java/com/wediscussmovies/project/service/impl/ReplyServiceImpl.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/service/impl/ReplyServiceImpl.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/service/impl/ReplyServiceImpl.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,78 @@
+package com.wediscussmovies.project.service.impl;
+
+import com.wediscussmovies.project.model.Discussion;
+import com.wediscussmovies.project.model.exception.DiscussionNotExistException;
+import com.wediscussmovies.project.model.exception.ReplyNotExistException;
+import com.wediscussmovies.project.model.primarykeys.ReplyPK;
+import com.wediscussmovies.project.repository.DiscussionRepository;
+import com.wediscussmovies.project.repository.ReplyRepository;
+import com.wediscussmovies.project.model.Reply;
+import com.wediscussmovies.project.model.User;
+import com.wediscussmovies.project.repository.UserRepository;
+import com.wediscussmovies.project.service.ReplyService;
+import org.springframework.stereotype.Service;
+
+import java.sql.Date;
+import java.time.LocalDate;
+import java.util.List;
+
+@Service
+public class ReplyServiceImpl implements ReplyService {
+
+    private final ReplyRepository replyRepository;
+    private final DiscussionRepository discussionRepository;
+
+    public ReplyServiceImpl(ReplyRepository replyRepository,
+                            DiscussionRepository discussionRepository) {
+        this.replyRepository = replyRepository;
+        this.discussionRepository = discussionRepository;
+    }
+
+
+
+    @Override
+    public void save(Integer discussionId, String text,User user) {
+
+        Discussion discussion = this.discussionRepository.findById(discussionId).orElseThrow(() -> new DiscussionNotExistException(discussionId));
+
+        Date date = Date.valueOf(LocalDate.now());
+        this.replyRepository.insertInto(text,date,user.getUserId(),discussionId);
+
+    }
+
+    @Override
+    public void likeReply(Integer replyId, Integer userId) {
+        //da se implementira, promena vo baza
+    }
+
+    @Override
+    public void unlikeReply(Integer replyId, Integer userId) {
+        // da se implementira, promena vo baza
+    }
+
+    @Override
+    public List<Reply> findAllByDiscussion(Discussion discussion) {
+        return this.replyRepository.findAllByDiscussion(discussion);
+    }
+
+
+    @Override
+    public Reply edit(Integer replyId,Integer discussionId,String text) {
+        ReplyPK replyPK = new ReplyPK(discussionId,replyId);
+        Reply reply = this.replyRepository.findById(replyPK).orElseThrow();
+        reply.setText(text);
+        return  this.replyRepository.save(reply);
+    }
+
+    @Override
+    public void delete(Integer discussionId, Integer replyId) {
+        this.replyRepository.deleteById(new ReplyPK(discussionId,replyId));
+    }
+
+    @Override
+    public Reply findById(Integer discussionId, Integer replyId) {
+        ReplyPK replyPK  = new ReplyPK(discussionId,replyId);
+        return this.replyRepository.findById(replyPK).orElseThrow(() -> new ReplyNotExistException(replyPK));
+
+    }
+}
Index: Sources/src/main/java/com/wediscussmovies/project/service/impl/UserServiceImpl.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/service/impl/UserServiceImpl.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/service/impl/UserServiceImpl.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,58 @@
+package com.wediscussmovies.project.service.impl;
+
+import com.wediscussmovies.project.model.exception.InvalidArgumentsException;
+import com.wediscussmovies.project.model.exception.PasswordsDoNotMatchException;
+import com.wediscussmovies.project.model.exception.UserNotExistException;
+import com.wediscussmovies.project.model.User;
+import com.wediscussmovies.project.model.exception.UsernameAlreadyExistsException;
+import com.wediscussmovies.project.repository.UserRepository;
+import com.wediscussmovies.project.service.UserService;
+import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.security.core.userdetails.UsernameNotFoundException;
+import org.springframework.security.crypto.password.PasswordEncoder;
+import org.springframework.stereotype.Service;
+
+@Service
+public class UserServiceImpl implements UserService {
+
+    private final UserRepository userRepository;
+    private final PasswordEncoder passwordEncoder;
+
+
+    public UserServiceImpl(UserRepository userRepository, PasswordEncoder passwordEncoder) {
+        this.userRepository = userRepository;
+        this.passwordEncoder = passwordEncoder;
+    }
+
+    @Override
+    public User findByUsername(String username) {
+        return this.userRepository.findByUsername(username).orElseThrow(() -> new UserNotExistException(username));
+    }
+
+
+
+    @Override
+    public User register( String email, String username, String password, String confirmPassword
+                                  , String name, String surname) {
+
+        if ( username.isEmpty() || password.isEmpty())
+            throw new InvalidArgumentsException();
+        if (!password.equals(confirmPassword))
+            throw new PasswordsDoNotMatchException();
+        if(this.userRepository.findByUsername(username).isPresent())
+            throw new UsernameAlreadyExistsException(username);
+        User user = new User(email,username,passwordEncoder.encode(password),name,surname);
+        return userRepository.save(user);
+
+    }
+
+    @Override
+    public User findById(Integer id) {
+        return userRepository.findById(id).orElseThrow(() -> new UserNotExistException(id.toString()));
+    }
+
+    @Override
+    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
+        return this.findByUsername(username);
+    }
+}
Index: Sources/src/main/java/com/wediscussmovies/project/web/DesignFrontMovies.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/web/DesignFrontMovies.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/web/DesignFrontMovies.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,17 @@
+package com.wediscussmovies.project.web;
+
+import com.wediscussmovies.project.model.Movie;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class DesignFrontMovies {
+    public static  void designMovieList(List<Movie> movieList, List<List<Movie>> movie_rows){
+        for(int i=0; i<movieList.size(); i+=4){
+            int j = i+4;
+            if(j>movieList.size())
+                j= movieList.size();
+            movie_rows.add(movieList.subList(i, j));
+        }
+    }
+}
Index: Sources/src/main/java/com/wediscussmovies/project/web/HomeController.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/web/HomeController.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/web/HomeController.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,7 @@
+package com.wediscussmovies.project.web;
+
+import org.springframework.stereotype.Controller;
+
+@Controller
+public class HomeController {
+}
Index: Sources/src/main/java/com/wediscussmovies/project/web/PageFrontMovies.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/web/PageFrontMovies.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/web/PageFrontMovies.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,42 @@
+package com.wediscussmovies.project.web;
+
+import com.wediscussmovies.project.model.Movie;
+import com.wediscussmovies.project.service.MovieService;
+import org.springframework.ui.Model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PageFrontMovies {
+    public static List<Movie> getPagedMovies(String page, MovieService movieService, Model model){
+        List<Integer> movieIds = movieService.listAllIds();
+        List<Movie> movies = new ArrayList<>();
+        if(page==null || Integer.parseInt(page) <= 0)
+            page="1";
+        int pageToLoad = Integer.parseInt(page);
+
+        int from = (pageToLoad-1)*12;
+        int to = pageToLoad*12;
+
+        if (from>movieIds.size()){
+            page = "1";
+            pageToLoad = Integer.parseInt(page);
+            from = (pageToLoad-1)*12;
+            to = pageToLoad*12;
+        }
+        else if(to>movieIds.size()){
+            to = movieIds.size();
+        }
+
+        movieIds = movieIds.subList(from, to);
+
+        for(Integer id: movieIds){
+            //Trying to improve load times by not pulling all things from the database, excluding un-needed stuff
+            //
+            //movies.add(movieService.findById(id));
+            movies.add(movieService.findBasicById(id));
+        }
+        model.addAttribute("page", page);
+        return movies;
+    }
+}
Index: Sources/src/main/java/com/wediscussmovies/project/web/controller/DiscussionController.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/web/controller/DiscussionController.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/web/controller/DiscussionController.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,200 @@
+package com.wediscussmovies.project.web.controller;
+
+import com.wediscussmovies.project.LoggedUser;
+import com.wediscussmovies.project.model.Discussion;
+import com.wediscussmovies.project.model.Reply;
+import com.wediscussmovies.project.model.User;
+import com.wediscussmovies.project.model.relation.DiscussionLikes;
+import com.wediscussmovies.project.querymodels.DiscussionLikesQM;
+import com.wediscussmovies.project.service.DiscussionService;
+import com.wediscussmovies.project.service.MovieService;
+import com.wediscussmovies.project.service.PersonService;
+import com.wediscussmovies.project.service.ReplyService;
+import org.springframework.security.authentication.AnonymousAuthenticationToken;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Controller
+@RequestMapping("/discussions")
+public class DiscussionController {
+
+    private final DiscussionService discussionService;
+    private final ReplyService replyService;
+    private final MovieService movieService;
+    private final PersonService personService;
+
+    public DiscussionController(DiscussionService discussionService, ReplyService replyService, MovieService movieService, PersonService personService) {
+        this.discussionService = discussionService;
+        this.replyService = replyService;
+        this.movieService = movieService;
+        this.personService = personService;
+    }
+
+    @GetMapping()
+    public String getDiscussions(@RequestParam(required = false) String titleSearch,
+                                    Model model){
+        /* 1.Validacija i  na frontend so, da ne se isprakja baranjeto, ako titleSearch e null ili empty
+         da ne se preoptovaruva serverot so baranja za titleSearch koga e null!
+
+         */
+        //List<Discussion> discussions = discussionService.listAllByTitle(titleSearch);
+        List<Discussion> discussions = discussionService.listAll();
+        model.addAttribute("discussions", discussions);
+        model.addAttribute("contentTemplate", "discussionsList");
+        model.addAttribute("user",LoggedUser.getLoggedUser());
+        this.addModelPropertiesForUser(model);
+       // this.addModelPropertiesLikes(model,null, discussions);
+        return "template";
+    }
+
+    @GetMapping("/{id}")
+    public String getDiscussion(
+            @PathVariable Integer id,
+            Model model){
+        /*
+            2. Moze da se vrati indikator deka takva diskusija ne postoi! - postaveno
+         */
+        try {
+            Discussion disc = discussionService.findById(id);
+            model.addAttribute("disc", disc);
+            model.addAttribute("contentTemplate", "discussion");
+            model.addAttribute("replies",this.replyService.findAllByDiscussion(disc));
+            addModelPropertiesForUser(model);
+
+            return "template";
+        }
+        catch (RuntimeException exception){
+            return "redirect:/discussions?error="+exception.getMessage();
+
+        }
+    }
+    @GetMapping("/all/{id}")
+    public String getDiscussionForId(@PathVariable Integer id,@RequestParam Character type, Model model){
+
+        model.addAttribute("discussions", this.discussionService.findAllForPersonOrMovie(id,type));
+        model.addAttribute("contentTemplate", "discussionForType");
+        return "template";
+
+    }
+
+    @GetMapping("/{id}/replies")
+    public String getRepliesToDiscussion(
+            @PathVariable Integer id,
+            Model model){
+
+        try {
+            Discussion discussion = discussionService.findById(id);
+            model.addAttribute("discussion", discussion);
+            model.addAttribute("contentTemplate", "discussionReply");
+            return "template";
+        }
+        catch (RuntimeException exception){
+            return "redirect:/discussions?error="+exception.getMessage();
+
+        }
+
+    }
+
+
+    @GetMapping("/add/{id}")
+    public String getFormForEdit(Model model,
+                                           @PathVariable Integer id)
+    {
+        Discussion discussion = this.discussionService.findById(id);
+        setModelPropertiesForForm(model);
+        model.addAttribute("discussion", discussion);
+
+        return "template";
+    }
+    @GetMapping("/add")
+    public String getFormForAdd(Model model)
+    {
+        setModelPropertiesForForm(model);
+
+        return "template";
+    }
+
+
+    @PostMapping("/save")
+    public String saveDiscussion(
+           @RequestParam Integer idDiscussed,
+            @RequestParam String title,
+            @RequestParam String text,
+            @RequestParam Character type    ){
+
+
+
+        try{
+
+            discussionService.save(type,idDiscussed, title, text, LoggedUser.getLoggedUser());
+            return "redirect:/discussions";
+
+        }
+
+        catch (RuntimeException exc){
+            return "redirect:/discussions?error="+exc.getMessage();
+
+        }
+    }
+
+    @PostMapping("/save/{discussionId}/")
+    public String editDiscussion(
+                                               @PathVariable Integer discussionId,
+                                               @RequestParam String title,
+                                               @RequestParam String text,
+                                               @RequestParam Character type,
+                                               @RequestParam Integer idDiscussed
+                                               ){
+
+
+
+
+        try{
+
+
+            discussionService.edit(discussionId,type,idDiscussed, title, text);
+            return "redirect:/discussions";
+
+        }
+
+        catch (RuntimeException exc){
+            return "redirect:/discussions?error="+exc.getMessage();
+
+        }
+    }
+
+    private void setModelPropertiesForForm(Model model){
+        model.addAttribute("movies",this.movieService.listAll());
+        model.addAttribute("persons",this.personService.findAll());
+        model.addAttribute("contentTemplate", "discussionsAdd");
+
+    }
+    private void addModelPropertiesForUser(Model model){
+        User user = LoggedUser.getLoggedUser();
+        model.addAttribute("likedDiscussions",this.discussionService.findLikedDiscussionsByUser(user));
+        model.addAttribute("user",user);
+    }
+    private void addModelPropertiesLikes(Model model, Discussion discussion, List<Discussion> discussions){
+        // ispagja kompliciran kod vaka, podobro da dodademe i svojstvo u diskusijata i koga ke se dodade lajk
+        // soodvetno da se zgoleme i obratno
+//        if(discussion==null){
+//            List<DiscussionLikesQM> discussionLikes = new ArrayList<>();
+//            for(Discussion d: discussions){
+//                discussionLikes.add(discussionService.findLikesForDiscussionWithId(d.getDiscussionId()));
+//            }
+//            model.addAttribute("likes", discussionLikes);
+//        }
+//        else{
+//            model.addAttribute("likes",discussionService.findLikesForDiscussionWithId(discussion.getDiscussionId()).getLikes());
+//        }
+    }
+
+
+}
Index: Sources/src/main/java/com/wediscussmovies/project/web/controller/GenreController.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/web/controller/GenreController.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/web/controller/GenreController.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,46 @@
+package com.wediscussmovies.project.web.controller;
+
+import com.wediscussmovies.project.LoggedUser;
+import com.wediscussmovies.project.model.Genre;
+import com.wediscussmovies.project.model.User;
+import com.wediscussmovies.project.model.relation.UserGenres;
+import com.wediscussmovies.project.repository.GenreLikesRepository;
+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;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Controller
+@RequestMapping("/genres")
+public class GenreController {
+    private final GenreService genreService;
+    private final GenreLikesRepository genreLikesRepository;
+
+    public GenreController(GenreService genreService, GenreLikesRepository genreLikesRepository) {
+        this.genreService = genreService;
+        this.genreLikesRepository = genreLikesRepository;
+    }
+    @GetMapping
+    public String getGenres(Model model){
+        model.addAttribute("genres",genreService.findAllWithLikes());
+        model.addAttribute("allGenres", genreService.findAll());
+        model.addAttribute("contentTemplate","genres");
+        addModelPropertiesForUser(model);
+        return "template";
+    }
+
+    private void addModelPropertiesForUser(Model model){
+        User user = LoggedUser.getLoggedUser();
+        List<UserGenres> genreLikesList = this.genreLikesRepository.findAllByUser(user);
+        List<Genre> genres = new ArrayList<>();
+        for(UserGenres g: genreLikesList){
+            genres.add(genreService.findById(g.getId().getGenreId()));
+        }
+        model.addAttribute("likedGenres",genres);
+        model.addAttribute("user",user);
+    }
+}
Index: Sources/src/main/java/com/wediscussmovies/project/web/controller/MovieController.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/web/controller/MovieController.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/web/controller/MovieController.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,206 @@
+package com.wediscussmovies.project.web.controller;
+
+import com.wediscussmovies.project.LoggedUser;
+import com.wediscussmovies.project.model.Movie;
+import com.wediscussmovies.project.model.Person;
+import com.wediscussmovies.project.model.User;
+import com.wediscussmovies.project.querymodels.MovieLikesQM;
+import com.wediscussmovies.project.service.GenreService;
+import com.wediscussmovies.project.service.MovieService;
+import com.wediscussmovies.project.service.PersonService;
+import com.wediscussmovies.project.web.DesignFrontMovies;
+import com.wediscussmovies.project.web.PageFrontMovies;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+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;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+
+import java.sql.Date;
+import java.time.LocalDate;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+
+@Controller
+@RequestMapping("/movies")
+public class MovieController {
+    private final MovieService movieService;
+    private final GenreService genreService;
+    private final PersonService personService;
+
+    public MovieController(MovieService movieService, GenreService genreService, PersonService personService) {
+        this.movieService = movieService;
+        this.genreService = genreService;
+        this.personService = personService;
+    }
+
+    @GetMapping("/old")
+    public String getMoviesOld(@RequestParam(required = false) String titleQuery, Model model,
+                            @RequestParam(required = false) String error){
+        List<Movie> movies;
+        if(titleQuery == null ) {
+            movies = movieService.listAll();
+        }
+        else{
+            movies = movieService.searchByTitle(titleQuery);
+        }
+
+        addModelPropertiesForUser(model);
+
+        List<List<Movie>> movie_rows = new ArrayList<>();
+        DesignFrontMovies.designMovieList(movies,movie_rows);
+        model.addAttribute("movies", movies);
+        model.addAttribute("movie_rows", movie_rows);
+        model.addAttribute("contentTemplate", "moviesList");
+        model.addAttribute("genres", genreService.findAll());
+        if (error != null && !error.equals(" "))
+            model.addAttribute("error",error);
+        return "template";
+    }
+
+
+    @GetMapping
+    public String getMovies(@RequestParam(required = false) String titleQuery, Model model,
+                            @RequestParam(required = false) String error, @RequestParam(required = false) String page){
+        if (page==null){
+            return "redirect:/movies?page=1";
+        }
+        addModelPropertiesForUser(model);
+        List<Movie> movies = PageFrontMovies.getPagedMovies(page, movieService, model);
+        List<List<Movie>> movie_rows = new ArrayList<>();
+        DesignFrontMovies.designMovieList(movies,movie_rows);
+        //addModelPropertiesForMoviesLikes(model, movies);
+        model.addAttribute("movies", movies);
+        model.addAttribute("movie_rows", movie_rows);
+        model.addAttribute("genres", genreService.findAll());
+        model.addAttribute("contentTemplate", "moviesListPaged");
+        if (error != null && !error.equals(" "))
+            model.addAttribute("error",error);
+        return "template";
+    }
+
+    @GetMapping("/{id}")
+    public String getMovie(@PathVariable Integer id, Model model){
+        model.addAttribute("movie", movieService.findById(id));
+        addModelPropertiesForUser(model);
+        model.addAttribute("likes", movieService.findLikesForMovieById(id).getLikes());
+        model.addAttribute("contentTemplate", "movieShow");
+        return "template";
+    }
+
+    @GetMapping("/add")
+    public String addMovie(Model model){
+
+        addModelProperties(model);
+        model.addAttribute("contentTemplate", "moviesAdd");
+        return "template";
+    }
+
+
+    @GetMapping("/{id}/delete")
+    public String deleteMovie(@PathVariable Integer id){
+
+       try {
+           this.movieService.deleteById(id);
+           return "redirect:/movies";
+
+       }
+       catch (RuntimeException exc){
+           return "redirect:/movies?error="+exc.getMessage();
+       }
+    }
+
+    @PostMapping("/save")
+    public String saveMovie(
+
+
+
+            @RequestParam String title,
+                               @RequestParam String description,
+                               @RequestParam String imageUrl,
+                               @RequestParam(required = false) Double rating,
+                               @RequestParam(required = false) Integer directorId,
+                               @RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate airingDate,
+                               @RequestParam List<Integer> actors,
+                               @RequestParam List<Integer> genres
+                            ){
+
+        try {
+            Movie movie = this.movieService.save(title,description,imageUrl,Date.valueOf(airingDate),rating,directorId,actors,genres);
+
+            return "redirect:/movies";
+        }
+        catch (RuntimeException exc){
+            return "redirect:/movies?error="+exc.getMessage();
+        }
+    }
+    @PostMapping("/save/{movieId}")
+    public String updateMovie(
+
+
+            @PathVariable Integer movieId,
+            @RequestParam String title,
+            @RequestParam String description,
+            @RequestParam String imageUrl,
+            @RequestParam(required = false) Double rating,
+            @RequestParam(required = false) Integer directorId,
+            @RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate airingDate,
+            @RequestParam List<Integer> actors,
+            @RequestParam List<Integer> genres
+    ){
+
+        try {
+            Movie movie = this.movieService.edit(movieId,title,description,imageUrl,Date.valueOf(airingDate),rating,directorId,actors,genres);
+
+            return "redirect:/movies";
+        }
+        catch (RuntimeException exc){
+            return "redirect:/movies?error="+exc.getMessage();
+        }
+    }
+
+
+
+    @GetMapping("/{id}/edit")
+    public String editMovie(@PathVariable Integer id, Model model){
+        try {
+            Movie movie = movieService.findById(id);
+            addModelProperties(model);
+            model.addAttribute("movie", movie);
+            model.addAttribute("director",movie.getDirector());
+            model.addAttribute("movieActors",movieService.findAllActorsForMovie(movie));
+            model.addAttribute("movieGenres",movieService.findAllGenresForMovie(movie));
+            model.addAttribute("contentTemplate", "moviesAdd");
+            return "template";
+
+        }
+        catch (RuntimeException exc){
+            return "redirect:/movies?error="+exc.getMessage();
+        }
+
+    }
+    private void addModelProperties(Model model){
+        model.addAttribute("directors", personService.findAllDirectors());
+        model.addAttribute("actors", personService.findAllActors());
+        model.addAttribute("genres", genreService.findAll());
+    }
+    private void addModelPropertiesForUser(Model model){
+        User user = LoggedUser.getLoggedUser();
+        model.addAttribute("likedMovies",this.movieService.findLikedMoviesByUser(user));
+        model.addAttribute("user",user);
+    }
+    private void addModelPropertiesForMoviesLikes(Model model, List<Movie> movies){
+        HashMap<Integer,MovieLikesQM> movieLikes = new HashMap<>();
+        for(Movie m: movies){
+            movieLikes.put(m.getMovieId(),movieService.findLikesForMovieById(m.getMovieId()));
+        }
+        model.addAttribute("movieLikes", movieLikes);
+    }
+
+}
Index: Sources/src/main/java/com/wediscussmovies/project/web/controller/PersonController.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/web/controller/PersonController.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/web/controller/PersonController.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,145 @@
+package com.wediscussmovies.project.web.controller;
+
+import com.wediscussmovies.project.LoggedUser;
+import com.wediscussmovies.project.model.Person;
+import com.wediscussmovies.project.model.User;
+import com.wediscussmovies.project.service.MovieService;
+import com.wediscussmovies.project.service.PersonService;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.sql.Date;
+import java.util.List;
+
+@Controller
+public class PersonController {
+    private final PersonService personService;
+    private final MovieService movieService;
+
+    public PersonController(PersonService personService, MovieService movieService) {
+        this.personService = personService;
+        this.movieService = movieService;
+    }
+
+    /*
+    1. Prebaruvanjeto po ime i prezime posoodvetno e da bide na frontend
+        Da ne se preoptovaruva server i klient da ceka koga moze vo browser vekje dobieni da se filtrirat
+     */
+    @GetMapping("/actors")
+    public String getActors(Model model, @RequestParam(required = false) String nameAndSurname){
+        List<Person> persons = personService.findPersonsByNameOrSurname('A',nameAndSurname);
+        model.addAttribute("persons", persons);
+        model.addAttribute("contentTemplate", "personsList");
+
+        return "template";
+    }
+    /*
+      2. Prebaruvanjeto po ime i prezime posoodvetno e da bide na frontend
+          Da ne se preoptovaruva server i klient da ceka koga moze vo browser vekje dobieni da se filtrirat
+       */
+    @GetMapping("/directors")
+    public String getDirectors(Model model, @RequestParam(required = false) String nameAndSurname){
+        List<Person> persons = personService.findPersonsByNameOrSurname('D',nameAndSurname);
+        model.addAttribute("persons", persons);
+        model.addAttribute("contentTemplate", "personsList");
+        return "template";
+    }
+
+    @GetMapping("/persons/{id}")
+    public String getPerson(@PathVariable Integer id, Model model){
+        Person person = personService.findById(id);
+        //Error handling, could be null!!!!!!!!!
+        model.addAttribute("person", person);
+        addModelPropertiesForUser(model);
+        model.addAttribute("contentTemplate", "personShow");
+        return "template";
+    }
+
+    @GetMapping("/persons/add")
+    public String addingFormForPerson( Model model){
+
+        addModelPropertiesForForm(model);
+        return "template";
+    }
+    @GetMapping("persons/edit/{personId}")
+    public String editPerson(@PathVariable Integer personId, Model model){
+
+        try {
+            Person person = this.personService.findById(personId);
+            addModelPropertiesForForm(model);
+            model.addAttribute("person",person);
+            model.addAttribute("movieActors",this.personService.findAllMoviesByPerson(person));
+            return "template";
+        }
+        catch (RuntimeException exc){
+            return "redirect:/actors?erorr="+exc.getMessage();
+        }
+    }
+
+    @PostMapping("/persons/save")
+    public String savePerson(
+            @RequestParam String name,
+            @RequestParam String surname,
+            @RequestParam Character type,
+            @RequestParam Date birthDate,
+            @RequestParam String imageUrl,
+            @RequestParam String description,
+            @RequestParam(required = false) List<Integer> movieIds){
+
+        String returnedUrl = getReturnedUrl(type);
+
+        try {
+
+            Person person = this.personService.save(name, surname, type, birthDate, imageUrl, description, movieIds);
+           return returnedUrl;
+        }
+        catch (RuntimeException exc){
+            return returnedUrl + "?error" + exc.getMessage();
+        }
+
+    }
+    @PostMapping("/persons/save/{personId}")
+    public String editPerson(
+            @PathVariable Integer personId,
+            @RequestParam String name,
+            @RequestParam String surname,
+            @RequestParam Character type,
+            @RequestParam Date birthDate,
+            @RequestParam String imageUrl,
+            @RequestParam String description,
+            @RequestParam(required = false) List<Integer> movieIds){
+
+        String returnedUrl = getReturnedUrl(type);
+        try {
+
+            Person person = this.personService.edit(personId,name, surname, type, birthDate, imageUrl, description, movieIds);
+            return returnedUrl;
+        }
+        catch (RuntimeException exc){
+            return returnedUrl + "?error" + exc.getMessage();
+        }
+
+    }
+    private String getReturnedUrl(Character type){
+        if (type.equals('A'))
+           return   "redirect:/actors";
+        return "redirect:/directors";
+    }
+    private void addModelPropertiesForForm(Model model){
+        model.addAttribute("contentTemplate", "personsAdd");
+        model.addAttribute("moviesActors",this.movieService.listAllByType('A'));
+        model.addAttribute("moviesDirectors",this.movieService.listAllByType('D'));
+
+    }
+
+    private void addModelPropertiesForUser(Model model){
+        User user = LoggedUser.getLoggedUser();
+        model.addAttribute("user",user);
+    }
+
+
+}
Index: Sources/src/main/java/com/wediscussmovies/project/web/controller/ReplyController.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/web/controller/ReplyController.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/web/controller/ReplyController.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,85 @@
+package com.wediscussmovies.project.web.controller;
+
+import com.wediscussmovies.project.LoggedUser;
+import com.wediscussmovies.project.model.Reply;
+import com.wediscussmovies.project.model.User;
+import com.wediscussmovies.project.model.primarykeys.ReplyPK;
+import com.wediscussmovies.project.service.ReplyService;
+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;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+
+
+@Controller
+@RequestMapping("/replies")
+public class ReplyController {
+    private final ReplyService replyService;
+
+    public ReplyController(ReplyService replyService) {
+        this.replyService = replyService;
+    }
+
+    @GetMapping("/add/{discussionId}")
+    public String addForm(@PathVariable Integer discussionId, Model model){
+        model.addAttribute("discussionId",discussionId);
+        model.addAttribute("contentTemplate","repliesAdd");
+        return "template";
+    }
+
+    @GetMapping("/edit/{discussionId}/{replyId}")
+    public String editForm(@PathVariable Integer discussionId,@PathVariable Integer replyId, Model model){
+
+        try {
+            Reply reply = replyService.findById(discussionId,replyId);
+            model.addAttribute("reply", reply);
+            model.addAttribute("contentTemplate", "repliesAdd");
+            return "template";
+
+
+        }catch (RuntimeException exc){
+            return "redirect:/discussions?error="+exc.getMessage();
+
+        }
+    }
+    @PostMapping("/save")
+    public String saveReply(
+            @RequestParam Integer discussionId,
+            @RequestParam String text){
+
+        try {
+
+            this.replyService.save(discussionId,text, LoggedUser.getLoggedUser());
+            return "redirect:/discussions/"+discussionId;
+
+        }
+        catch (RuntimeException exc){
+            return "redirect:/discussions?error="+exc.getMessage();
+
+        }
+    }
+
+    @PostMapping("/save/{replyId}")
+    public String editReply(
+                            @PathVariable Integer replyId,
+                            @RequestParam Integer discussionId,
+                            @RequestParam String text){
+
+        /*
+            1. Da se realizira so ajax baranje na restController
+         */
+        try {
+            Reply reply = replyService.edit(replyId,discussionId, text);
+
+            return "redirect:/discussions/" + reply.getDiscussion().getDiscussionId();
+        }
+        catch (RuntimeException exc){
+            return "redirect:/discussions?error="+exc.getMessage();
+        }
+
+    }
+
+}
Index: Sources/src/main/java/com/wediscussmovies/project/web/controller/UsersController.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/web/controller/UsersController.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/web/controller/UsersController.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,79 @@
+package com.wediscussmovies.project.web.controller;
+
+
+import com.wediscussmovies.project.LoggedUser;
+import com.wediscussmovies.project.model.Movie;
+import com.wediscussmovies.project.model.exception.InvalidArgumentsException;
+import com.wediscussmovies.project.model.exception.PasswordsDoNotMatchException;
+import com.wediscussmovies.project.service.MovieService;
+import com.wediscussmovies.project.service.UserService;
+import com.wediscussmovies.project.web.DesignFrontMovies;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Controller
+@RequestMapping
+public class UsersController{
+    private  final UserService userService;
+    private final MovieService movieService;
+
+    public UsersController(UserService userService, MovieService movieService) {
+        this.userService = userService;
+        this.movieService = movieService;
+    }
+    @PostMapping("/register")
+    public String register(@RequestParam String username,
+                           @RequestParam String password,
+                           @RequestParam String repeatedPassword,
+                           @RequestParam String email,
+                           @RequestParam String name,
+                           @RequestParam String surname) {
+        try{
+            this.userService.register(email,username,password,repeatedPassword,name,surname);
+            return "redirect:/login";
+        } catch (InvalidArgumentsException | PasswordsDoNotMatchException exception) {
+            return "redirect:/register?error=" + exception.getMessage();
+        }
+    }
+    @GetMapping("/profiles/{id}")
+    public String getProfilePage(@PathVariable Integer id, Model model){
+        model.addAttribute("user",userService.findById(id));
+        model.addAttribute("contentTemplate","usersShow");
+        return "template";
+    }
+    @GetMapping("/register")
+    public String getRegisterPage(@RequestParam(required = false) String error, Model model) {
+        addModelError(model,error);
+        model.addAttribute("contentTemplate","register");
+        return "template";
+    }
+    @GetMapping("/login")
+    public String getLoginPage(@RequestParam(required = false) String error,Model model){
+        addModelError(model,error);
+        model.addAttribute("contentTemplate","login");
+        return "template";
+    }
+
+    private void addModelError(Model model,String error){
+        if(error != null && !error.isEmpty()) {
+            model.addAttribute("hasError", true);
+            model.addAttribute("error", error);
+        }
+    }
+    @GetMapping("/favoriteList")
+    public String getFavoriteList(Model model){
+        List<Movie> movieList = this.movieService.findLikedMoviesByUser(LoggedUser.getLoggedUser());
+        List<List<Movie>> movie_rows = new ArrayList<>();
+        DesignFrontMovies.designMovieList(movieList,movie_rows);
+        model.addAttribute("movie_rows", movie_rows);
+        model.addAttribute("contentTemplate","favoriteList");
+        return "template";
+
+    }
+
+
+}
Index: Sources/src/main/java/com/wediscussmovies/project/web/controller/rest/DiscussionRestController.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/web/controller/rest/DiscussionRestController.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/web/controller/rest/DiscussionRestController.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -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: Sources/src/main/java/com/wediscussmovies/project/web/controller/rest/GenreRestController.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/web/controller/rest/GenreRestController.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/web/controller/rest/GenreRestController.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,38 @@
+package com.wediscussmovies.project.web.controller.rest;
+
+import com.wediscussmovies.project.service.DiscussionService;
+import com.wediscussmovies.project.service.GenreService;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+
+@RestController
+@RequestMapping("api/genres")
+public class GenreRestController {
+    private final GenreService genreService;
+
+    public GenreRestController(GenreService genreService) {
+        this.genreService = genreService;
+    }
+
+    @GetMapping("/like/{genreId}")
+    public ResponseEntity likeGenre(@PathVariable Integer genreId, @RequestParam Integer userId){
+        try {
+            this.genreService.likeGenre(genreId,userId);
+            return ResponseEntity.ok(true);
+        }
+        catch (RuntimeException exception){
+            return ResponseEntity.ok(false);
+        }
+    }
+    @GetMapping("/unlike/{genreId}")
+    public ResponseEntity unlikeGenre (@PathVariable Integer genreId, @RequestParam Integer userId){
+        try {
+            this.genreService.unlikeGenre(genreId,userId);
+            return ResponseEntity.ok(true);
+        }
+        catch (RuntimeException exception){
+            System.out.println(exception.getMessage());
+            return ResponseEntity.ok(false);
+        }
+    }
+}
Index: Sources/src/main/java/com/wediscussmovies/project/web/controller/rest/MovieRestController.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/web/controller/rest/MovieRestController.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/web/controller/rest/MovieRestController.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,67 @@
+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 {
+            if(grade.getRating() < 5)
+                grade.setRating(5);
+            else if(grade.getRating()>10)
+                grade.setRating(10);
+            this.movieService.addGradeMovie(movieId, LoggedUser.getLoggedUser(),grade);
+            return ResponseEntity.ok(true);
+        }
+        catch (RuntimeException exception){
+            return ResponseEntity.ok(false);
+        }
+
+    }
+
+}
Index: Sources/src/main/java/com/wediscussmovies/project/web/controller/rest/PersonRestController.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/web/controller/rest/PersonRestController.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/web/controller/rest/PersonRestController.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -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: Sources/src/main/java/com/wediscussmovies/project/web/controller/rest/ReplyRestController.java
===================================================================
--- Sources/src/main/java/com/wediscussmovies/project/web/controller/rest/ReplyRestController.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/java/com/wediscussmovies/project/web/controller/rest/ReplyRestController.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -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: Sources/src/main/resources/application-prod.properties
===================================================================
--- Sources/src/main/resources/application-prod.properties	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/resources/application-prod.properties	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,14 @@
+spring.datasource.url=jdbc:postgresql://localhost:9999/db_202122z_va_prj_wediscussmovies?currentSchema=project
+spring.datasource.username=db_202122z_va_prj_wediscussmovies_owner
+spring.datasource.password=7d8fb26b5697
+
+
+## default connection pool
+
+spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQL95Dialect
+spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
+
+
+spring.jpa.hibernate.ddl-auto=validate
+spring.jpa.show-sql=true
+
Index: Sources/src/main/resources/application.properties
===================================================================
--- Sources/src/main/resources/application.properties	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/resources/application.properties	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,7 @@
+spring.profiles.active=prod
+
+server.port=9090
+
+spring.thymeleaf.cache=false
+
+spring.mvc.hiddenmethod.filter.enabled=true
Index: Sources/src/main/resources/static/css/shared.css
===================================================================
--- Sources/src/main/resources/static/css/shared.css	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/resources/static/css/shared.css	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,303 @@
+.col{
+    max-width: 5vw;
+}
+
+.row{
+    height: 300px;
+    margin-bottom: 15px;
+}
+
+.row div{
+    height: 100%;
+}
+
+.row div div{
+    height: 100%;
+}
+
+.card{
+    background-size: 100vh auto;
+    float:left;
+    margin: 7px;
+    border-radius: 10px;
+    padding: 20px;
+    color: white;
+    -webkit-text-stroke-width: 1px !important;
+    -webkit-text-stroke-color: black !important;
+    width: 90%;
+    height: 90%;
+    box-shadow: 4px 4px 4px rgba(128,128,128,1);
+}
+
+.card a h3{
+    -webkit-text-stroke-width: 1px;
+    -webkit-text-stroke-color: black;
+    color:white;
+    transition: 100ms;
+}
+
+.card:hover a h3{
+    transition: 400ms;
+    color:black;
+    -webkit-text-stroke-color: white;
+}
+
+.title{
+    text-align: center;
+    background-color: rgba(0,0,0,0.25);
+    border-radius: 10px 10px 0px 0px;
+    padding: 10px;
+}
+
+.bottom{
+    position: absolute;
+    top: 75%;
+    margin:auto;
+    width: 100%;
+    left: 0%;
+    border-radius: 0px;
+    text-align: center;
+    background-color: rgba(0,0,0,0.25);
+}
+.bottom h3, .bottom span{
+    margin-bottom: 0px;
+    margin-top: 0px;
+}
+.bottom span{
+    font-size: 75%;
+    margin-top: 5px;
+}
+
+
+.elements .card .btn{
+    top: 60%;
+    left: auto;
+    position: absolute;
+    margin: auto;
+    width: 20%;
+    text-align: center;
+}
+
+#paging-section{
+    width: 100%;
+    clear: both;
+    margin-bottom: 30px;
+}
+
+#inner-paging{
+    width: fit-content;
+    margin: auto;
+
+}
+
+#button-sub, #button-add{
+    width: 100px;
+}
+
+#pageInput{
+    font-size: 100%;
+    text-align: center;
+    width: 175px;
+    margin: auto;
+}
+
+#button-submit-page{
+    margin: auto;
+    text-align: center;
+    margin-top: 7px;
+    display: none;
+}
+
+.visibility{
+    transition: 200ms;
+    opacity: 0;
+}
+
+.person-movies-list{
+    margin: auto;
+    margin-top: 20px;
+    padding: 10px;
+    width: 80%;
+    background-color: rgba(52, 58, 64, 0.7);
+    border-radius: 10px;
+    transition: 200ms;
+    color: white;
+}
+
+.person-movies-list:hover{
+    background-color: rgba(52, 58, 64, 1);
+}
+
+.person-movies-list ul{
+    list-style-type: none;
+}
+
+.person-movies-list ul li{
+    color:black;
+    background-color: rgba(255,255,255,0.7);
+    padding: 12px;
+    font-size: 120%;
+    width: 80%;
+    text-align: center;
+    margin: auto;
+    transition: 200ms;
+    border-radius: 10px;
+    margin-bottom: 5px;
+    text-decoration: underline;
+}
+
+.person-movies-list hr{
+    color: white;
+    background-color: white;
+    border-color: white;
+}
+
+.person-movies-list ul li:hover{
+    background-color: rgba(255,255,255,1);
+    text-decoration-color: blue;
+}
+
+.genres-listing ul li:hover{
+    background-color: rgba(222,128,128,1);
+}
+
+.genres-listing ul li{
+    background-color: rgba(192,128,128,0.7);
+    text-decoration: none;
+}
+
+.person-movies-list ul li a{
+    color: black;
+    transition: 250ms;
+    text-decoration: underline;
+    text-decoration-color: black;
+}
+
+.person-movies-list ul li a:hover{
+    color:blue;
+}
+
+
+#admin-buttons a{
+    display: inline-block;
+    width: 95%;
+    margin: auto;
+    margin-top: 10px;
+    font-size: 125%;
+    clear: both;
+}
+
+#image-movie-section{
+    height: fit-content;
+    min-height: fit-content;
+}
+
+#likes-showcase{
+    background-color: rgba(192,128,128,0.7);
+    border-radius: 10px;
+    padding:10px;
+    width: 60%;
+    margin: auto;
+    transition: 200ms;
+    margin-top: 2%;
+}
+
+#likes-showcase strong{
+    font-size: 150%;
+}
+
+#likes-showcase:hover{
+    background-color: rgba(222,128,128,1);
+}
+
+.invisible-search{
+    display: none;
+}
+
+.user-text{
+    font-size: 95%;
+    text-decoration: none !important;
+    text-decoration-color: transparent;
+    text-align: justify;
+}
+
+.user-text-small{
+    font-size: 85%;
+    text-decoration: none !important;
+    text-decoration-color: transparent;
+    text-align: justify;
+}
+
+
+.user-movies-list{
+    margin: auto;
+    margin-top: 20px;
+    padding: 10px;
+    width: 80%;
+    background-color: rgba(52, 58, 64, 0.7);
+    border-radius: 10px;
+    transition: 200ms;
+    margin-right: 15px;
+    color: white;
+    transition: 200ms;
+}
+
+.user-movies-list:hover{
+    background-color: rgba(52, 58, 64, 1);
+}
+
+.user-movies-list ul{
+    list-style-type: none;
+    width: 99%;
+    margin: auto;
+    display: none;
+}
+
+.hidden-class{
+    background-color: rgba(192,255,192,0.6);
+    color: black;
+}
+
+.hidden-class:hover{
+    background-color: rgba(128,255,128,1) !important;
+
+}
+
+.user-movies-list ul li{
+    color:black;
+    background-color: rgba(255,255,255,0.7);
+    padding: 12px;
+    font-size: 80%;
+    width: 90%;
+    text-align: center;
+    margin: auto;
+    transition: 200ms;
+    border-radius: 10px;
+    margin-bottom: 5px;
+    text-decoration: none;
+    float: left;
+}
+
+.user-movies-list hr{
+    color: white;
+    background-color: white;
+    border-color: white;
+}
+
+
+.user-movies-list ul li:hover{
+    background-color: rgba(255,255,255,1);
+}
+
+.rate-title{
+    font-size: 130%;
+}
+
+#buttons-person{
+    margin-top: 10px;
+}
+
+#buttons-person li{
+    float: left;
+    margin-right: 10px;
+}
Index: Sources/src/main/resources/static/js/sharedScript.js
===================================================================
--- Sources/src/main/resources/static/js/sharedScript.js	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/resources/static/js/sharedScript.js	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,424 @@
+var urlRating;
+
+$(document).ready(function (){
+    var elements = $(".elements")
+    var elementGrade;
+    var first_time = true;
+
+    $("#button-add").on("click", function (){
+        itemInput = $("#pageInput")
+        itemInput.val(Number(itemInput.val()) + 1);
+        $("#button-submit-page").click()
+    })
+
+    $("#button-sub").on("click", function (){
+        itemInput = $("#pageInput")
+        if(Number(itemInput.val()) > 1){
+            itemInput.val(Number(itemInput.val()) - 1);
+            $("#button-submit-page").click()
+        }
+    })
+
+    $("#searchTitle").on("keyup", function() {
+        var value = $(this).val().toLowerCase();
+        console.log(value)
+        $(".elements div a .title").filter(function() {
+            console.log($(this).text())
+            if($(this).text().toLowerCase().indexOf(value) <= -1)
+                $(this).parent().parent().parent().addClass("visibility")
+            else
+                $(this).parent().parent().parent().removeClass("visibility")
+        });
+    });
+
+
+
+
+    $("#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()
+        console.log(elements)
+        for (let item of elements){
+            let title =  $(item).find(".card-title").text()
+            if (title.toLowerCase() === filter.toLowerCase()){
+                console.log("Da")
+                $(item).css("display","block")
+            }
+            else{
+                $(item).css("display","none")
+            }
+        }
+    })*/
+
+    $("#button_toggle_filters").on("click", function (){
+        if(first_time){
+            $("#filters_div").removeClass("invisible-search")
+            first_time=false
+        }
+        else
+            $("#filters_div").fadeToggle();
+    })
+
+    $(".user-movies-list").on("click", function (){
+       let children = $(this).children()
+        let first = true
+        for (let item of children){
+            if(first){
+                first = !first
+            }
+            else{
+                $(item).fadeToggle();
+            }
+        }
+        $(this).toggleClass("hidden-class")
+    })
+
+   $(".search-button").on("click",function () {
+       elements = $(".elements")
+       let filter = $("#searchGenre").val()
+       console.log('\''+filter+'\'')
+       console.log(elements)
+       if(filter.length==0){
+           console.log("HERE")
+           for (let item of elements) {
+               $(item).removeClass("visibility")
+           }
+       }
+       for (let item of elements) {
+           $(item).removeClass("visibility")
+            let genre = $(item).children(".card-genre")
+            let visible = false;
+            console.log(genre.length)
+            for (let g of genre) {
+                if (( $(g).text().toLowerCase() === filter.toLowerCase())){
+                    console.log(item.text + ' ' + $(g).text())
+                    visible = true
+                    $(item).removeClass("visibility")
+                    break;
+                }
+            }
+            if(!visible){
+                $(item).addClass("visibility")
+            }
+
+        }
+    });
+
+    $(".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','Немате оставено допаѓање на филмот!')
+    })
+    $(document.body).on("click",".button-add-genre-liked-list",function (){
+        let button = $(this)
+        let url = "/api/genres/like/"+ $(this).attr("genre-id") + "?userId="+ $(this).attr("user-id")
+        ajaxCallLikeGenre(url,button,'like','Веќе ви се допаѓа жанрот!')
+    })
+    $(document.body).on("click",".button-remove-genre-liked-list",function (){
+        let button = $(this)
+        let url = "/api/genres/unlike/"+ $(this).attr("genre-id")+"?userId="+ $(this).attr("user-id")
+        ajaxCallLikeGenre(url,button,'unlike','Немате оставено допаѓање на жанрот!')
+    })
+    $(document.body).on("click",".button-like-discussion",function (){
+        let button = $(this)
+        let url = "/api/discussions/like/"+ $(this).attr("discussion-id")+"?userId="+ $(this).attr("user-id")
+        ajaxCallLikeDiscussion(url,button,'like','Веќе имате оставено допаѓање на дискусијата!')
+    })
+    $(document.body).on("click",".button-unlike-discussion",function (){
+        let button = $(this)
+        let url = "/api/discussions/unlike/"+ $(this).attr("discussion-id")+"?userId="+ $(this).attr("user-id")
+        ajaxCallLikeDiscussion(url,button,'unlike','Немате оставено допаѓање на дискусијата!')
+    })
+    $(document.body).on("click",".button-like-discussion-alt",function (){
+        let button = $(this)
+        let url = "/api/discussions/like/"+ $(this).attr("discussion-id")+"?userId="+ $(this).attr("user-id")
+        ajaxCallLikeDiscussionAlternative(url,button,'like','Веќе имате оставено допаѓање на дискусијата!')
+    })
+    $(document.body).on("click",".button-unlike-discussion-alt",function (){
+        let button = $(this)
+        let url = "/api/discussions/unlike/"+ $(this).attr("discussion-id")+"?userId="+ $(this).attr("user-id")
+        ajaxCallLikeDiscussionAlternative(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-danger button-remove-favourite-list' movie-id=" + movieId + " user-id=" + userId + ">💔</a>")
+                    console.log("da")
+                }
+                else{
+                    $(button).parent().append("<a class='btn btn-success button-add-favourite-list' movie-id=" + movieId + " user-id=" + userId + ">❤</a>")
+                }
+                likes_count = $("#movie_likes_count")
+                count = Number($(likes_count).text())
+                if(type==="like")
+                    count++
+                else
+                    count--
+                likes_count.text(count)
+                $(button).remove()
+            }
+            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 ajaxCallLikeGenre(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 genreId=$(button).attr("genre-id")
+                if (type==='like') {
+                    $(button).parent().append("<a class='btn btn-danger button-remove-genre-liked-list' genre-id=" + genreId + " user-id=" + userId + ">💔</a>")
+                    console.log("da")
+                }
+                else{
+                    $(button).parent().append("<a class='btn btn-success button-add-genre-liked-list' genre-id=" + genreId + " user-id=" + userId + ">❤</a>")
+                }
+                let likes_sibling = $("#"+genreId+"genre")
+                value_likes = Number(likes_sibling.text())
+                if(type=="like")
+                    value_likes+=1
+                else
+                    value_likes-=1
+                likes_sibling.text(value_likes)
+                $(button).remove()
+            }
+            else {
+                $(button).parent().append("<div>" + message +" <button class='button-confirm'>Ок</button></div>")
+            }
+        }
+    })
+}
+
+
+
+
+function ajaxCallLikeDiscussion(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 discussionId=$(button).attr("discussion-id")
+                if (type==='like') {
+                    $(button).parent().append("<a class='btn btn-danger button-unlike-discussion' discussion-id=" + discussionId + " user-id=" + userId + ">💔</a>")
+                    console.log("da")
+                }
+                else{
+                    $(button).parent().append("<a class='btn btn-success button-like-discussion' discussion-id=" + discussionId + " user-id=" + userId + ">❤</a>")
+                }
+                var likes_count = $("#likes_count")
+                var count = Number($(likes_count).text())
+                if(type==='like')
+                    count += 1
+                else
+                    count -= 1
+                $(likes_count).text(count);
+                $(button).remove()
+            }
+            else {
+                $(button).parent().append("<div>" + message +" <button class='button-confirm'>Ок</button></div>")
+            }
+        }
+    })
+}
+
+
+
+function ajaxCallLikeDiscussionAlternative(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 discussionId=$(button).attr("discussion-id")
+                if (type==='like') {
+                    $(button).parent().append("<a class='btn btn-danger button-unlike-discussion-alt' discussion-id=" + discussionId + " user-id=" + userId + ">💔</a>")
+                    console.log("da")
+                }
+                else{
+                    $(button).parent().append("<a class='btn btn-success button-like-discussion-alt' discussion-id=" + discussionId + " user-id=" + userId + ">❤</a>")
+                }
+                var likes_count = $(button).parent().siblings(".likes_count").first()
+                var count = Number(likes_count.text())
+                if(type==='like')
+                    count += 1
+                else
+                    count -= 1
+                $(likes_count).text(count);
+                $(button).remove()
+            }
+            else {
+                $(button).parent().append("<div>" + message +" <button class='button-confirm'>Ок</button></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: Sources/src/main/resources/templates/discussion.html
===================================================================
--- Sources/src/main/resources/templates/discussion.html	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/resources/templates/discussion.html	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,66 @@
+<div xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.w3.org/1999/xhtml">
+    <div style="width: 85%; text-align: justify; margin: auto; clear: both">
+        <div style="background-color: rgba(128,128,128, 0.2); border-radius: 20px; padding: 20px">
+            <h1 th:text="${disc.getTitle()}" style="width: 80%; display: inline; height: fit-content; clear: both"></h1>
+        </div>
+        <hr>
+        <div>
+            <h5 th:text="${disc.getText()}" style="width: 90%; margin: auto; background-color: lightblue; border-radius: 4px; padding: 20px"></h5>
+        </div>
+        <br>
+        <h4>
+            <span th:if="${!disc.getUser().equals(user)}" sec:authorize="isAuthenticated()">
+                <a class='btn btn-success button-like-discussion' th:if="${!likedDiscussions.contains(disc)}" th:discussion-id="${disc.getDiscussionId()}" th:user-id="${user.getUserId()}" >❤</a>
+                <a class='btn btn-danger button-unlike-discussion' th:if="${likedDiscussions.contains(disc)}" th:discussion-id="${disc.getDiscussionId()}" th:user-id="${user.getUserId()}" >💔</a>
+            </span>
+            <span>Број на допаѓања:</span>
+            <span th:text="${disc.getLikes()}" id="likes_count"></span>
+        </h4>
+        <br>
+        <h6 style="width: 60%; float:left;">
+            <a th:href="@{'/profiles/{id}' (id=${disc.getUser().getUserId()})}" >
+            <span th:text="${'Поставено од: '+disc.getUser().getUsername()}"></span>
+            </a>
+            <span th:text="${', на датум '+ disc.getDate()}"></span>
+            <br>
+            <span>Поставено за </span>
+            <span th:text="${disc.getMovie() != null ? 'Филмот ' + disc.getMovie().getTitle() : 'Актерот ' + disc.getPerson().getName() + ' ' + disc.getPerson().getSurname()}" ></span>
+        </h6>
+        <div style="float: right"  sec:authorize="isAuthenticated()">
+            <a th:if="${disc.getUser().equals(user)}" class="btn btn-warning" th:href="@{'/discussions/add/{id}' (id=${disc.getDiscussionId()})}">Промени</a>
+            <a th:if="${disc.getUser().equals(user)}" class="btn btn-danger button-delete-discussion" th:discussion-id="${disc.getDiscussionId()}">Избриши</a>
+            <a class="btn btn-success" th:href="@{'/replies/add/{discussionId}' (discussionId=${disc.getDiscussionId()})}">Реплицирај</a>
+
+        </div><br>
+    </div>
+    <table class="table table-striped" style="width: 70%; margin: auto;">
+        <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 >
+                <a th:href="@{'/profiles/{id}' (id=${reply.getUser().getUserId()})}" th:text="${reply.getUser().getUsername()}"></a>
+            </td>
+            <td th:if="${reply.getUser().equals(user)}"><a class="btn btn-warning" 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-danger 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-success">👍 </a>
+                    <a class="btn btn-danger">👎</a>
+                </td>
+            </th:block>
+        </tr>
+        </tbody>
+    </table>
+</div>
Index: Sources/src/main/resources/templates/discussionForType.html
===================================================================
--- Sources/src/main/resources/templates/discussionForType.html	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/resources/templates/discussionForType.html	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -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: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>
+                                <a th:text="${disc.getTitle()}" th:href="@{'/discussions/{id}' (id=${disc.getDiscussionId()})}"></a>
+                            </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-warning" th:href="@{'/discussions/add/{id}' (id=${disc.getDiscussionId()})}">Измени</a> </td>
+                            <td th:if="${disc.getUser().equals(user)}"><a class="btn btn-danger 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-success" th:href="@{'/replies/add/{discussionId}' (discussionId=${disc.getDiscussionId()})}">Реплицирај</a> </td>
+                                <td th:if="${!disc.getUser().equals(user)}">
+                                    <a class="btn btn-success">👍 </a>
+                                    <a class="btn btn-danger">👎</a>
+                                </td>
+                            </th:block>
+
+
+                        </tr>
+                        </tbody>
+                    </table>
+                </div>
+            </div>
+        </div>
+    </div>
+
+</div>
Index: Sources/src/main/resources/templates/discussionsAdd.html
===================================================================
--- Sources/src/main/resources/templates/discussionsAdd.html	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/resources/templates/discussionsAdd.html	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -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: Sources/src/main/resources/templates/discussionsList.html
===================================================================
--- Sources/src/main/resources/templates/discussionsList.html	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/resources/templates/discussionsList.html	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -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}" class="btn btn-secondary">Додади нова дискусија</a>
+    </div>
+    <div class="container mb-4">
+            <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>
+                                <a th:text="${disc.getTitle()}" th:href="@{'/discussions/{id}' (id=${disc.getDiscussionId()})}"></a>
+                            </td>
+                            <td th:text="${disc.getLikes() != null ? disc.getLikes() : 0}"  class="likes_count">
+                            </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-warning" th:href="@{'/discussions/add/{id}' (id=${disc.getDiscussionId()})}">Измени</a> </td>
+                            <td th:if="${disc.getUser().equals(user)}"><a class="btn btn-danger 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-success" th:href="@{'/replies/add/{discussionId}' (discussionId=${disc.getDiscussionId()})}">Реплицирај</a> </td>
+                            <td th:if="${!disc.getUser().equals(user)}">
+                                <a class='btn btn-success button-like-discussion-alt' th:if="${!likedDiscussions.contains(disc)}" th:discussion-id="${disc?.getDiscussionId()}" th:user-id="${user.getUserId()}" >❤</a>
+                                <a class='btn btn-danger button-unlike-discussion-alt' th:if="${likedDiscussions.contains(disc)}" th:discussion-id="${disc?.getDiscussionId()}" th:user-id="${user.getUserId()}" >💔</a>
+                            </td>
+                            </th:block>
+
+                        </tr>
+                        </tbody>
+                    </table>
+                </div>
+            </div>
+    </div>
+
+</div>
Index: Sources/src/main/resources/templates/favoriteList.html
===================================================================
--- Sources/src/main/resources/templates/favoriteList.html	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/resources/templates/favoriteList.html	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,53 @@
+<div class="container mb-4" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.w3.org/1999/xhtml">
+    <div class="row" th:each="row: ${movie_rows}" >
+        <div class="col-md-3" th:each="movie: ${row}" >
+            <a class="card-text-center" th:href="@{'/movies/{id}' (id=${movie.getMovieId()})}" >
+                    <div class="card-body card bg-image" th:style="'background:url(' + ${movie.getImageUrl()} + ') no-repeat center #eee;'">
+                        <h3 class="card-title title" th:text="${movie.getTitle()}"></h3>
+                        <h3 class="card-text bottom" th:text="${'Rated '+movie.getImdbRating()}"></h3>
+                    </div>
+            </a>
+        </div>
+    </div>
+
+    <!--<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: Sources/src/main/resources/templates/fragments/header.html
===================================================================
--- Sources/src/main/resources/templates/fragments/header.html	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/resources/templates/fragments/header.html	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,63 @@
+<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">
+            <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 hidden">
+                    <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: Sources/src/main/resources/templates/fragments/searchBarGenre.html
===================================================================
--- Sources/src/main/resources/templates/fragments/searchBarGenre.html	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/resources/templates/fragments/searchBarGenre.html	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,9 @@
+<div xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" style="width:60%; margin: auto; margin-bottom: 10px">
+        <select th:if="${genres!=null}" id="searchGenre" class="form-control" style="float: left; display: block; width: 50%">
+            <option value="" selected>Сите</option>
+            <option th:each="genre: ${genres}" th:value="${genre.getGenreType()}" th:text="${genre.getGenreType()}"></option>
+        </select>
+        <div class="input-group-append" style="width: 40%">
+            <button class="btn btn-secondary  search-button" style="width: 100%">Филтрирај по жанр</button>
+        </div>
+</div>
Index: Sources/src/main/resources/templates/fragments/searchBarName.html
===================================================================
--- Sources/src/main/resources/templates/fragments/searchBarName.html	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/resources/templates/fragments/searchBarName.html	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,8 @@
+<div style="width:60%; margin: auto;">
+    <input id="searchTitle" class="form-control" style="float: left; display: block; width: 50%" type="text" placeholder="...">
+
+    <div class="input-group-append" style="width: 40%">
+        <button class="btn btn-secondary search-button-title" style="width: 100%">Филтрирај по Наслов</button>
+    </div>
+
+</div>
Index: Sources/src/main/resources/templates/genres.html
===================================================================
--- Sources/src/main/resources/templates/genres.html	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/resources/templates/genres.html	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,30 @@
+<div class="container mb-4" xmlns:sec="http://www.w3.org/1999/xhtml">
+
+    <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()}" th:id="${genre.getGenreId()+'genre'}"></td>
+              <td>
+                <th:block sec:authorize="isAuthenticated()" th:each="g: ${allGenres}" th:if="${g.getGenreId() == genre.getGenreId()}">
+                  <a class="btn btn-success button-add-genre-liked-list" th:genre-id="${g.getGenreId()}" th:user-id="${user.getUserId()}" th:if="${!likedGenres.contains(g)}">❤</a>
+                  <a class="btn btn-danger button-remove-genre-liked-list" th:genre-id="${g.getGenreId()}" th:user-id="${user.getUserId()}" th:if="${likedGenres.contains(g)}">💔</a>
+                </th:block>
+              </td>
+            </tr>
+            </tbody>
+          </table>
+        </div>
+      </div>
+
+  </div>
+</div>
Index: Sources/src/main/resources/templates/login.html
===================================================================
--- Sources/src/main/resources/templates/login.html	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/resources/templates/login.html	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -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: Sources/src/main/resources/templates/movieShow.html
===================================================================
--- Sources/src/main/resources/templates/movieShow.html	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/resources/templates/movieShow.html	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,107 @@
+<style>
+    #admin-buttons button{
+        float:left;
+        margin: 20px !important;
+    }
+
+    #admin-buttons{
+        width: 60%;
+        margin: auto;
+    }
+</style>
+
+<div xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.w3.org/1999/xhtml" style="width: 80%; margin: auto">
+    <div>
+        <div style="width: 30%; margin-right: 10px; padding:20px; border-right: 3px solid black; border-radius: 10px; float:left" id="image-movie-section">
+            <img th:src="${movie.getImageUrl()}" style="width: 90%; height: auto; clear: both; margin-bottom: 20px">
+            <div id="admin-buttons">
+                <a class="btn btn-primary" th:href="@{'/discussions/all/{id}?type=M' (id=${movie.getMovieId()})}" >Прегледај дискусии</a>
+                <th:block sec:authorize="isAuthenticated()" >
+                    <div>
+                        <a class="btn btn-success button-add-favourite-list" th:movie-id="${movie.getMovieId()}" th:user-id="${user.getUserId()}" th:if="${!likedMovies.contains(movie)}">❤</a>
+                        <a class="btn btn-danger button-remove-favourite-list" th:movie-id="${movie.getMovieId()}" th:user-id="${user.getUserId()}" th:if="${likedMovies.contains(movie)}">💔</a>
+                    </div>
+                    <a class="btn btn-secondary button-add-grade-movie" th:movie-id="${movie.getMovieId()}">Остави оценка</a>
+                    <a class="btn btn-warning" th:href="@{'/movies/{id}/edit' (id=${movie.getMovieId()})}">Промени</a>
+                    <a class="btn btn-danger button-delete-movie" th:movie-id="${movie.getMovieId()}">Избриши филм</a>
+                </th:block>
+            </div>
+        </div>
+
+        <div style="width: 60%; margin-left: 10px; padding:20px; float:left">
+            <h1 th:text="${movie.getTitle()}" style="text-align: center; padding:10px; background-color: rgba(64,64,64,0.5); color:white; border-radius: 10px 0px"></h1>
+            <hr>
+            <h3>
+                <span>Режисер:</span>
+                <a th:if="${movie.getDirector() != null}" th:text="${movie.getDirector().getName() + ' ' + movie.getDirector().getSurname()}" th:href="@{'/persons/{id}' (id=${movie.getDirector().getPersonId()})}"></a>
+                <span th:if="${movie.getDirector() == null}"> / </span>
+            </h3>
+            <h3 th:text="${'IMDB оцена: ' + movie.getImdbRating()}"></h3>
+            <h3 th:text="${'Прикажан на: ' + movie.getDateFormatted()}"></h3>
+
+            <div style="background-color: rgba(200,200,200,0.5); border-radius: 10px; padding:15px; ">
+                <h3>Краток опис:</h3>
+                <p th:text="${movie.getDescription()}" style="text-align: justify"></p>
+            </div>
+
+            <div id="likes-showcase">
+                <h4 style="text-align: center">
+                    <span>Филмот му се допаднал на </span>
+                    <strong th:text="${likes}" id="movie_likes_count"></strong>
+                    <span> корисници</span>
+                </h4>
+            </div>
+
+            <div class="person-movies-list genres-listing">
+                <h3>Жанрови:</h3>
+                <ul>
+                    <li th:each="genre: ${movie.getGenres()}" th:text="${genre.getGenre().getGenreType()}"></li>
+                </ul>
+            </div>
+            <div class="person-movies-list">
+                <h3>Актери:</h3>
+                <ul>
+                    <li th:each="actor: ${movie.getActors()}"><a th:text="${actor.getPerson().getName() + ' ' + actor.getPerson().getSurname()}" th:href="@{'/persons/{id}' (id=${actor.getPerson().getPersonId()})}" ></a></li>
+                </ul>
+            </div>
+
+        </div>
+    </div>
+
+    <hr>
+    <div style="width: 45%; margin: 25px; float:left; background-color: rgb(200,200,200); padding: 10px; border-radius: 5px">
+        <h2>
+            <span>Бројот на оцени кои филмот ги добил:</span>
+            <span th:text="${movie.getRates().size()}"></span>
+        </h2>
+        <hr>
+        <div th:each="rating: ${movie.getRates()}" style="margin-bottom: 10px; border: 2px solid gray; border-radius: 10px; background-color: lightblue; padding: 10px; border-radius: 10px; min-height: 130px;">
+                <div style="width: 60%; float:left;">
+                    <a th:href="@{'/profiles/{id}' (id=${rating.getUser().getUserId()})}">
+                        <h4 th:text="${'Oд: '+rating.getUser().getName() + ' ' + rating.getUser().getSurname()}"> </h4>
+                    </a>
+                    <p th:text="${rating.getReason()}" style="text-align: justify"></p>
+                </div>
+                <div style="width: 30%; float:right; background-color: darkorange; border-radius: 10px 30px; color: whitesmoke; padding: 10px;">
+                    <h2 style="text-align: center">Оценет:</h2>
+                    <p th:text="${rating.getStarsRated() + ' од 10'}" style="text-align: center"></p>
+                </div>
+        </div>
+    </div>
+    <div style="width: 45%; margin: 25px; float:left; background-color: rgb(200,200,200); padding: 10px; border-radius: 5px">
+        <h2>
+            <span>Лајковите кои филмот ги добил:</span>
+        </h2>
+        <hr>
+        <div th:each="liked: ${movie.getLikes()}" style="margin-bottom: 10px; border: 2px solid gray; border-radius: 10px; background-color: lightblue; padding: 10px; border-radius: 10px; min-height: 60px;">
+            <div style="width: 100%; float:left;">
+                <a th:href="@{'/profiles/{id}' (id=${liked.getUser().getUserId()})}" >
+                    <h3  style="text-align: center">
+                        <span th:text="${liked.getUser().getName() + ' ' + liked.getUser().getSurname()}"></span>
+                        <span style="color: green; font-size: 100%" >✔</span>
+                    </h3>
+                </a>
+            </div>
+        </div>
+    </div>
+</div>
Index: Sources/src/main/resources/templates/moviesAdd.html
===================================================================
--- Sources/src/main/resources/templates/moviesAdd.html	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/resources/templates/moviesAdd.html	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -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: Sources/src/main/resources/templates/moviesList.html
===================================================================
--- Sources/src/main/resources/templates/moviesList.html	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/resources/templates/moviesList.html	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,105 @@
+<div xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.w3.org/1999/xhtml">
+
+    <div style="width: 70%; margin: auto">
+        <div th:replace="fragments/searchBarName"></div><br>
+        <div th:replace="fragments/searchBarGenre"></div>
+    </div>
+
+    <div class="container mb-4">
+        <a  sec:authorize="isAuthenticated()" th:href="@{/movies/add}">Додади нов филм</a>
+    </div>
+
+    <div class="container mb-4">
+        <div class="row" th:each="row: ${movie_rows}" >
+            <div class="col-md-3 elements" th:each="movie: ${row}" >
+                    <div class="card-body card bg-image" th:style="'background:url(' + ${movie.getImageUrl()} + ') no-repeat center #eee;'">
+                        <a class="card-text-center" style="color: white" th:href="@{'/movies/{id}' (id=${movie.getMovieId()})}" >
+                        <h3 class="card-title title" th:text="${movie.getTitle()}"></h3>
+                            <span th:each="genre: ${movie.getGenres()}"  th:text="${genre?.getGenre()?.getGenreType()}" hidden class="card-genre"></span>
+
+                        </a>
+                        <h3 class="card-text bottom" th:text="${'Rated '+movie.getImdbRating()}"></h3>
+                        <th:block sec:authorize="isAuthenticated()">
+                            <a class="bottom-heart btn btn-success button-add-favourite-list" th:movie-id="${movie.getMovieId()}" th:user-id="${user.getUserId()}" th:if="${!likedMovies.contains(movie)}">❤</a>
+                            <a class="bottom-heart btn btn-danger button-remove-favourite-list" th:movie-id="${movie.getMovieId()}" th:user-id="${user.getUserId()}" th:if="${likedMovies.contains(movie)}">💔</a>
+                        </th:block>
+                    </div>
+            </div>
+        </div>
+    </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><a th:text="${movie.getTitle()}" th:href="@{'/movies/{id}' (id=${movie.getMovieId()})}"></a></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="ac: ${movie.getActors()}">
+                                    <a th:href="@{'/persons/{id}' (id=${ac.getPerson().getPersonId()})}" th:text="${ac.getPerson().getName() + ' ' + ac.getPerson().getSurname()}"></a>
+                                </div>
+                            </td>
+                            <td th:if="${movie.getDirector() != null}">
+                                <a th:href="@{'/persons/{id}' (id=${movie.getDirector().getPersonId()})}" th:text="${movie.getDirector().getName() + ' ' + movie.getDirector().getSurname()}"></a>
+                            </td>
+                            <td th:if="${movie.getDirector() == null}">
+                                Филмот нема режисер.
+                            </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-success button-add-favourite-list" th:movie-id="${movie.getMovieId()}" th:user-id="${user.getUserId()}" th:if="${!likedMovies.contains(movie)}">Додади во омилена листа</a>
+                                <a class="btn btn-warning 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-success button-add-grade-movie" th:movie-id="${movie.getMovieId()}">Остави оценка</a>
+                            </td>
+                            <td>
+                                <a class="btn btn-warning" th:href="@{'/movies/{id}/edit' (id=${movie.getMovieId()})}">Измени</a>
+                            </td>
+                            <td>
+                                <a class="btn btn-danger button-delete-movie" th:movie-id="${movie.getMovieId()}">Избриши филм</a>
+                            </td>
+                            </th:block>
+                        </tr>
+                        </tbody>
+                    </table>
+                </div>
+            </div>
+        </div>
+    </div>-->
+
+</div>
Index: Sources/src/main/resources/templates/moviesListPaged.html
===================================================================
--- Sources/src/main/resources/templates/moviesListPaged.html	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/resources/templates/moviesListPaged.html	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,130 @@
+<div xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.w3.org/1999/xhtml">
+    <div style="margin:auto; width: 60%">
+        <div style="width: 30%; margin: auto; height: 100%; margin-bottom: 10px">
+            <a class="btn btn-outline-dark" style="height: 100%; width: 100%; font-size: 125%" id="button_toggle_filters">Прикажи филтрирање</a>
+        </div>
+        <div style="width: 100%; margin: auto; transition: 200ms" id="filters_div" class="invisible-search">
+            <div th:replace="fragments/searchBarName"></div><br>
+            <div th:replace="fragments/searchBarGenre"></div>
+        </div>
+    </div>
+    <div id="paging-section">
+        <div id="inner-paging" class="input-group">
+            <!--
+            <a class="btn btn-danger" id="button-sub" style="float: left; display: block">Previous</a>
+            <a class="btn btn-success" id="button-add" style="float: left; display: block">Next</a>
+            -->
+            <div class="input-group-prepend">
+                <button class="btn btn-danger" id="button-sub" >Previous</button>
+            </div>
+            <form method="get" action="" style="float: left; display: block">
+                <input type="number" class="form-control" min="1" name="page" th:value="${page}" id="pageInput">
+                <button type="submit" id="button-submit-page" class="btn btn-primary">Check page</button>
+            </form>
+
+            <div class="input-group-append">
+                <button class="btn btn-success" id="button-add" >Next</button>
+            </div>
+        </div>
+    </div><br>
+
+    <div class="container mb-4">
+        <a  sec:authorize="isAuthenticated()" th:href="@{/movies/add}" class="btn btn-secondary">Додади нов филм</a>
+    </div>
+
+    <div class="container mb-4">
+        <div class="row" th:each="row: ${movie_rows}" >
+            <div class="col-md-3 elements" th:each="movie: ${row}" >
+                <span th:each="genre: ${movie.getGenres()}"  th:text="${genre?.getGenre()?.getGenreType()}" hidden class="card-genre"></span>
+                    <div class="card-body card bg-image" th:style="'background:url(' + ${movie.getImageUrl()} + ') no-repeat center #eee;'">
+                        <a class="card-text-center" style="color: white" th:href="@{'/movies/{id}' (id=${movie.getMovieId()})}" >
+                        <h3 class="card-title title" th:text="${movie.getTitle()}"></h3>
+                            <span th:each="genre: ${movie.getGenres()}"  th:text="${genre?.getGenre()?.getGenreType()}" hidden class="card-genre"></span>
+                        </a>
+                        <span class="card-text bottom">
+                            <h3 th:text="${'Оценет '+movie.getImdbRating() + '/10'}"></h3>
+                        </span>
+                        <th:block sec:authorize="isAuthenticated()">
+                            <button class="bottom-heart btn btn-success button-add-favourite-list" th:movie-id="${movie.getMovieId()}" th:user-id="${user.getUserId()}" th:if="${!likedMovies.contains(movie)}">❤</button>
+                            <button class="bottom-heart btn btn-danger button-remove-favourite-list" th:movie-id="${movie.getMovieId()}" th:user-id="${user.getUserId()}" th:if="${likedMovies.contains(movie)}">💔</button>
+                        </th:block>
+                    </div>
+            </div>
+        </div>
+    </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><a th:text="${movie.getTitle()}" th:href="@{'/movies/{id}' (id=${movie.getMovieId()})}"></a></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="ac: ${movie.getActors()}">
+                                    <a th:href="@{'/persons/{id}' (id=${ac.getPerson().getPersonId()})}" th:text="${ac.getPerson().getName() + ' ' + ac.getPerson().getSurname()}"></a>
+                                </div>
+                            </td>
+                            <td th:if="${movie.getDirector() != null}">
+                                <a th:href="@{'/persons/{id}' (id=${movie.getDirector().getPersonId()})}" th:text="${movie.getDirector().getName() + ' ' + movie.getDirector().getSurname()}"></a>
+                            </td>
+                            <td th:if="${movie.getDirector() == null}">
+                                Филмот нема режисер.
+                            </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-success button-add-favourite-list" th:movie-id="${movie.getMovieId()}" th:user-id="${user.getUserId()}" th:if="${!likedMovies.contains(movie)}">Додади во омилена листа</a>
+                                <a class="btn btn-warning 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-success button-add-grade-movie" th:movie-id="${movie.getMovieId()}">Остави оценка</a>
+                            </td>
+                            <td>
+                                <a class="btn btn-warning" th:href="@{'/movies/{id}/edit' (id=${movie.getMovieId()})}">Измени</a>
+                            </td>
+                            <td>
+                                <a class="btn btn-danger button-delete-movie" th:movie-id="${movie.getMovieId()}">Избриши филм</a>
+                            </td>
+                            </th:block>
+                        </tr>
+                        </tbody>
+                    </table>
+                </div>
+            </div>
+        </div>
+    </div>-->
+
+</div>
Index: Sources/src/main/resources/templates/personShow.html
===================================================================
--- Sources/src/main/resources/templates/personShow.html	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/resources/templates/personShow.html	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,62 @@
+
+<div xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.w3.org/1999/xhtml" style="width: 70%; margin: auto">
+    <div style="clear: both; margin-bottom: 10px; display:  inline-block">
+        <div style="width: 60%; margin-left: 10px; padding:20px; float:left">
+            <h1 th:text="${person.getName() + ' ' + person.getSurname()}" style="text-align: center; padding:10px; background-color: rgba(64,64,64,0.5); color:white; border-radius: 10px 0px"></h1>
+            <hr>
+            <h3 th:text="${'Роден/а на: ' + person.getDateFormatted()}"></h3>
+            <div style="background-color: rgba(200,200,200,0.5); border-radius: 10px; padding:15px; ">
+                <h3>Краток Опис:</h3>
+                <p th:text="${person.getDescription()}" style="text-align: justify"></p>
+            </div>
+
+            <div th:if="${person.getType().toString().contains('D')}" class="person-movies-list">
+                <h3 >Режисирани филмови:</h3>
+                <hr>
+                <ul>
+                    <li th:each="movie: ${person.getMovies()}"><a th:text="${movie.getTitle()}" th:href="@{'/movies/{id}' (id=${movie.getMovieId()})}" ></a></li>
+                </ul>
+            </div>
+            <div th:if="${person.getType().toString().contains('A')}" class="person-movies-list">
+                <h3 >Се појавува во филмовите:</h3>
+                <hr>
+                <ul>
+                    <li th:each="movie: ${person.getMovieActors()}" ><a th:text="${movie.getMovie().getTitle()}" th:href="@{'/movies/{id}' (id=${movie.getMovie().getMovieId()})}" ></a></li>
+                </ul>
+            </div><br>
+            <ul style="list-style-type: none; width: 100%; margin: auto" id="buttons-person">
+                <li><a class="btn btn-primary" th:href="@{'discussions/all/{id}?type=P' (id=${person.getPersonId()})}" >Прегледај дискусии</a></li>
+                <th:block sec:authorize="isAuthenticated()">
+                    <li><a class="btn btn-secondary button-add-grade-person" th:person-id="${person.getPersonId()}" th:if="${!person.hasGradeFromUser(user)}">Остави оценка</a></li>
+                    <li><a class="btn btn-secondary button-add-grade-person" th:person-id="${person.getPersonId()}" th:if="${person.hasGradeFromUser(user)}">Промени оценка</a></li>
+                    <li><a class="btn btn-warning" th:href="@{'persons/edit/{personId}' (personId = ${person.getPersonId()})}">Промени</a></li>
+                    <li><a class="btn btn-danger button-delete-actor" th:person-id="${person.getPersonId()}">Избриши</a></li>
+                </th:block>
+            </ul>
+        </div>
+        <div style="width: 30%; margin-left: 10px; padding:20px; border-left: 3px solid black; border-radius: 10px; float:right">
+            <img th:src="${person.getImageUrl()}" style="width: 90%; height: auto">
+        </div>
+    </div>
+    <br>
+    <div style="clear:both; display: inline-block; width: 100%; background-color: rgb(200,200,200); padding: 10px; border-radius: 5px">
+        <h2>
+            <span>Бројот на оцени кои личноста ги има добиено:</span>
+            <span th:text="${person.getPersonRates().size()}"></span>
+        </h2>
+        <hr>
+        <div th:each="rating: ${person.getPersonRates()}" style="margin-bottom: 10px; border: 2px solid gray; border-radius: 10px; background-color: lightblue; padding: 10px; border-radius: 10px; min-height: 130px;">
+            <div style="width: 60%; float:left;">
+                <a th:href="@{'/profiles/{id}' (id=${rating.getUser().getUserId()})}">
+                    <h4 th:text="${'Oд: '+rating.getUser().getName() + ' ' + rating.getUser().getSurname()}"> </h4>
+                </a>
+                <p th:text="${rating.getReason()}" style="text-align: justify"></p>
+            </div>
+            <div style="width: 30%; float:right; background-color: darkorange; border-radius: 10px 30px; color: whitesmoke; padding: 10px;">
+                <h2 style="text-align: center">Оценет со :</h2>
+                <p th:text="${rating.getStarsRated() + ' од 10'}" style="text-align: center"></p>
+            </div>
+        </div>
+    </div>
+
+</div>
Index: Sources/src/main/resources/templates/personsAdd.html
===================================================================
--- Sources/src/main/resources/templates/personsAdd.html	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/resources/templates/personsAdd.html	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -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: Sources/src/main/resources/templates/personsList.html
===================================================================
--- Sources/src/main/resources/templates/personsList.html	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/resources/templates/personsList.html	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,68 @@
+<div xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.w3.org/1999/xhtml">
+
+    <div style="width: 70%; margin: auto;">
+        <a sec:authorize="isAuthenticated()" th:href="@{'persons/add'}" class="btn btn-secondary">Додади актер или режисер</a>
+    </div>
+    <div class="container mb-4">
+            <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><a th:href="@{'/persons/{id}' (id=${person.getPersonId()})}" th:text="${person.getName() + ' ' + person.getSurname()}"></a></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-secondary button-add-grade-person" th:person-id="${person.getPersonId()}">Остави оценка</a>
+                                </td>
+                            <td>
+                                <a class="btn btn-warning" th:href="@{'persons/edit/{personId}' (personId = ${person.getPersonId()})}">Промени</a>
+                            </td>
+                            <td>
+                                <a class="btn btn-danger button-delete-actor" th:person-id="${person.getPersonId()}">Избриши</a>
+
+                            </td>
+
+
+                            </th:block>
+
+                        </tr>
+                        </tbody>
+                    </table>
+                </div>
+            </div>
+    </div>
+
+</div>
Index: Sources/src/main/resources/templates/register.html
===================================================================
--- Sources/src/main/resources/templates/register.html	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/resources/templates/register.html	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -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: Sources/src/main/resources/templates/repliesAdd.html
===================================================================
--- Sources/src/main/resources/templates/repliesAdd.html	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/resources/templates/repliesAdd.html	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -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: Sources/src/main/resources/templates/template.html
===================================================================
--- Sources/src/main/resources/templates/template.html	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/resources/templates/template.html	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
+<head>
+    <meta charset="UTF-8"/>
+    <title>weDiscussMovies</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>
+<a href="/movies">
+
+    <section class="jumbotron text-center" style="background: url('/img/cover.jpg') center; background-repeat: no-repeat; background-size: 100% auto; height: 280px; margin-bottom: 0px ">
+        <div class="container" >
+            <h1 class="jumbotron-heading" style="z-index: -1"></h1>
+        </div>
+    </section>
+</a>
+
+<header th:replace="fragments/header"></header>
+<div class="container md-4">
+    <h1 class="danger" th:text="${error?.toString()}"></h1>
+</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: Sources/src/main/resources/templates/usersShow.html
===================================================================
--- Sources/src/main/resources/templates/usersShow.html	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/main/resources/templates/usersShow.html	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,83 @@
+
+<div xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.w3.org/1999/xhtml">
+    <div style="width: 70%; margin: auto">
+        <h1 th:text="${user.getName() + ' ' + user.getSurname()}" style="text-align: center; padding:10px; background-color: rgba(64,64,64,0.5); color:white; border-radius: 10px 0px"></h1>
+        <hr>
+        <div style="width: 80%; margin: auto">
+            <h3>
+                <span>Е-маил:</span>
+                <span th:text="${user.getEmail()}"></span>
+            </h3>
+            <h3>
+                <span>Корисничко име:</span>
+                <span th:text="${user.getUsername()}"></span>
+            </h3>
+        </div>
+    </div>
+    <div style="width: 60%; margin:auto">
+        <div class="user-movies-list genres-listing hidden-class" style="width: 45%;float: left">
+            <h3>Жанрови кои му се допаднале на корисникот:</h3>
+            <ul>
+                <li th:each="genre: ${user.getUserGenres()}" th:text="${genre.getGenre().getGenreType()}"></li>
+            </ul>
+        </div>
+        <div class="user-movies-list genres-listing hidden-class" style="width: 45%;float: left">
+            <h3>Филмови кои му се допаднале на корисникот:</h3>
+            <ul>
+                <div th:each="movie: ${user.getMovieLikes()}">
+                    <a th:href="@{'/movies/{id}' (id=${movie.getMovie().getMovieId()})}">
+                        <li th:text="${movie.getMovie().getTitle()}"></li>
+                    </a>
+                </div>
+            </ul>
+        </div>
+    </div>
+    <div style="width: 60%; margin: auto">
+        <div class="user-movies-list hidden-class" style="width: 45%;float: left">
+            <h3>Актери и Режисери на кои корисникот им дал оцена:</h3>
+            <ul>
+                <li th:each="person: ${user.getPersonRates()}">
+                    <a th:text="${person.getPerson().getName() + ' ' + person.getPerson().getSurname()}" th:href="@{'/persons/{id}' (id=${person.getPerson().getPersonId()})}" class="rate-title"></a>
+                    <hr>
+                    <h4 th:text="${person.getStarsRated() + '/10'}"></h4>
+                    <br>
+                    <p th:text="${person.getReason()}" class="user-text"></p>
+                </li>
+            </ul>
+        </div>
+        <div class="user-movies-list hidden-class" style="width: 45%;float: left">
+            <h3>Филмови на кои корисникот им дал оцена:</h3>
+            <ul>
+                <li th:each="movieRates: ${user.getMovieRates()}">
+                    <a th:text="${movieRates.getMovie().getTitle() }" th:href="@{'/movies/{id}' (id=${movieRates.getMovie().getMovieId()})}" class="rate-title"></a>
+                    <hr>
+                    <h4 th:text="${movieRates.getStarsRated() + '/10'}"></h4>
+                    <br>
+                    <p th:text="${movieRates.getReason()}" class="user-text"></p>
+                </li>
+            </ul>
+        </div>
+    </div>
+    <div style="width: 60%; margin: auto">
+        <div class="user-movies-list hidden-class" style="width: 45%;float: left">
+            <h3>Дискусии од корисникот:</h3>
+            <ul>
+                <li th:each="discussion: ${user.getDiscussions()}">
+                    <a th:text="${discussion.getTitle() }" th:href="@{'/discussions/{id}' (id=${discussion.getDiscussionId()})}" class="rate-title"></a>
+                    <hr>
+                    <p th:text="${discussion.getText()}" class="user-text-small"></p>
+                </li>
+            </ul>
+        </div>
+        <div class="user-movies-list hidden-class" style="width: 45%;float: left">
+            <h3>Реплики од корисникот:</h3>
+            <ul>
+                <li th:each="reply: ${user.getReplies()}">
+                    <a th:text="${reply.getDiscussion().getTitle() }" th:href="@{'/discussions/{id}' (id=${reply.getDiscussion().getDiscussionId()})}" class="rate-title"></a>
+                    <hr>
+                    <p th:text="${reply.getText()}" class="user-text-small"></p>
+                </li>
+            </ul>
+        </div>
+    </div>
+</div>
Index: Sources/src/test/java/com/wediscussmovies/project/WeDiscussMoviesApplicationTests.java
===================================================================
--- Sources/src/test/java/com/wediscussmovies/project/WeDiscussMoviesApplicationTests.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
+++ Sources/src/test/java/com/wediscussmovies/project/WeDiscussMoviesApplicationTests.java	(revision 980eeda285ff3ffb16a3a043cf9c4086a8686f85)
@@ -0,0 +1,13 @@
+package com.wediscussmovies.project;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+@SpringBootTest
+class WeDiscussMoviesApplicationTests {
+
+    @Test
+    void contextLoads() {
+    }
+
+}
