From: Kai Moritz Date: Sun, 12 Jul 2020 13:00:39 +0000 (+0200) Subject: WIP: Uniqe-Users X-Git-Tag: wip-initial~1 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=dd18a5f5e2a9d72d077ff7f47aec27bb33f16b3a;p=demos%2Fkafka%2Foutbox WIP: Uniqe-Users --- diff --git a/src/main/java/de/juplo/boot/data/jdbc/UserController.java b/src/main/java/de/juplo/boot/data/jdbc/UserController.java index cec7b6e..0a27a51 100644 --- a/src/main/java/de/juplo/boot/data/jdbc/UserController.java +++ b/src/main/java/de/juplo/boot/data/jdbc/UserController.java @@ -32,7 +32,11 @@ public class UserController { @RequestBody String username) { String sanitizedUsername = UserController.sanitize(username); User user = new User(sanitizedUsername, LocalDateTime.now(), false); + + // Ein Fehler wegen doppeltem username verhindert das Speichern repository.save(user); + user = repository.findByUsername(sanitizedUsername); + UriComponents uri = builder .fromCurrentRequest()