Last change
on this file since 4d026a5 was b101b69, checked in by ppaunovski <paunovskipavel@…>, 6 months ago |
initial classes, no inheritance yet v2
|
-
Property mode
set to
100644
|
File size:
1010 bytes
|
Rev | Line | |
---|
[b101b69] | 1 | package mk.ukim.finki.busngo.service.impl;
|
---|
| 2 |
|
---|
| 3 | import mk.ukim.finki.busngo.model.entities.Korisnik;
|
---|
| 4 | import mk.ukim.finki.busngo.model.exceptions.InvalidUserId;
|
---|
| 5 | import mk.ukim.finki.busngo.repository.KorisnikRepository;
|
---|
| 6 | import mk.ukim.finki.busngo.service.KorisnikService;
|
---|
| 7 | import org.springframework.stereotype.Service;
|
---|
| 8 |
|
---|
| 9 | import java.util.List;
|
---|
| 10 |
|
---|
| 11 | @Service
|
---|
| 12 | public class KorisnikServiceImpl implements KorisnikService {
|
---|
| 13 | private final KorisnikRepository korisnikRepository;
|
---|
| 14 |
|
---|
| 15 | public KorisnikServiceImpl(KorisnikRepository korisnikRepository) {
|
---|
| 16 | this.korisnikRepository = korisnikRepository;
|
---|
| 17 | }
|
---|
| 18 |
|
---|
| 19 |
|
---|
| 20 | @Override
|
---|
| 21 | public List<Korisnik> listAll() {
|
---|
| 22 | return korisnikRepository.findAll();
|
---|
| 23 | }
|
---|
| 24 |
|
---|
| 25 | @Override
|
---|
| 26 | public Korisnik findById(Long id) {
|
---|
| 27 | return korisnikRepository.findById(id).orElseThrow(InvalidUserId::new);
|
---|
| 28 | }
|
---|
| 29 |
|
---|
| 30 | @Override
|
---|
| 31 | public Korisnik loadUserByEmail(String email) {
|
---|
| 32 | return korisnikRepository.findByKEmail(email).orElseThrow(InvalidUserId::new);
|
---|
| 33 | }
|
---|
| 34 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.