Ignore:
Timestamp:
01/18/22 17:18:17 (3 years ago)
Author:
Test <matonikolov77@…>
Branches:
main
Children:
e0ef1b1
Parents:
7fafead
Message:

Model-database resolved bugs for mapping

Location:
src/main/java/com/wediscussmovies/project/service
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/com/wediscussmovies/project/service/DiscussionService.java

    r7fafead r3ded84d  
    11package com.wediscussmovies.project.service;
    22
    3 import com.wediscussmovies.project.model.Discussion;
     3import com.wediscussmovies.project.model.*;
    44
    55import java.util.List;
  • src/main/java/com/wediscussmovies/project/service/GenreService.java

    r7fafead r3ded84d  
    11package com.wediscussmovies.project.service;
    22
    3 import com.wediscussmovies.project.model.Genre;
     3import com.wediscussmovies.project.model.*;
    44import org.springframework.stereotype.Service;
    55
  • src/main/java/com/wediscussmovies/project/service/MovieService.java

    r7fafead r3ded84d  
    11package com.wediscussmovies.project.service;
    22
    3 import com.wediscussmovies.project.model.Movie;
     3import com.wediscussmovies.project.model.*;
    44
    55import java.util.List;
     
    99    public List<Movie> listAll();
    1010    public List<Movie> searchByTitle(String title);
    11     public Optional<Movie> findById(Long id);
     11    public Optional<Movie> findById(Integer id);
    1212    public Movie save(Movie movie);
    13     public void deleteById(Long id);
     13    public void deleteById(Integer id);
    1414}
  • src/main/java/com/wediscussmovies/project/service/PersonService.java

    r7fafead r3ded84d  
    11package com.wediscussmovies.project.service;
    22
    3 import com.wediscussmovies.project.model.Person;
     3import com.wediscussmovies.project.model.*;
    44
    55import java.util.List;
  • src/main/java/com/wediscussmovies/project/service/UserService.java

    r7fafead r3ded84d  
    11package com.wediscussmovies.project.service;
    22
    3 import com.wediscussmovies.project.model.User;
     3import com.wediscussmovies.project.model.*;
    44
    55import javax.servlet.http.HttpServletRequest;
  • src/main/java/com/wediscussmovies/project/service/impl/DiscussionServiceImpl.java

    r7fafead r3ded84d  
    11package com.wediscussmovies.project.service.impl;
    22
    3 import com.wediscussmovies.project.model.Discussion;
     3import com.wediscussmovies.project.model.*;
    44import com.wediscussmovies.project.repository.DiscussionRepository;
    55import com.wediscussmovies.project.service.DiscussionService;
  • src/main/java/com/wediscussmovies/project/service/impl/GenreServiceImpl.java

    r7fafead r3ded84d  
    11package com.wediscussmovies.project.service.impl;
    22
    3 import com.wediscussmovies.project.model.Genre;
     3import com.wediscussmovies.project.model.*;
    44import com.wediscussmovies.project.repository.GenreRepository;
    55import com.wediscussmovies.project.service.GenreService;
     
    2424    @Override
    2525    public List<Genre> findAllByType(String genre) {
    26         return genreRepository.findAllByGenre(genre);
     26        return genreRepository.findAllByGenreType(genre);
    2727    }
    2828
    2929    @Override
    3030    public Genre save(String genreName) {
    31         Genre genre = new Genre(genreName);
     31       Genre genre = new Genre(genreName);
    3232        return genreRepository.save(genre);
    3333    }
  • src/main/java/com/wediscussmovies/project/service/impl/MovieServiceImpl.java

    r7fafead r3ded84d  
    11package com.wediscussmovies.project.service.impl;
    22
    3 import com.wediscussmovies.project.model.Movie;
     3import com.wediscussmovies.project.model.*;
    44import com.wediscussmovies.project.repository.MovieRepository;
    55import com.wediscussmovies.project.service.MovieService;
     
    2323
    2424    @Override
    25     public Optional<Movie> findById(Long id) {
     25    public Optional<Movie> findById(Integer id) {
    2626        return movieRepository.findById(1);
    2727    }
     
    3333
    3434    @Override
    35     public void deleteById(Long id) {
    36         movieRepository.deleteById(0);
     35    public void deleteById(Integer id) {
     36        movieRepository.deleteById(id);
    3737    }
    3838
  • src/main/java/com/wediscussmovies/project/service/impl/PersonServiceImpl.java

    r7fafead r3ded84d  
    11package com.wediscussmovies.project.service.impl;
    22
    3 import com.wediscussmovies.project.model.Person;
     3import com.wediscussmovies.project.model.*;
    44import com.wediscussmovies.project.model.enumerations.PersonType;
    55import com.wediscussmovies.project.repository.PersonRepository;
     
    2121    @Override
    2222    public List<Person> findAllDirectors() {
    23         return personRepository.findAllByPersonType(PersonType.D);
     23        return personRepository.findAllByType('D');
    2424    }
    2525
    2626    @Override
    2727    public Optional<Person> findActorById(Integer id) {
    28         return personRepository.findPersonByPerson_idAndPersonType(id, PersonType.A);
     28        return personRepository.findPersonByPersonIdAndType(id, 'A');
    2929    }
    3030
     
    3636    @Override
    3737    public Optional<Person> findDirectorById(Integer id) {
    38         return personRepository.findPersonByPerson_idAndPersonType(id, PersonType.D);
     38        return personRepository.findPersonByPersonIdAndType(id, 'D');
    3939    }
    4040
    4141    @Override
    4242    public List<Person> findAllActors() {
    43         return personRepository.findAllByPersonType(PersonType.A);
     43        return personRepository.findAllByType('A');
    4444    }
    4545
     
    5454    @Override
    5555    public List<Person> findActorsByNameLike(String name) {
    56         return personRepository.findAllByPersonTypeAndNameLike(PersonType.A, name);
     56        return personRepository.findAllByTypeAndNameLike('A', name);
    5757    }
    5858
    5959    @Override
    6060    public List<Person> findActorsBySurnameLike(String surname) {
    61         return personRepository.findAllByPersonTypeAndSurnameLike(PersonType.A, surname);
     61        return personRepository.findAllByTypeAndSurnameLike('A', surname);
    6262    }
    6363
    6464    @Override
    6565    public List<Person> findDirectorsByNameLike(String name) {
    66         return personRepository.findAllByPersonTypeAndNameLike(PersonType.D, name);
     66        return personRepository.findAllByTypeAndNameLike('D', name);
    6767    }
    6868
    6969    @Override
    7070    public List<Person> findDirectorsBySurnameLike(String surname) {
    71         return personRepository.findAllByPersonTypeAndSurnameLike(PersonType.D, surname);
     71        return personRepository.findAllByTypeAndSurnameLike('D', surname);
    7272    }
    7373}
  • src/main/java/com/wediscussmovies/project/service/impl/ReplyServiceImpl.java

    r7fafead r3ded84d  
    11package com.wediscussmovies.project.service.impl;
    22
    3 import com.wediscussmovies.project.model.Reply;
     3import com.wediscussmovies.project.model.*;
    44import com.wediscussmovies.project.repository.ReplyRepository;
    55import com.wediscussmovies.project.service.ReplyService;
  • src/main/java/com/wediscussmovies/project/service/impl/UserServiceImpl.java

    r7fafead r3ded84d  
    11package com.wediscussmovies.project.service.impl;
    22
    3 import com.wediscussmovies.project.model.PasswordEncoder;
    4 import com.wediscussmovies.project.model.User;
     3import com.wediscussmovies.project.model.*;
    54import com.wediscussmovies.project.model.exception.PasswordsDontMatchException;
    65import com.wediscussmovies.project.model.exception.UserWithEmailAlreadyExists;
     
    87import com.wediscussmovies.project.repository.UserRepository;
    98import com.wediscussmovies.project.service.UserService;
    10 import org.springframework.http.HttpRequest;
    119import org.springframework.stereotype.Service;
    1210
    1311import javax.servlet.http.HttpServletRequest;
    14 import java.security.NoSuchAlgorithmException;
    1512import java.util.Optional;
    1613
Note: See TracChangeset for help on using the changeset viewer.