Changeset 83a5af4 for src/main/java/it


Ignore:
Timestamp:
01/04/21 20:04:57 (4 years ago)
Author:
Vzdra <vladko.zdravkovski@…>
Branches:
master
Children:
f36822a
Parents:
29c0ed0
Message:

added response data

Location:
src/main/java/it/finki/tinki
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/it/finki/tinki/controller/TestController.java

    r29c0ed0 r83a5af4  
    22
    33import it.finki.tinki.model.Users.Account;
    4 import it.finki.tinki.model.Users.Company;
    5 import it.finki.tinki.model.Users.Team;
    6 import it.finki.tinki.model.Users.User;
    7 import it.finki.tinki.model.enumerator.AccountType;
    84import it.finki.tinki.model.pojo.AccountLoginDataPojo;
    9 import it.finki.tinki.repository.CompanyRepository;
    10 import it.finki.tinki.repository.JobRepository;
    11 import it.finki.tinki.repository.TeamRepository;
    12 import it.finki.tinki.repository.UserRepository;
     5import it.finki.tinki.model.pojo.AuthResponseDataPojo;
    136import it.finki.tinki.service.AccountService;
    147import org.springframework.web.bind.annotation.*;
    15 
    16 import java.util.HashMap;
    17 import java.util.Map;
     8import org.springframework.web.server.ResponseStatusException;
    189
    1910@RestController
     
    2819
    2920    @PostMapping(path = "/login")
    30     public Account testPage(@RequestBody AccountLoginDataPojo body){
    31         return accountService.findUser(body.getAccount(), body.getPassword(), body.getType());
     21    public AuthResponseDataPojo testPage(@RequestBody AccountLoginDataPojo body) throws ResponseStatusException {
     22        Account a1 = accountService.findUser(body.getAccount(), body.getPassword(), body.getType());
     23        AuthResponseDataPojo resp = new AuthResponseDataPojo();
     24
     25        if(a1!=null){
     26            resp.setId(a1.getId());
     27            resp.setEmail(a1.getEmail());
     28            resp.setName(a1.getName());
     29            resp.setType(a1.getAccountType());
     30        }
     31
     32        return resp;
    3233    }
    3334
Note: See TracChangeset for help on using the changeset viewer.