projects
/
demos
/
spring
/
data-jdbc
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
94f2f3b
)
WIP: Uniqe-Users
author
Kai Moritz
<kai@juplo.de>
Sun, 12 Jul 2020 13:00:39 +0000
(15:00 +0200)
committer
Kai Moritz
<kai@juplo.de>
Sun, 12 Jul 2020 13:00:39 +0000
(15:00 +0200)
src/main/java/de/juplo/boot/data/jdbc/UserController.java
patch
|
blob
|
history
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
(file)
--- 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()