Skip to content

Commit

Permalink
account lookup (#85)
Browse files Browse the repository at this point in the history
-implemented /api/v1/accounts/lookup
-prevents user from creating an account with a taken username
-prevents the previous HTTP 500 error
  • Loading branch information
4reebah authored Jul 19, 2023
1 parent a287985 commit 1f43395
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ public Mono<ResponseEntity<Object>> registerAccount(@RequestHeader("Authorizatio
.map(token -> ResponseEntity.ok(new TokenResponse(token.token, "*")));
}

@GetMapping("/api/v1/accounts/lookup")
public Mono<ResponseEntity<Account>> lookUpAccount(@RequestParam String username) {
return accountService.getAccount(username)
.map(ResponseEntity::ok)
.defaultIfEmpty(ResponseEntity.notFound().build());
}

@PostMapping("/api/v1/emails/confirmations")
String emailsConfirmations() {
// we don't use email verification... YET!
Expand Down

0 comments on commit 1f43395

Please sign in to comment.