Changes in / [7bc8942:7fafead] in Git
- Files:
-
- 180 added
- 1 deleted
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
README.md
r7bc8942 r7fafead 3 3 <div style="float: left; width: 60%;"> 4 4 5 <img src="/img/logo.png" style="display: block; float:left; height: auto; width: 30%;" align="right" >6 <h4 style="display: block; font-weight: normal; text-align: justify; float: right">Предмет: Бази на податоци 2021/2022/Зимски</h 2><br>5 <img src="/img/logo.png" style="display: block; float:left; height: auto; width: 30%;" align="right" alt="q"> 6 <h4 style="display: block; font-weight: normal; text-align: justify; float: right">Предмет: Бази на податоци 2021/2022/Зимски</h4><br> 7 7 <h4 style="display: block; font-weight: normal; text-align: justify; float: right">Под менторство на вонр. проф. д-р Вангел Ајановски и демонстр. м-р Ненад Анчев</h4><br> 8 8 <h4 style="display: block; font-weight: normal; text-align: justify; float: right">Започнат: Ноември 2021</h4><br><br> … … 23 23 <li>Мартин Николов (193113)</li> 24 24 </ol> 25 </div> -
pom.xml
r7bc8942 r7fafead 42 42 <groupId>org.postgresql</groupId> 43 43 <artifactId>postgresql</artifactId> 44 <scope>runtime</scope>45 44 </dependency> 46 45 <dependency> … … 59 58 <scope>test</scope> 60 59 </dependency> 60 61 61 <dependency> 62 62 <groupId>org.springframework.boot</groupId> 63 63 <artifactId>spring-boot-starter-data-jpa</artifactId> 64 <version>RELEASE</version>65 <scope>compile</scope>66 64 </dependency> 65 <dependency> 66 <groupId>org.springframework.boot</groupId> 67 <artifactId>spring-boot-actuator</artifactId> 68 </dependency> 69 <dependency> 70 <groupId>com.h2database</groupId> 71 <artifactId>h2</artifactId> 72 </dependency> 73 74 75 67 76 </dependencies> 68 77 -
src/main/java/com/wediscussmovies/project/model/Discussion.java
r7bc8942 r7fafead 1 1 package com.wediscussmovies.project.model; 2 2 3 import com.wediscussmovies.project.model.enumerations.DiscussionType; 3 4 import lombok.Data; 4 5 5 6 import javax.persistence.*; 6 7 import java.sql.Date; 8 import java.util.Collection; 7 9 import java.util.List; 10 import java.util.Objects; 8 11 9 12 @Data 10 13 @Entity 11 @Table (name="discussions")14 @Table(name = "discussions", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies") 12 15 public class Discussion { 16 17 @GeneratedValue(strategy = GenerationType.IDENTITY) 13 18 @Id 14 @GeneratedValue 15 private int discussion_id; 19 @Column(name = "discussion_id") 20 private Long id; 21 22 @Enumerated 23 private DiscussionType type; 24 25 private String text; 26 27 private String title; 28 29 private Date date; 30 31 32 33 16 34 17 35 @ManyToOne 18 @Column(name = "movie_id") 36 @JoinColumn(name = "user_id", referencedColumnName = "user_id", nullable = false) 37 private User user; 38 39 @ManyToOne 40 @JoinColumn(name = "movie_id", referencedColumnName = "movie_id") 19 41 private Movie movie; 20 42 21 @ManyToOne ()22 @ Column(name = "person_id")43 @ManyToOne 44 @JoinColumn(name = "person_id", referencedColumnName = "person_id") 23 45 private Person person; 24 46 25 @ManyToOne26 @Column(name = "user_id")27 private User user;28 47 29 @Column(name = "text", length = 1000, nullable = false)30 private String text;31 48 32 @Column(name = "title", length = 1000, nullable = false)33 private String title;34 49 35 @Column(name = "date", nullable = false)36 private Date date;37 50 38 @Column(name = "type", nullable = false) 39 private DiscussionType type; 40 @OneToMany 41 private List<Reply> replies; 51 52 public Discussion(DiscussionType type, String text, String title, Date date, User user, Movie movie, Person person, List<Reply> replies) { 53 this.type = type; 54 this.text = text; 55 this.title = title; 56 this.date = date; 57 this.user = user; 58 this.movie = movie; 59 this.person = person; 60 } 42 61 43 62 public Discussion() { 44 63 } 45 64 46 public Discussion(String title, String text, User user, Movie movie, Date valueOf) {47 this.title = title;48 this.text = text;49 this.user = user;50 this.date = valueOf;51 this.movie = movie;52 this.type = DiscussionType.M;53 }54 55 public Discussion(String title, String text, User user, Person person, Date valueOf) {56 this.title = title;57 this.text = text;58 this.user = user;59 this.date = valueOf;60 this.person = person;61 this.type = DiscussionType.P;62 }63 64 65 65 66 } 66 67 68 /*69 create table discussions(70 discussion_id serial primary key,71 type char(1) not null,72 text varchar(1000) not null,73 title varchar(250) not null,74 date date not null,75 user_id integer not null,76 movie_id integer,77 person_id integer,78 constraint fk_user_created foreign key (user_id) references users(user_id)79 on delete cascade on update cascade,80 constraint ck_type_discussion check( (type = 'M' and movie_id notnull and person_id isnull)81 or (type='P' and person_id notnull and movie_id isnull)),82 constraint fk_discussion_movie foreign key (movie_id) references movies(movie_id)83 on delete cascade on update cascade,84 constraint fk_discussion_person foreign key (person_id) references persons(person_id)85 on delete cascade on update cascade86 );87 88 */ -
src/main/java/com/wediscussmovies/project/model/Genre.java
r7bc8942 r7fafead 1 1 package com.wediscussmovies.project.model; 2 2 3 4 import javax.persistence.*; 5 import java.util.Collection; 3 6 import lombok.Data; 4 7 5 import javax.persistence.*;6 8 9 @Entity 10 @Table(name = "genres", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies") 7 11 @Data 8 @Entity9 @Table(name="genres")10 12 public class Genre { 13 14 @GeneratedValue(strategy = GenerationType.IDENTITY) 11 15 @Id 12 @GeneratedValue 13 @Column(name="genre_id", nullable = false, unique = true) 14 private int genre_id; 16 @Column(name = "genre_id") 17 private Long id; 15 18 16 @Column(name ="genre_type", length = 100, nullable = false, unique = true)17 private String genre _type;19 @Column(name = "genre_type") 20 private String genre; 18 21 19 public Genre(String genre Name) {20 this.genre _type = genreName;22 public Genre(String genre) { 23 this.genre = genre; 21 24 } 22 25 23 26 public Genre() { 24 27 } 28 25 29 } 26 27 /*28 29 create table genres(30 genre_id serial primary key,31 genre_type varchar(100) not null unique32 );33 34 */ -
src/main/java/com/wediscussmovies/project/model/Movie.java
r7bc8942 r7fafead 5 5 import javax.persistence.*; 6 6 import java.sql.Date; 7 import java.util.Collection; 7 8 import java.util.Comparator; 8 9 import java.util.List; 10 import java.util.Objects; 11 12 13 @Entity 14 @Table(name = "movies", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies") 9 15 @Data 10 @Entity11 @Table (name="movies")12 16 public class Movie { 17 18 @GeneratedValue(strategy = GenerationType.IDENTITY) 13 19 @Id 14 @GeneratedValue 15 @Column(name="movie_id", nullable = false) 16 private int movie_id; 20 @Column(name = "movie_id") 21 private Long id; 17 22 18 @Column(name="title", length = 150, unique = true, nullable = false) 19 private String Title; 23 private String title; 20 24 21 @Column(name="description", nullable = false, length = 1000)22 25 private String description; 23 26 24 @Column(name ="image_url", length = 300, nullable = false)25 private String image _url;27 @Column(name = "image_url") 28 private String imageUrl; 26 29 27 @Column(name="airing_date")28 private Date airing_date;29 30 30 @Column(name ="imdb_rating")31 private float imdb_rating;31 @Column(name = "airing_date") 32 private Date aringDate; 32 33 33 @Column(name="director_id") 34 @Column(name = "imdb_rating") 35 private Double imbdRating; 36 37 @ManyToMany 38 private List<Genre> genres; 39 40 @ManyToMany 41 private List<Person> likes; 42 43 @ManyToMany 44 private List<Person> actors; 45 46 47 48 34 49 @ManyToOne 50 @JoinColumn(name = "director_id") 35 51 private Person director; 36 52 37 @ManyToMany(mappedBy = "movie_actors")38 private List<Person> actors;39 53 40 @ManyToMany(mappedBy = "movie_genres") 41 private List<Genre> genres; 54 55 56 42 57 43 58 public boolean isFromGenre(Genre genre){ 44 for(Genre g: genres){ 45 if(g.getGenre_id() == genre.getGenre_id())46 return true;47 }48 return false; 59 60 return genres 61 .stream() 62 .anyMatch(g -> Objects.equals(g.getId(), genre.getId())); 63 49 64 } 50 65 public boolean hasActor(Person p){ 51 for(Person person: actors){ 52 if(person.getPerson_id() == p.getPerson_id()) 53 return true; 54 } 55 return false; 66 return 67 actors 68 .stream() 69 .anyMatch(a -> Objects.equals(a.getPersonId(), p.getPersonId())); 70 71 56 72 } 57 73 58 74 public boolean isDirectedBy(Person p){ 59 return director.getPerson_id() == p.getPerson_id();75 return Objects.equals(director.getPersonId(), p.getPersonId()); 60 76 } 61 77 62 78 public static Comparator<Movie> comparatorTitle = Comparator.comparing(Movie::getTitle); 63 79 80 81 public Movie( String title, String description, String imageUrl, Date aringDate, Double imbdRating,Person director, List<Person> actors, List<Genre> genres) { 82 83 this.title = title; 84 this.description = description; 85 this.imageUrl = imageUrl; 86 this.aringDate = aringDate; 87 this.imbdRating = imbdRating; 88 this.genres = genres; 89 this.likes = likes; 90 this.actors = actors; 91 this.director = director; 92 } 93 64 94 public Movie() { 65 95 } 66 96 67 public Movie(String title, String description, String image_url, Date airing_date, float imdb_rating, Person director, List<Person> actors, List<Genre> genres) { 68 Title = title; 69 this.description = description; 70 this.image_url = image_url; 71 this.airing_date = airing_date; 72 this.imdb_rating = imdb_rating; 73 this.director = director; 74 this.actors = actors; 75 this.genres = genres; 76 } 97 77 98 } 78 79 80 /*81 82 create table movies(83 movie_id serial primary key,84 title varchar(150) not null unique,85 description varchar(1000) not null,86 image_url varchar(300) not null,87 airing_date date not null,88 imdb_rating float,89 director_id integer,90 constraint fk_movie_director foreign key (director_id) references persons(person_id)91 on delete cascade on update cascade,92 constraint ck_person_is_director check( check_constraint_person(director_id) = 'D')93 );94 */ -
src/main/java/com/wediscussmovies/project/model/Person.java
r7bc8942 r7fafead 1 1 package com.wediscussmovies.project.model; 2 2 3 import com.wediscussmovies.project.model.enumerations.PersonType; 3 4 import lombok.Data; 4 5 5 6 import javax.persistence.*; 6 7 import java.sql.Date; 7 import java.util.Co mparator;8 import java.util.Collection; 8 9 import java.util.List; 9 10 11 @Entity 12 @Table(name = "persons", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies") 10 13 @Data 11 @Entity12 @Table(name="persons")13 14 public class Person { 15 @GeneratedValue(strategy = GenerationType.IDENTITY) 14 16 @Id 15 @ GeneratedValue16 private int person_id;17 @Column(name = "person_id") 18 private Long personId; 17 19 18 @Column(name="name", length=100, nullable=false, unique=false)19 20 private String name; 20 21 21 @Column(name="surname", length=100, nullable=false, unique=false)22 22 private String surname; 23 23 24 @ Column(name="type", nullable = false)25 private PersonType personType;24 @Enumerated 25 private PersonType type; 26 26 27 @Column(name ="date_of_birth", nullable=false)28 private Date date_of_birth;27 @Column(name = "date_of_birth") 28 private Date birthDate; 29 29 30 @Column(name ="image_url", length=300, nullable=false, unique=false)31 private String image _url;30 @Column(name = "image_url") 31 private String imageUrl; 32 32 33 @Column(name="description", length=300, nullable=false, unique=false)34 33 private String description; 35 34 36 @ManyToMany37 private List<Movie> acts_in;38 35 39 public Person(String name, String surname, PersonType personType, Date date_of_birth, String image_url, String description) {40 this.name = name;41 this.surname = surname;42 this.personType = personType;43 this.date_of_birth = date_of_birth;44 this.image_url = image_url;45 this.description = description;46 }47 36 48 37 public Person() { 49 38 } 50 39 51 public static Comparator<Person> personComparatorByNameSurname = Comparator.comparing(Person::getName).thenComparing(Person::getSurname); 40 public Person(String name, String surname, PersonType type, Date date_of_birth, String image_url, String description) { 41 this.name = name; 42 this.surname = surname; 43 this.type = type; 44 this.birthDate = date_of_birth; 45 this.imageUrl = image_url; 46 this.description = description; 47 } 52 48 } 53 54 55 /*56 create table persons(57 person_id serial primary key,58 name varchar(100) not null,59 surname varchar(100) not null,60 type char(1) not null,61 date_of_birth date not null,62 image_url varchar(300) not null,63 description varchar(300) not null,64 constraint ck_type check (type ='A' or type='D')65 );66 */ -
src/main/java/com/wediscussmovies/project/model/Reply.java
r7bc8942 r7fafead 7 7 import java.util.Optional; 8 8 9 @Entity 10 @Table(name = "replies", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies") 11 @IdClass(RepliesEntityPK.class) 9 12 @Data 10 @Entity11 @Table(name="replies")12 13 public class Reply { 13 14 @Id 14 @GeneratedValue 15 @Column(name = "discussion_id") 16 private Long discussionId; 17 18 @GeneratedValue(strategy = GenerationType.IDENTITY) 19 @Id 15 20 @Column(name = "reply_id") 16 private int reply_id; 21 private Long replyId; 22 23 private String text; 24 25 private Date date; 17 26 18 27 @ManyToOne 19 @ Column(name = "discussion_id")28 @JoinColumn(name = "discussion_id", referencedColumnName = "discussion_id", nullable = false,insertable = false, updatable = false) 20 29 private Discussion discussion; 21 30 22 31 @ManyToOne 23 @ Column(name = "user_id")32 @JoinColumn(name = "user_id") 24 33 private User user; 25 34 26 @Column(name = "date", nullable = false)27 private Date date;28 35 29 @Column(name= "text", length = 1000, nullable = false) 30 private String text; 36 31 37 32 38 public Reply(Discussion discussion, User user, Date date, String text) { … … 35 41 this.date = date; 36 42 this.text = text; 43 37 44 } 38 } 45 46 public Reply() { 47 48 } 39 49 40 50 41 /* 42 43 create table replies( 44 discussion_id integer, 45 reply_id serial, 46 text varchar(1000) not null, 47 date date not null, 48 user_id integer not null, 49 constraint pk_replies primary key(discussion_id,reply_id), 50 constraint fk_user_create_reply foreign key (user_id) references users(user_id) 51 on delete cascade on update cascade, 52 constraint fk_reply_discussion foreign key (discussion_id) references discussions(discussion_id) 53 on delete cascade on update cascade 54 55 56 ); 57 */ 51 } -
src/main/java/com/wediscussmovies/project/model/User.java
r7bc8942 r7fafead 1 1 package com.wediscussmovies.project.model; 2 2 3 import lombok.Data;4 5 3 import javax.persistence.*; 4 import java.util.Collection; 6 5 import java.util.List; 7 6 8 @Data9 7 @Entity 10 @Table(name ="users")8 @Table(name = "users", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies") 11 9 public class User { 10 @GeneratedValue(strategy = GenerationType.IDENTITY) 12 11 @Id 13 @GeneratedValue 14 @Column(name="user_id", nullable = false) 15 private int user_id; 12 @Column(name = "user_id") 13 private Long userId; 16 14 17 @Column(name="username", length=50, nullable=false, unique=false)18 15 private String username; 19 16 20 @Column(name="name", length=50, nullable=false, unique=false)21 17 private String name; 22 18 23 @Column(name="surname", length=50, nullable=false, unique=false)24 19 private String surname; 25 20 26 @Column(name="email", length=50, nullable=false, unique=false)27 21 private String email; 28 22 29 @Column(name="password", length=100, nullable=false, unique=true)30 23 private String password; 31 24 32 //TODO("RATES_MOVIE") 33 @ManyToMany(mappedBy = "movie_likes") 34 private List<Movie> likes_movie; 25 @ManyToMany 26 private List<Movie> movies; 35 27 36 @ManyToMany(mappedBy = "user_genres") 37 private List<Genre> likes_genres; 28 29 38 30 39 31 public User(String username, String name, String surname, String email, String password) { … … 48 40 } 49 41 } 50 51 52 /*53 create table users(54 user_id serial primary key,55 username varchar(50) not null unique,56 name varchar(50) not null,57 surname varchar(50) not null,58 email varchar(100) not null unique,59 password varchar(30) not null,60 constraint ck_password check(length(password) >= 9)61 );62 */ -
src/main/java/com/wediscussmovies/project/repository/GenreRepository.java
r7bc8942 r7fafead 9 9 @Repository 10 10 public interface GenreRepository extends JpaRepository<Genre, Integer> { 11 public List<Genre> findAllByGenre _typeLike(String genre_type);11 public List<Genre> findAllByGenre(String genre_type); 12 12 } -
src/main/java/com/wediscussmovies/project/repository/PersonRepository.java
r7bc8942 r7fafead 2 2 3 3 import com.wediscussmovies.project.model.Person; 4 import com.wediscussmovies.project.model. PersonType;4 import com.wediscussmovies.project.model.enumerations.PersonType; 5 5 import org.springframework.data.jpa.repository.JpaRepository; 6 6 import org.springframework.data.jpa.repository.Query; -
src/main/java/com/wediscussmovies/project/service/GenreService.java
r7bc8942 r7fafead 2 2 3 3 import com.wediscussmovies.project.model.Genre; 4 import org.springframework.stereotype.Service; 4 5 5 6 import java.util.List; 6 7 import java.util.Optional; 7 8 9 @Service 8 10 public interface GenreService { 9 11 public List<Genre> findAll(); -
src/main/java/com/wediscussmovies/project/service/MovieService.java
r7bc8942 r7fafead 9 9 public List<Movie> listAll(); 10 10 public List<Movie> searchByTitle(String title); 11 public Optional<Movie> findById( Integerid);11 public Optional<Movie> findById(Long id); 12 12 public Movie save(Movie movie); 13 public void deleteById( intid);13 public void deleteById(Long id); 14 14 } -
src/main/java/com/wediscussmovies/project/service/PersonService.java
r7bc8942 r7fafead 7 7 8 8 public interface PersonService { 9 publicList<Person> findAllDirectors();10 publicList<Person> findAllActors();9 List<Person> findAllDirectors(); 10 List<Person> findAllActors(); 11 11 Optional<Person> findById(Integer person_id); 12 12 Optional<Person> findActorById(Integer id); -
src/main/java/com/wediscussmovies/project/service/ReplyService.java
r7bc8942 r7fafead 8 8 public Reply save(Reply r); 9 9 public void delete(Reply r); 10 Optional<Reply> findById(Integer id); 10 Optional<Reply> findById(Long id); 11 11 12 } -
src/main/java/com/wediscussmovies/project/service/impl/GenreServiceImpl.java
r7bc8942 r7fafead 24 24 @Override 25 25 public List<Genre> findAllByType(String genre) { 26 return genreRepository.findAllByGenre _typeLike(genre);26 return genreRepository.findAllByGenre(genre); 27 27 } 28 28 -
src/main/java/com/wediscussmovies/project/service/impl/MovieServiceImpl.java
r7bc8942 r7fafead 23 23 24 24 @Override 25 public Optional<Movie> findById( Integerid) {26 return movieRepository.findById( id);25 public Optional<Movie> findById(Long id) { 26 return movieRepository.findById(1); 27 27 } 28 28 … … 33 33 34 34 @Override 35 public void deleteById( intid) {36 movieRepository.deleteById( id);35 public void deleteById(Long id) { 36 movieRepository.deleteById(0); 37 37 } 38 38 -
src/main/java/com/wediscussmovies/project/service/impl/PersonServiceImpl.java
r7bc8942 r7fafead 2 2 3 3 import com.wediscussmovies.project.model.Person; 4 import com.wediscussmovies.project.model. PersonType;4 import com.wediscussmovies.project.model.enumerations.PersonType; 5 5 import com.wediscussmovies.project.repository.PersonRepository; 6 6 import com.wediscussmovies.project.service.PersonService; … … 13 13 public class PersonServiceImpl implements PersonService { 14 14 private final PersonRepository personRepository; 15 15 16 16 17 public PersonServiceImpl(PersonRepository personRepository) { -
src/main/java/com/wediscussmovies/project/service/impl/ReplyServiceImpl.java
r7bc8942 r7fafead 17 17 18 18 @Override 19 public Optional<Reply> findById( Integerid) {20 return replyRepository.findById( id);19 public Optional<Reply> findById(Long id) { 20 return replyRepository.findById(1); 21 21 } 22 22 -
src/main/java/com/wediscussmovies/project/web/controller/DiscussionsController.java
r7bc8942 r7fafead 2 2 3 3 import com.wediscussmovies.project.model.*; 4 import com.wediscussmovies.project.model.enumerations.DiscussionType; 4 5 import com.wediscussmovies.project.service.DiscussionService; 5 6 import com.wediscussmovies.project.service.MovieService; … … 13 14 import java.sql.Date; 14 15 import java.time.LocalDate; 16 import java.util.ArrayList; 15 17 import java.util.List; 16 18 import java.util.Optional; … … 101 103 return "redirect:/login"; 102 104 } 103 Integer movie_id = (Integer) request.getSession().getAttribute("movieId");105 Long movie_id = (Long) request.getSession().getAttribute("movieId"); 104 106 request.getSession().setAttribute("movieId", null); 105 107 Optional<Movie> movieOp = movieService.findById(movie_id); 106 108 if(movieOp.isEmpty()) 107 109 return "redirect:/movies"; 108 Discussion discussion = new Discussion( title, text, user, movieOp.get(), Date.valueOf(LocalDate.now()));110 Discussion discussion = new Discussion(DiscussionType.M,text, title, Date.valueOf(LocalDate.now()),user,movieOp.get(),null,new ArrayList<>()); 109 111 discussionService.save(discussion); 110 112 return "redirect:/discussions"; … … 135 137 if(personOp.isEmpty()) 136 138 return "redirect:/discussions"; 137 Discussion discussion = new Discussion( title, text, user, personOp.get(), Date.valueOf(LocalDate.now()));139 Discussion discussion = new Discussion(DiscussionType.P,title, text,Date.valueOf(LocalDate.now()),user,null,personOp.get(),new ArrayList<>()); 138 140 discussionService.save(discussion); 139 141 return "redirect:/discussions"; -
src/main/java/com/wediscussmovies/project/web/controller/MovieController.java
r7bc8942 r7fafead 1 1 package com.wediscussmovies.project.web.controller; 2 2 3 import com.wediscussmovies.project.exception.MovieIdNotFoundException; 3 4 import com.wediscussmovies.project.model.Genre; 4 5 import com.wediscussmovies.project.model.Movie; 5 6 import com.wediscussmovies.project.model.Person; 6 import com.wediscussmovies.project.model.exception.MovieIdNotFoundException;7 7 import com.wediscussmovies.project.service.GenreService; 8 8 import com.wediscussmovies.project.service.MovieService; … … 59 59 60 60 @PostMapping("/{id}/delete") 61 public String addMovie(@PathVariable intid){61 public String addMovie(@PathVariable Long id){ 62 62 Optional<Movie> movie = movieService.findById(id); 63 63 if(movie.isPresent()){ 64 movieService.deleteById(movie.get().get Movie_id());64 movieService.deleteById(movie.get().getId()); 65 65 } 66 66 return "redirect:/movies"; … … 72 72 @RequestParam String image_url, 73 73 @RequestParam Date airing_date, 74 @RequestParam Floatrating,74 @RequestParam Double rating, 75 75 @RequestParam Integer director_id, 76 76 @RequestParam List<Integer> actors, … … 131 131 @PostMapping("/edit/confirm") 132 132 public String editMoviePost( 133 @RequestParam Integermovie_id,133 @RequestParam Long movie_id, 134 134 @RequestParam String title, 135 135 @RequestParam String description, 136 136 @RequestParam String image_url, 137 137 @RequestParam Date airing_date, 138 @RequestParam Floatrating,138 @RequestParam Double rating, 139 139 @RequestParam Integer director_id, 140 140 @RequestParam List<Integer> actors, … … 203 203 movie.setTitle(title); 204 204 movie.setDescription(description); 205 movie.setA iring_date(airing_date);206 movie.setImage _url(image_url);207 movie.setIm db_rating(rating);205 movie.setAringDate(airing_date); 206 movie.setImageUrl(image_url); 207 movie.setImbdRating(rating); 208 208 209 209 movieService.save(movie); … … 213 213 214 214 @GetMapping("/{id}/edit") 215 public String editMovie(@PathVariable Integerid, Model model){215 public String editMovie(@PathVariable Long id, Model model){ 216 216 Movie movie = movieService.findById(id).orElseThrow(() -> new MovieIdNotFoundException(id)); 217 217 model.addAttribute("directors", personService.findAllDirectors()); -
src/main/java/com/wediscussmovies/project/web/controller/PersonsController.java
r7bc8942 r7fafead 2 2 3 3 import com.wediscussmovies.project.model.Person; 4 import com.wediscussmovies.project.model. PersonType;4 import com.wediscussmovies.project.model.enumerations.PersonType; 5 5 import com.wediscussmovies.project.service.PersonService; 6 6 import org.springframework.stereotype.Controller; … … 38 38 boolean add = true; 39 39 for(Person a: actorsByName){ 40 if(a.getPerson _id() == p.getPerson_id()){40 if(a.getPersonId() == p.getPersonId()){ 41 41 add=false; 42 42 break; … … 50 50 actors = actorsByName; 51 51 } 52 actors.sort(Person.personComparatorByNameSurname);52 // actors.sort(Person.personComparatorByNameSurname); 53 53 model.addAttribute("actors", actors); 54 54 model.addAttribute("contentTemplate", "actorsList"); … … 71 71 boolean add = true; 72 72 for(Person a: directorsByName){ 73 if(a.getPerson _id() == p.getPerson_id()){73 if(a.getPersonId() == p.getPersonId()){ 74 74 add=false; 75 75 break; … … 83 83 directors = directorsByName; 84 84 } 85 directors.sort(Person.personComparatorByNameSurname);85 // directors.sort(Person.personComparatorByNameSurname); 86 86 model.addAttribute("directors", directors); 87 87 model.addAttribute("contentTemplate", "directorsList"); -
src/main/java/com/wediscussmovies/project/web/controller/ReplyController.java
r7bc8942 r7fafead 19 19 20 20 @GetMapping("/edit/{id}") 21 public String getReplyEdit(@PathVariable Integerid, Model model){21 public String getReplyEdit(@PathVariable Long id, Model model){ 22 22 Optional<Reply> reply = replyService.findById(id); 23 23 if(reply.isEmpty()) … … 29 29 30 30 @PostMapping("/edit/confirm/{id}") 31 public String getReplyEdit(@PathVariable Integerid, @RequestParam String text){31 public String getReplyEdit(@PathVariable Long id, @RequestParam String text){ 32 32 Optional<Reply> replyOp = replyService.findById(id); 33 33 if(replyOp.isEmpty()) … … 37 37 reply.setText(text); 38 38 replyService.save(reply); 39 return "redirect:/discussions/"+reply.getDiscussion().get Discussion_id();39 return "redirect:/discussions/"+reply.getDiscussion().getId(); 40 40 } 41 41 } -
src/main/resources/application.properties
r7bc8942 r7fafead 1 1 spring.profiles.active=prod
Note:
See TracChangeset
for help on using the changeset viewer.