[R9] Post method to register user

This commit is contained in:
Mirna Gama 2024-01-12 12:39:05 -03:00 committed by Mirna Gama
parent 2685f95f80
commit e8bb2e94bd

View File

@ -40,7 +40,7 @@ public class AuthenticationController {
*
* @return The authorization token if successful, or an unauthorized status if there is an error.
*/
@PostMapping
@PostMapping(value = "/login")
public ResponseEntity<Object> login(@RequestBody @Valid UserDTO userDTO) {
Authentication auth = authService.login(userDTO);
@ -51,4 +51,13 @@ public class AuthenticationController {
return ResponseEntity.ok(token);
}
@PostMapping(value = "/register")
public ResponseEntity<Object> register(@RequestBody @Valid UserDTO userDTO) {
User user = authService.register(userDTO);
return ResponseEntity.ok(user);
}
}