Last change
on this file was 8b875e6, checked in by ppaunovski <paunovskipavel@…>, 2 months ago |
Added roles to Users and some minor changes
|
-
Property mode
set to
100644
|
File size:
1.0 KB
|
Line | |
---|
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.enums.Role;
|
---|
5 | import mk.ukim.finki.busngo.model.exceptions.InvalidUserId;
|
---|
6 | import mk.ukim.finki.busngo.repository.KorisnikRepository;
|
---|
7 | import mk.ukim.finki.busngo.service.KorisnikService;
|
---|
8 | import org.springframework.stereotype.Service;
|
---|
9 |
|
---|
10 | import java.util.List;
|
---|
11 |
|
---|
12 | @Service
|
---|
13 | public class KorisnikServiceImpl implements KorisnikService {
|
---|
14 | private final KorisnikRepository korisnikRepository;
|
---|
15 |
|
---|
16 | public KorisnikServiceImpl(KorisnikRepository korisnikRepository) {
|
---|
17 | this.korisnikRepository = korisnikRepository;
|
---|
18 | }
|
---|
19 |
|
---|
20 |
|
---|
21 | @Override
|
---|
22 | public List<Korisnik> listAll() {
|
---|
23 | return korisnikRepository.findAll();
|
---|
24 | }
|
---|
25 |
|
---|
26 | @Override
|
---|
27 | public Korisnik findById(Long id) {
|
---|
28 | return korisnikRepository.findById(id).orElseThrow(InvalidUserId::new);
|
---|
29 | }
|
---|
30 |
|
---|
31 | @Override
|
---|
32 | public Korisnik loadUserByEmail(String email) {
|
---|
33 | return korisnikRepository.findByKEmail(email).orElseThrow(InvalidUserId::new);
|
---|
34 | }
|
---|
35 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.