Last change
on this file since 1b248e4 was 1b248e4, checked in by milamihajlovska <mila.mihajlovska01@…>, 22 months ago |
service impl changes
|
-
Property mode
set to
100644
|
File size:
806 bytes
|
Line | |
---|
1 | package com.example.moviezone.service.Impl;
|
---|
2 |
|
---|
3 | import com.example.moviezone.model.User;
|
---|
4 | import com.example.moviezone.model.exceptions.UserNotFoundException;
|
---|
5 | import com.example.moviezone.repository.UserRepository;
|
---|
6 | import com.example.moviezone.service.UserService;
|
---|
7 | import org.springframework.stereotype.Service;
|
---|
8 |
|
---|
9 | import java.util.List;
|
---|
10 |
|
---|
11 | @Service
|
---|
12 | public class UserServiceImpl implements UserService {
|
---|
13 |
|
---|
14 | private final UserRepository userRepository;
|
---|
15 |
|
---|
16 | public UserServiceImpl(UserRepository userRepository) {
|
---|
17 | this.userRepository = userRepository;
|
---|
18 | }
|
---|
19 |
|
---|
20 | @Override
|
---|
21 | public List<User> findAllUsers() {
|
---|
22 | return userRepository.findAll();
|
---|
23 | }
|
---|
24 |
|
---|
25 | @Override
|
---|
26 | public User findById(Integer id) {
|
---|
27 | return userRepository.findById(id).orElseThrow(UserNotFoundException::new);
|
---|
28 | }
|
---|
29 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.