feat(fullstack): Add notifications, user is now an entity, add testcontainers, rework custom permissions, get user from JWT in endpoints

This commit is contained in:
2025-08-09 10:09:00 +02:00
parent a5eae07eaf
commit 7e55a336f2
44 changed files with 1571 additions and 139 deletions

View File

@@ -16,7 +16,7 @@ class ExceptionHandler {
var logger = LoggerFactory.getLogger(ExceptionHandler::class.java)
@ResponseBody
@ExceptionHandler(ApplicationFormNotFoundException::class)
@ExceptionHandler(ApplicationFormNotFoundException::class, UserNotFoundException::class)
@ResponseStatus(HttpStatus.NOT_FOUND)
fun handleNotFoundError(e: Exception): ResponseEntity<ProblemDetails> {
logger.warn(e.message, e)
@@ -47,6 +47,22 @@ class ExceptionHandler {
)
}
@ResponseBody
@ExceptionHandler(UserAlreadyExistsException::class)
@ResponseStatus(HttpStatus.CONFLICT)
fun handleUserAlreadyExistsError(e: UserAlreadyExistsException): ResponseEntity<ProblemDetails> {
logger.warn(e.message, e)
return ResponseEntity.status(HttpStatus.CONFLICT).contentType(MediaType.APPLICATION_PROBLEM_JSON)
.body(
ProblemDetails(
title = "Conflict",
status = HttpStatus.CONFLICT.value(),
type = URI.create("about:blank"),
detail = e.message ?: "Resource already exists"
)
)
}
@ResponseBody
@ExceptionHandler(
ApplicationFormNotCreatedException::class,

View File

@@ -0,0 +1,3 @@
package com.betriebsratkanzlei.legalconsenthub.error
class UserAlreadyExistsException(id: String): RuntimeException("User with ID $id already exists")

View File

@@ -0,0 +1,3 @@
package com.betriebsratkanzlei.legalconsenthub.error
class UserNotFoundException(id: String): RuntimeException("Couldn't find user with ID: $id")