- Timestamp:
- 01/09/24 01:26:08 (10 months ago)
- Branches:
- master
- Children:
- e272096
- Parents:
- b101b69
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/mk/ukim/finki/busngo/service/impl/PatnikServiceImpl.java
rb101b69 rbde8b13 1 1 package mk.ukim.finki.busngo.service.impl; 2 2 3 import mk.ukim.finki.busngo.model.entities.Instancanalinija; 4 import mk.ukim.finki.busngo.model.entities.Korisnik; 3 5 import mk.ukim.finki.busngo.model.entities.Patnik; 4 6 import mk.ukim.finki.busngo.model.exceptions.InvalidPatnikIdException; 5 7 import mk.ukim.finki.busngo.repository.PatnikRepository; 8 import mk.ukim.finki.busngo.service.InstancaNaLinijaService; 6 9 import mk.ukim.finki.busngo.service.PatnikService; 7 10 import org.springframework.stereotype.Service; 8 11 12 import java.util.Collections; 9 13 import java.util.List; 10 14 … … 12 16 public class PatnikServiceImpl implements PatnikService { 13 17 private final PatnikRepository patnikRepository; 18 private final InstancaNaLinijaService instancaNaLinijaService; 14 19 15 public PatnikServiceImpl(PatnikRepository patnikRepository ) {20 public PatnikServiceImpl(PatnikRepository patnikRepository, InstancaNaLinijaService instancaNaLinijaService) { 16 21 this.patnikRepository = patnikRepository; 22 this.instancaNaLinijaService = instancaNaLinijaService; 17 23 } 18 24 19 25 @Override 20 26 public List<Patnik> listAll() { 21 return patnikRepository.findAll();27 return patnikRepository.findAll(); 22 28 } 23 29 … … 26 32 return patnikRepository.findById(id).orElseThrow(InvalidPatnikIdException::new); 27 33 } 34 35 @Override 36 public Patnik loadUserByEmail(String email) { 37 return patnikRepository.findByKEmail(email).orElseThrow(InvalidPatnikIdException::new); 38 } 39 40 @Override 41 public Patnik save(Korisnik korisnik) { 42 Patnik patnik = new Patnik(); 43 patnik.setKId(korisnik.getKId()); 44 patnik.setKEmail(korisnik.getKEmail()); 45 patnik.setKAdresa(korisnik.getKAdresa()); 46 patnik.setKIme(korisnik.getKIme()); 47 patnik.setKTelefon(korisnik.getKTelefon()); 48 patnik.setKIsAdmin(korisnik.getKIsAdmin()); 49 patnik.setKLozinka(korisnik.getKLozinka()); 50 51 return patnikRepository.save((Patnik) korisnik); 52 } 53 54 28 55 }
Note:
See TracChangeset
for help on using the changeset viewer.