Ignore:
Timestamp:
01/08/21 03:13:23 (3 years ago)
Author:
Vzdra <vladko.zdravkovski@…>
Branches:
master
Children:
336d09e
Parents:
b24fe9b
Message:

fixed some bugs and finalized user registration

File:
1 edited

Legend:

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

    rb24fe9b rb31afbd  
    88import it.finki.tinki.model.Users.Account;
    99import it.finki.tinki.model.Users.User;
     10import it.finki.tinki.model.dto.UserRegisterDTO;
    1011import it.finki.tinki.service.AccountService;
    1112import it.finki.tinki.service.MatchmakerService;
     
    3637
    3738    @RequestMapping(path = "/user", method = RequestMethod.POST)
    38     private Map<String, String> registerUser(@RequestParam String email,
    39                                              @RequestParam String password,
    40                                              @RequestParam String name,
    41                                              @RequestParam String surname,
    42                                              @RequestParam List<Long> retainedSkills,
    43                                              @RequestParam List<Long> skillsToLearn){
     39    private Map<String, String> registerUser(@RequestBody UserRegisterDTO body){
    4440
    45         List<Skill> retained = this.skillService.returnSkillsBasedOnId(retainedSkills);
    46         List<Skill> toLearn = this.skillService.returnSkillsBasedOnId(skillsToLearn);
     41        List<Skill> retained = this.skillService.returnSkillsBasedOnId(body.getRetainedSkills());
     42        List<Skill> toLearn = this.skillService.returnSkillsBasedOnId(body.getSkillsToLearn());
    4743
    48         Account k = this.accountService.registerUser(email, password, name, surname, retained, toLearn);
     44        Account k = this.accountService.registerUser(body.getEmail(), body.getPassword(), body.getName(), body.getSurname(), retained, toLearn);
    4945
    5046        Map<String, String> response = new HashMap<>();
     
    6056
    6157    @RequestMapping(path = "/team", method = RequestMethod.POST)
    62     private Map<String, String> registerTeam(@RequestParam String email,
    63                                              @RequestParam String password,
    64                                              @RequestParam String name,
    65                                              @RequestParam int members){
     58    private Map<String, String> registerTeam(@RequestBody String email,
     59                                             @RequestBody String password,
     60                                             @RequestBody String name,
     61                                             @RequestBody int members){
    6662
    6763        Account k = this.accountService.registerTeam(email, password, name, members);
     
    7975
    8076    @RequestMapping(path = "/company", method = RequestMethod.POST)
    81     private Map<String, String> registeCompany(@RequestParam String email,
    82                                                @RequestParam String password,
    83                                                @RequestParam String name,
    84                                                @RequestParam String country,
    85                                                @RequestParam String city,
    86                                                @RequestParam String street){
     77    private Map<String, String> registeCompany(@RequestBody String email,
     78                                               @RequestBody String password,
     79                                               @RequestBody String name,
     80                                               @RequestBody String country,
     81                                               @RequestBody String city,
     82                                               @RequestBody String street){
    8783
    8884        Account k = this.accountService.registerCompany(email, password, name, country, city, street);
Note: See TracChangeset for help on using the changeset viewer.