From: Kai Moritz Date: Sun, 12 Jul 2020 12:57:52 +0000 (+0200) Subject: WIP X-Git-Tag: wip-initial~3 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=c6d9fc07e469db108a93b466136e2041ccc645c4;p=demos%2Fkafka%2Foutbox WIP --- 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 --- 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 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> getUsers() { return ResponseEntity.ok(repository.findAll());