79.1 Delete user (#9)

This commit is contained in:
Art
2021-09-09 23:26:46 +03:00
parent c399d1cf8d
commit b91f60ef51
2 changed files with 44 additions and 0 deletions

View File

@ -91,6 +91,17 @@ public class UserResource {
.build();
}
@DeleteMapping("{id}")
public HttpResponse deleteUser(@PathVariable long id){
userService.deleteUser(id);
return HttpResponse.builder()
.httpStatusCode(OK.value())
.httpStatus(OK)
.reason(OK.getReasonPhrase())
.message("User deleted successfully")
.build();
}
private void authenticate(String username, String password) {
Authentication auth = new UsernamePasswordAuthenticationToken(username, password);
authenticationManager.authenticate(auth);