Index: src/main/java/com/wediscussmovies/project/WeDiscussMoviesApplication.java
===================================================================
--- src/main/java/com/wediscussmovies/project/WeDiscussMoviesApplication.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
+++ src/main/java/com/wediscussmovies/project/WeDiscussMoviesApplication.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
@@ -0,0 +1,13 @@
+package com.wediscussmovies.project;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class WeDiscussMoviesApplication {
+
+    public static void main(String[] args) {
+        SpringApplication.run(WeDiscussMoviesApplication.class, args);
+    }
+
+}
Index: src/main/java/com/wediscussmovies/project/model/Discussion.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/Discussion.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
+++ src/main/java/com/wediscussmovies/project/model/Discussion.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
@@ -0,0 +1,59 @@
+package com.wediscussmovies.project.model;
+
+import javax.persistence.*;
+import java.sql.Date;
+import java.util.List;
+
+@Entity
+public class Discussion {
+    @Id
+    @GeneratedValue
+    private int discussion_id;
+
+    @ManyToOne
+    @Column(name = "movie_id")
+    private Movie movie;
+
+    @ManyToOne()
+    @Column(name = "person_id")
+    private Person person;
+
+    @ManyToOne
+    @Column(name = "user_id")
+    private User user;
+
+    @Column(name = "text", length = 1000, nullable = false)
+    private String text;
+
+    @Column(name = "title", length = 1000, nullable = false)
+    private String title;
+
+    @Column(name = "date", nullable = false)
+    private Date date;
+
+    @OneToMany
+    private List<Reply> replies;
+}
+
+
+/*
+    create table discussions(
+        discussion_id serial primary key,
+        type char(1) not null,
+        text varchar(1000) not null,
+        title varchar(250) not null,
+        date date not null,
+        user_id integer not null,
+        movie_id integer,
+        person_id integer,
+        constraint fk_user_created foreign key (user_id) references users(user_id)
+        on delete cascade on update cascade,
+        constraint ck_type_discussion check( (type = 'M' and movie_id notnull and person_id isnull)
+        or (type='P' and person_id  notnull and movie_id isnull)),
+        constraint fk_discussion_movie foreign key (movie_id) references movies(movie_id)
+        on delete cascade on update cascade,
+        constraint fk_discussion_person foreign key (person_id) references persons(person_id)
+        on delete cascade on update cascade
+    );
+
+ */
Index: src/main/java/com/wediscussmovies/project/model/Genre.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/Genre.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
+++ src/main/java/com/wediscussmovies/project/model/Genre.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
@@ -0,0 +1,26 @@
+package com.wediscussmovies.project.model;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+@Entity(name="genres")
+public class Genre {
+    @Id
+    @GeneratedValue
+    @Column(name="genre_id", nullable = false, unique = true)
+    private int genre_id;
+
+    @Column(name="genre_type", length = 100, nullable = false, unique = true)
+    private String genre_type;
+}
+
+/*
+
+create table genres(
+    genre_id serial primary key,
+    genre_type varchar(100) not null unique
+);
+
+ */
Index: src/main/java/com/wediscussmovies/project/model/Movie.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/Movie.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
+++ src/main/java/com/wediscussmovies/project/model/Movie.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
@@ -0,0 +1,55 @@
+package com.wediscussmovies.project.model;
+
+import javax.persistence.*;
+import java.sql.Date;
+import java.util.List;
+
+@Entity(name="movies")
+public class Movie {
+    @Id
+    @GeneratedValue
+    @Column(name="movie_id", nullable = false)
+    private int movie_id;
+
+    @Column(name="title", length = 150, unique = true, nullable = false)
+    private String Title;
+
+    @Column(name="description", nullable = false, length = 1000)
+    private String description;
+
+    @Column(name="image_url", length = 300, nullable = false)
+    private String image_url;
+
+    @Column(name="airing_date")
+    private Date airing_date;
+
+    @Column(name="imdb_rating")
+    private float imdb_rating;
+
+    @Column(name="director_id")
+    @ManyToOne
+    private Person director;
+
+    @ManyToMany(mappedBy = "movie_actors")
+    private List<Person> actors;
+
+    @ManyToMany(mappedBy = "movie_genres")
+    private List<Genre> genres;
+}
+
+
+/*
+
+    create table movies(
+        movie_id serial primary key,
+        title varchar(150) not null unique,
+        description varchar(1000) not null,
+        image_url varchar(300) not null,
+        airing_date date not null,
+        imdb_rating float,
+        director_id integer,
+        constraint fk_movie_director foreign key (director_id) references persons(person_id)
+        on delete cascade on update cascade,
+        constraint ck_person_is_director check( check_constraint_person(director_id) = 'D')
+    );
+ */
Index: src/main/java/com/wediscussmovies/project/model/Person.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/Person.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
+++ src/main/java/com/wediscussmovies/project/model/Person.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
@@ -0,0 +1,47 @@
+package com.wediscussmovies.project.model;
+
+import javax.persistence.*;
+import java.sql.Date;
+import java.util.List;
+
+@Entity(name="persons")
+public class Person {
+    @Id
+    @GeneratedValue
+    private int person_id;
+
+    @Column(name="name", length=100, nullable=false, unique=false)
+    private String name;
+
+    @Column(name="surname", length=100, nullable=false, unique=false)
+    private String surname;
+
+    @Column(name="type", nullable = false)
+    private PersonType personType;
+
+    @Column(name="date_of_birth", nullable=false)
+    private Date date_of_birth;
+
+    @Column(name="image_url", length=300, nullable=false, unique=false)
+    private String image_url;
+
+    @Column(name="description", length=300, nullable=false, unique=false)
+    private String description;
+
+    @ManyToMany
+    private List<Movie> acts_in;
+}
+
+
+/*
+        create table persons(
+        person_id serial primary key,
+        name varchar(100) not null,
+        surname varchar(100) not null,
+        type char(1) not null,
+        date_of_birth date not null,
+        image_url varchar(300) not null,
+        description varchar(300) not null,
+        constraint ck_type check (type ='A' or type='D')
+    );
+ */
Index: src/main/java/com/wediscussmovies/project/model/PersonType.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/PersonType.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
+++ src/main/java/com/wediscussmovies/project/model/PersonType.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
@@ -0,0 +1,5 @@
+package com.wediscussmovies.project.model;
+
+public enum PersonType {
+    A, D
+}
Index: src/main/java/com/wediscussmovies/project/model/Reply.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/Reply.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
+++ src/main/java/com/wediscussmovies/project/model/Reply.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
@@ -0,0 +1,45 @@
+package com.wediscussmovies.project.model;
+
+import javax.persistence.*;
+import java.sql.Date;
+
+@Entity(name="replies")
+public class Reply {
+    @Id
+    @GeneratedValue
+    @Column(name = "reply_id")
+    private int reply_id;
+
+    @ManyToOne
+    @Column(name = "discussion_id")
+    private Discussion discussion;
+
+    @ManyToOne
+    @Column(name = "user_id")
+    private User user;
+
+    @Column(name = "date", nullable = false)
+    private Date date;
+
+    @Column(name= "text", length = 1000, nullable = false)
+    private String text;
+}
+
+
+/*
+
+    create table replies(
+        discussion_id integer,
+        reply_id serial,
+        text varchar(1000) not null,
+        date date not null,
+        user_id integer not null,
+        constraint pk_replies primary key(discussion_id,reply_id),
+        constraint fk_user_create_reply foreign key (user_id) references users(user_id)
+        on delete cascade on update cascade,
+        constraint fk_reply_discussion foreign key (discussion_id) references discussions(discussion_id)
+        on delete cascade on update cascade
+
+
+    );
+ */
Index: src/main/java/com/wediscussmovies/project/model/User.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/User.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
+++ src/main/java/com/wediscussmovies/project/model/User.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
@@ -0,0 +1,48 @@
+package com.wediscussmovies.project.model;
+
+import javax.persistence.*;
+import java.util.List;
+
+@Entity(name="users")
+public class User {
+    @Id
+    @GeneratedValue
+    @Column(name="user_id", nullable = false)
+    private int user_id;
+
+    @Column(name="username", length=50, nullable=false, unique=false)
+    private String username;
+
+    @Column(name="name", length=50, nullable=false, unique=false)
+    private String name;
+
+    @Column(name="surname", length=50, nullable=false, unique=false)
+    private String surname;
+
+    @Column(name="email", length=50, nullable=false, unique=false)
+    private String email;
+
+    @Column(name="password", length=100, nullable=false, unique=true)
+    private String password;
+
+    //TODO("RATES_MOVIE")
+    @ManyToMany(mappedBy = "movie_likes")
+    private List<Movie> likes_movie;
+
+    @ManyToMany(mappedBy = "user_genres")
+    private List<Genre> likes_genres;
+
+}
+
+
+/*
+    create table users(
+      user_id serial primary key,
+      username varchar(50) not null unique,
+      name varchar(50) not null,
+      surname varchar(50) not null,
+      email varchar(100) not null unique,
+      password varchar(30) not null,
+      constraint ck_password check(length(password) >= 9)
+    );
+ */
Index: src/main/java/com/wediscussmovies/project/repository/DiscussionRepository.java
===================================================================
--- src/main/java/com/wediscussmovies/project/repository/DiscussionRepository.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
+++ src/main/java/com/wediscussmovies/project/repository/DiscussionRepository.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
@@ -0,0 +1,9 @@
+package com.wediscussmovies.project.repository;
+
+import com.wediscussmovies.project.model.Discussion;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface DiscussionRepository extends JpaRepository<Discussion, Integer> {
+}
Index: src/main/java/com/wediscussmovies/project/repository/GenreRepository.java
===================================================================
--- src/main/java/com/wediscussmovies/project/repository/GenreRepository.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
+++ src/main/java/com/wediscussmovies/project/repository/GenreRepository.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
@@ -0,0 +1,9 @@
+package com.wediscussmovies.project.repository;
+
+import com.wediscussmovies.project.model.Genre;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface GenreRepository extends JpaRepository<Genre, Integer> {
+}
Index: src/main/java/com/wediscussmovies/project/repository/MovieRepository.java
===================================================================
--- src/main/java/com/wediscussmovies/project/repository/MovieRepository.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
+++ src/main/java/com/wediscussmovies/project/repository/MovieRepository.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
@@ -0,0 +1,12 @@
+package com.wediscussmovies.project.repository;
+
+import com.wediscussmovies.project.model.Movie;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface MovieRepository extends JpaRepository<Movie, Integer> {
+    public List<Movie> findAllByTitleLike(String Title);
+}
Index: src/main/java/com/wediscussmovies/project/repository/PersonRepository.java
===================================================================
--- src/main/java/com/wediscussmovies/project/repository/PersonRepository.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
+++ src/main/java/com/wediscussmovies/project/repository/PersonRepository.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
@@ -0,0 +1,9 @@
+package com.wediscussmovies.project.repository;
+
+import com.wediscussmovies.project.model.Person;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface PersonRepository extends JpaRepository<Person, Integer> {
+}
Index: src/main/java/com/wediscussmovies/project/repository/ReplyRepository.java
===================================================================
--- src/main/java/com/wediscussmovies/project/repository/ReplyRepository.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
+++ src/main/java/com/wediscussmovies/project/repository/ReplyRepository.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
@@ -0,0 +1,9 @@
+package com.wediscussmovies.project.repository;
+
+import com.wediscussmovies.project.model.Reply;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface ReplyRepository extends JpaRepository<Reply, Integer> {
+}
Index: src/main/java/com/wediscussmovies/project/repository/UserRepository.java
===================================================================
--- src/main/java/com/wediscussmovies/project/repository/UserRepository.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
+++ src/main/java/com/wediscussmovies/project/repository/UserRepository.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
@@ -0,0 +1,9 @@
+package com.wediscussmovies.project.repository;
+
+import com.wediscussmovies.project.model.User;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface UserRepository extends JpaRepository<User, Integer> {
+}
Index: src/main/java/com/wediscussmovies/project/service/DiscussionService.java
===================================================================
--- src/main/java/com/wediscussmovies/project/service/DiscussionService.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
+++ src/main/java/com/wediscussmovies/project/service/DiscussionService.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
@@ -0,0 +1,4 @@
+package com.wediscussmovies.project.service;
+
+public interface DiscussionService {
+}
Index: src/main/java/com/wediscussmovies/project/service/GenreService.java
===================================================================
--- src/main/java/com/wediscussmovies/project/service/GenreService.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
+++ src/main/java/com/wediscussmovies/project/service/GenreService.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
@@ -0,0 +1,4 @@
+package com.wediscussmovies.project.service;
+
+public interface GenreService {
+}
Index: src/main/java/com/wediscussmovies/project/service/MovieService.java
===================================================================
--- src/main/java/com/wediscussmovies/project/service/MovieService.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
+++ src/main/java/com/wediscussmovies/project/service/MovieService.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
@@ -0,0 +1,10 @@
+package com.wediscussmovies.project.service;
+
+import com.wediscussmovies.project.model.Movie;
+
+import java.util.List;
+
+public interface MovieService {
+    public List<Movie> listAll();
+    public List<Movie> searchByTitle(String title);
+}
Index: src/main/java/com/wediscussmovies/project/service/PersonService.java
===================================================================
--- src/main/java/com/wediscussmovies/project/service/PersonService.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
+++ src/main/java/com/wediscussmovies/project/service/PersonService.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
@@ -0,0 +1,4 @@
+package com.wediscussmovies.project.service;
+
+public interface PersonService {
+}
Index: src/main/java/com/wediscussmovies/project/service/ReplyService.java
===================================================================
--- src/main/java/com/wediscussmovies/project/service/ReplyService.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
+++ src/main/java/com/wediscussmovies/project/service/ReplyService.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
@@ -0,0 +1,4 @@
+package com.wediscussmovies.project.service;
+
+public interface ReplyService {
+}
Index: src/main/java/com/wediscussmovies/project/service/UserService.java
===================================================================
--- src/main/java/com/wediscussmovies/project/service/UserService.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
+++ src/main/java/com/wediscussmovies/project/service/UserService.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
@@ -0,0 +1,4 @@
+package com.wediscussmovies.project.service;
+
+public interface UserService {
+}
Index: src/main/java/com/wediscussmovies/project/service/impl/MovieServiceImpl.java
===================================================================
--- src/main/java/com/wediscussmovies/project/service/impl/MovieServiceImpl.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
+++ src/main/java/com/wediscussmovies/project/service/impl/MovieServiceImpl.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
@@ -0,0 +1,27 @@
+package com.wediscussmovies.project.service.impl;
+
+import com.wediscussmovies.project.model.Movie;
+import com.wediscussmovies.project.repository.MovieRepository;
+import com.wediscussmovies.project.service.MovieService;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class MovieServiceImpl implements MovieService {
+    private final MovieRepository movieRepository;
+
+    public MovieServiceImpl(MovieRepository movieRepository) {
+        this.movieRepository = movieRepository;
+    }
+
+    @Override
+    public List<Movie> listAll() {
+        return movieRepository.findAll();
+    }
+
+    @Override
+    public List<Movie> searchByTitle(String title) {
+        return movieRepository.findAllByTitleLike("%"+title+"%");
+    }
+}
Index: src/main/java/com/wediscussmovies/project/web/HomeController.java
===================================================================
--- src/main/java/com/wediscussmovies/project/web/HomeController.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
+++ src/main/java/com/wediscussmovies/project/web/HomeController.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
@@ -0,0 +1,7 @@
+package com.wediscussmovies.project.web;
+
+import org.springframework.stereotype.Controller;
+
+@Controller
+public class HomeController {
+}
Index: src/main/java/com/wediscussmovies/project/web/controller/DiscussionsController.java
===================================================================
--- src/main/java/com/wediscussmovies/project/web/controller/DiscussionsController.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
+++ src/main/java/com/wediscussmovies/project/web/controller/DiscussionsController.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
@@ -0,0 +1,7 @@
+package com.wediscussmovies.project.web.controller;
+
+import org.springframework.stereotype.Controller;
+
+@Controller
+public class DiscussionsController {
+}
Index: src/main/java/com/wediscussmovies/project/web/controller/MovieController.java
===================================================================
--- src/main/java/com/wediscussmovies/project/web/controller/MovieController.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
+++ src/main/java/com/wediscussmovies/project/web/controller/MovieController.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
@@ -0,0 +1,36 @@
+package com.wediscussmovies.project.web.controller;
+
+import com.wediscussmovies.project.model.Movie;
+import com.wediscussmovies.project.service.MovieService;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.util.List;
+
+@Controller
+@RequestMapping("/movies")
+public class MovieController {
+    private final MovieService movieService;
+
+    public MovieController(MovieService movieService) {
+        this.movieService = movieService;
+    }
+
+    @GetMapping
+    public String getMovies(@RequestParam(required = false) String titleQuery, Model model){
+        List<Movie> movies;
+        if(titleQuery == null || titleQuery.isEmpty()) {
+            movies = movieService.listAll();
+        }
+        else{
+            movies = movieService.searchByTitle(titleQuery);
+        }
+        model.addAttribute("movies", movies);
+        model.addAttribute("contentTemplate", "moviesList");
+        return "template";
+    }
+
+}
Index: src/main/java/com/wediscussmovies/project/web/controller/UserController.java
===================================================================
--- src/main/java/com/wediscussmovies/project/web/controller/UserController.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
+++ src/main/java/com/wediscussmovies/project/web/controller/UserController.java	(revision 6e7b4721e1c9f389c67f55f48aab976c7eb4e7a9)
@@ -0,0 +1,7 @@
+package com.wediscussmovies.project.web.controller;
+
+import org.springframework.stereotype.Controller;
+
+@Controller
+public class UserController {
+}
