feat: add create person feature via web interface

- Backend: new POST /api/persons endpoint in PersonController
- Frontend: new /persons/new route with Vorname/Nachname/Alias form,
  redirects to the new person's detail page on success
- Persons list: subtle '+ Neue Person' link below the page title

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-03-16 16:23:05 +01:00
parent b583c8489d
commit 0123dffdc4
5 changed files with 323 additions and 112 deletions

View File

@@ -44,6 +44,21 @@ public class PersonController {
return documentRepository.findBySenderId(id);
}
@PostMapping
public ResponseEntity<Person> createPerson(@RequestBody Map<String, String> body) {
String firstName = body.get("firstName");
String lastName = body.get("lastName");
if (firstName == null || firstName.isBlank() || lastName == null || lastName.isBlank()) {
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Vor- und Nachname sind Pflichtfelder");
}
Person person = Person.builder()
.firstName(firstName.trim())
.lastName(lastName.trim())
.alias(body.get("alias"))
.build();
return ResponseEntity.ok(personRepository.save(person));
}
@PutMapping("/{id}")
public ResponseEntity<Person> updatePerson(@PathVariable UUID id, @RequestBody Map<String, String> body) {
String firstName = body.get("firstName");