Changeset 9d4220d


Ignore:
Timestamp:
01/06/21 21:47:03 (3 years ago)
Author:
i-ina <76742075+i-ina@…>
Branches:
master
Children:
1397178
Parents:
4a15c9c
Message:

added register team and register company

File:
1 edited

Legend:

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

    r4a15c9c r9d4220d  
    5151    }
    5252
     53    @RequestMapping(path = "/team", method = RequestMethod.POST)
     54    private Map<String, String> registerTeam(@RequestParam String email,
     55                                             @RequestParam String password,
     56                                             @RequestParam String name,
     57                                             @RequestParam int members){
    5358
     59        Account k = this.accountService.registerTeam(email, password, name, members);
     60
     61        Map<String, String> response = new HashMap<>();
     62
     63        if(k!=null){
     64            response.put("error", "There was an error when trying to register team.");
     65        }else{
     66            response.put("success", "Registration completed successfully.");
     67        }
     68
     69        return response;
     70    }
     71
     72    @RequestMapping(path = "/company", method = RequestMethod.POST)
     73    private Map<String, String> registerTeam(@RequestParam String email,
     74                                             @RequestParam String password,
     75                                             @RequestParam String name,
     76                                             @RequestParam String country,
     77                                             @RequestParam String city,
     78                                             @RequestParam String street){
     79
     80        Account k = this.accountService.registerCompany(email, password, name, country, city, street);
     81
     82        Map<String, String> response = new HashMap<>();
     83
     84        if(k!=null){
     85            response.put("error", "There was an error when trying to register company.");
     86        }else{
     87            response.put("success", "Registration completed successfully.");
     88        }
     89
     90        return response;
     91    }
    5492}
Note: See TracChangeset for help on using the changeset viewer.