Ignore:
Timestamp:
01/09/24 01:26:08 (10 months ago)
Author:
ppaunovski <paunovskipavel@…>
Branches:
master
Children:
e272096
Parents:
b101b69
Message:

All 3 main use cases implemented.

  1. Starting a commute
  2. Writing a ticket
  3. Starting an instance of a Bus Line
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/mk/ukim/finki/busngo/service/impl/AuthServiceImpl.java

    rb101b69 rbde8b13  
    22
    33import mk.ukim.finki.busngo.model.entities.Korisnik;
     4import mk.ukim.finki.busngo.model.entities.Patnik;
    45import mk.ukim.finki.busngo.model.exceptions.InvalidCredentialsException;
    56import mk.ukim.finki.busngo.model.exceptions.UserAlreadyExistsException;
    67import mk.ukim.finki.busngo.repository.KorisnikRepository;
     8import mk.ukim.finki.busngo.repository.PatnikRepository;
    79import mk.ukim.finki.busngo.service.AuthService;
    810import org.springframework.security.crypto.password.PasswordEncoder;
    911import org.springframework.stereotype.Service;
    1012
    11 import java.util.List;
    12 
    1313@Service
    1414public class AuthServiceImpl implements AuthService {
    1515    private final KorisnikRepository korisnikRepository;
     16    private final PatnikRepository patnikRepository;
    1617    private final PasswordEncoder passwordEncoder;
    1718
    18     public AuthServiceImpl(KorisnikRepository korisnikRepository, PasswordEncoder passwordEncoder) {
     19    public AuthServiceImpl(KorisnikRepository korisnikRepository, PatnikRepository patnikRepository, PasswordEncoder passwordEncoder) {
    1920        this.korisnikRepository = korisnikRepository;
     21        this.patnikRepository = patnikRepository;
    2022        this.passwordEncoder = passwordEncoder;
    2123    }
     
    2931
    3032    @Override
    31     public Korisnik register(String ime, String email, String password, String confirmPassword, String address, String telefon) {
     33    public Korisnik registerPatnik(String ime, String email, String password, String confirmPassword, String address, String telefon) {
    3234        if (email == null || password == null || email.isEmpty() || password.isEmpty()) {
    3335            throw new InvalidCredentialsException();
     
    4244        }
    4345
    44         Korisnik korisnik = new Korisnik();
     46        Patnik korisnik = new Patnik();
    4547        korisnik.setKIme(ime);
    4648        korisnik.setKAdresa(address);
     
    5052        korisnik.setKIsAdmin(false);
    5153
    52         return korisnikRepository.save(korisnik);
     54
     55        return patnikRepository.save(korisnik);
    5356    }
    5457
Note: See TracChangeset for help on using the changeset viewer.