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:
d2c5455
)
WIP
author
Kai Moritz
<kai@juplo.de>
Sun, 12 Jul 2020 12:57:52 +0000
(14:57 +0200)
committer
Kai Moritz
<kai@juplo.de>
Sun, 12 Jul 2020 12:57:52 +0000
(14:57 +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
1ff11d8
..
513ec5a
100644
(file)
--- a/
src/main/java/de/juplo/boot/data/jdbc/UserController.java
+++ b/
src/main/java/de/juplo/boot/data/jdbc/UserController.java
@@
-52,6
+52,18
@@
public class UserController {
return ResponseEntity.ok(user);
}
+ @DeleteMapping("{username}")
+ public ResponseEntity<User> removeUser(@PathVariable String username) {
+ User user = repository.findByUsername(UserController.sanitize(username));
+
+ if (user == null)
+ return ResponseEntity.notFound().build();
+
+ repository.delete(user);
+
+ return ResponseEntity.ok(user);
+ }
+
@GetMapping()
public ResponseEntity<Iterable<User>> getUsers() {
return ResponseEntity.ok(repository.findAll());