Ignore:
Timestamp:
02/02/23 22:46:30 (22 months ago)
Author:
milamihajlovska <mila.mihajlovska01@…>
Branches:
master
Children:
ac25203
Parents:
f60cb20
Message:

service impl changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/com/example/moviezone/service/Impl/UserServiceImpl.java

    rf60cb20 r1b248e4  
    22
    33import com.example.moviezone.model.User;
     4import com.example.moviezone.model.exceptions.UserNotFoundException;
     5import com.example.moviezone.repository.UserRepository;
    46import com.example.moviezone.service.UserService;
    57import org.springframework.stereotype.Service;
     
    1012public class UserServiceImpl implements UserService {
    1113
     14    private final UserRepository userRepository;
     15
     16    public UserServiceImpl(UserRepository userRepository) {
     17        this.userRepository = userRepository;
     18    }
    1219
    1320    @Override
    1421    public List<User> findAllUsers() {
    15         return null;
     22        return userRepository.findAll();
    1623    }
    1724
    1825    @Override
    19     public User findById() {
    20         return null;
     26    public User findById(Integer id) {
     27        return userRepository.findById(id).orElseThrow(UserNotFoundException::new);
    2128    }
    2229}
Note: See TracChangeset for help on using the changeset viewer.