Ignore:
Timestamp:
01/16/22 15:29:49 (3 years ago)
Author:
Petar Partaloski <ppartaloski@…>
Branches:
main
Children:
7bc8942
Parents:
7a0bf79
Message:

Controller, Repository and Service layer improvements, Entity updating

Location:
src/main/java/com/wediscussmovies/project/service
Files:
3 added
5 edited

Legend:

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

    r7a0bf79 r2a5d6a3  
    11package com.wediscussmovies.project.service;
    22
     3import com.wediscussmovies.project.model.Discussion;
     4
     5import java.util.List;
     6import java.util.Optional;
     7
    38public interface DiscussionService {
     9    List<Discussion> listAll();
     10    List<Discussion> listAllByTitle(String title);
     11    Optional<Discussion> findById(Integer id);
     12    void save(Discussion discussion);
    413}
  • src/main/java/com/wediscussmovies/project/service/PersonService.java

    r7a0bf79 r2a5d6a3  
    99    public List<Person> findAllDirectors();
    1010    public List<Person> findAllActors();
     11    Optional<Person> findById(Integer person_id);
    1112    Optional<Person> findActorById(Integer id);
    1213    Optional<Person> findDirectorById(Integer id);
     14    boolean save(Person person);
     15    List<Person> findActorsByNameLike(String name);
     16    List<Person> findActorsBySurnameLike(String surname);
     17    List<Person> findDirectorsByNameLike(String name);
     18    List<Person> findDirectorsBySurnameLike(String surname);
     19
    1320}
  • src/main/java/com/wediscussmovies/project/service/ReplyService.java

    r7a0bf79 r2a5d6a3  
    11package com.wediscussmovies.project.service;
    22
     3import com.wediscussmovies.project.model.Reply;
     4
     5import java.util.Optional;
     6
    37public interface ReplyService {
     8    public Reply save(Reply r);
     9    public void delete(Reply r);
     10    Optional<Reply> findById(Integer id);
    411}
  • src/main/java/com/wediscussmovies/project/service/UserService.java

    r7a0bf79 r2a5d6a3  
    11package com.wediscussmovies.project.service;
    22
     3import com.wediscussmovies.project.model.User;
     4
     5import javax.servlet.http.HttpServletRequest;
     6import java.util.Optional;
     7
    38public interface UserService {
     9    public Optional<User> login(String email, String password);
     10    public Optional<User> register(HttpServletRequest request, String email, String password, String confirmPassword, String username, String name, String surname);
    411}
  • src/main/java/com/wediscussmovies/project/service/impl/PersonServiceImpl.java

    r7a0bf79 r2a5d6a3  
    2828    }
    2929
     30    @Override
     31    public Optional<Person> findById(Integer person_id) {
     32        return personRepository.findById(person_id);
     33    }
    3034
    3135    @Override
     
    3842        return personRepository.findAllByPersonType(PersonType.A);
    3943    }
     44
     45    @Override
     46    public boolean save(Person person) {
     47        Person p = personRepository.save(person);
     48        if(p != null)
     49            return true;
     50        return false;
     51    }
     52
     53    @Override
     54    public List<Person> findActorsByNameLike(String name) {
     55        return personRepository.findAllByPersonTypeAndNameLike(PersonType.A, name);
     56    }
     57
     58    @Override
     59    public List<Person> findActorsBySurnameLike(String surname) {
     60        return personRepository.findAllByPersonTypeAndSurnameLike(PersonType.A, surname);
     61    }
     62
     63    @Override
     64    public List<Person> findDirectorsByNameLike(String name) {
     65        return personRepository.findAllByPersonTypeAndNameLike(PersonType.D, name);
     66    }
     67
     68    @Override
     69    public List<Person> findDirectorsBySurnameLike(String surname) {
     70        return personRepository.findAllByPersonTypeAndSurnameLike(PersonType.D, surname);
     71    }
    4072}
Note: See TracChangeset for help on using the changeset viewer.