Ignore:
Timestamp:
01/05/23 01:31:58 (23 months ago)
Author:
andrejtodorovski <82031894+andrejtodorovski@…>
Branches:
main
Children:
676144b
Parents:
ab952ab
Message:

Added functionalities

Location:
src/main/java/com/example/autopartz/service/impl
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/com/example/autopartz/service/impl/LoginServiceImpl.java

    rab952ab r7d43957  
    11package com.example.autopartz.service.impl;
    22
    3 import com.example.autopartz.model.User;
     3import com.example.autopartz.model.*;
    44import com.example.autopartz.repository.UserRepository;
    55import com.example.autopartz.service.LoginService;
    66import org.springframework.stereotype.Service;
     7
     8import java.util.Objects;
    79
    810@Service
     
    1517
    1618    @Override
    17     public User register(String name, String username, String email, String number, String password) {
    18         return userRepository.save(new User(username,name,email,password,number));
     19    public void register(String name, String username, String email, String number, String password, String role) {
     20        if (Objects.equals(role, "client")) {
     21            userRepository.save(new Client(username, name, email, password, number));
     22        }
     23        else {
     24            userRepository.save(new Deliveryman(username, name, email, password, number));
     25        }
    1926    }
    2027
     
    2431    }
    2532
     33    @Override
     34    public void registerWarehouseman(String name, String username, String email, String number, String password, String role, Warehouse warehouse) {
     35        userRepository.save(new Warehouseman(username, name, email, password, number, warehouse));
     36
     37    }
     38
    2639//    @Override
    2740//    public User findByUsername(String username) {
Note: See TracChangeset for help on using the changeset viewer.