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:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user