feat(fullstack): Add application form status, add submissions of forms, update DB schema

This commit is contained in:
2025-08-02 18:00:59 +02:00
parent f9851f01d9
commit a5eae07eaf
13 changed files with 278 additions and 91 deletions

View File

@@ -0,0 +1,11 @@
package com.betriebsratkanzlei.legalconsenthub.error
import com.betriebsratkanzlei.legalconsenthub_api.model.ApplicationFormStatus
import java.util.UUID
class ApplicationFormInvalidStateException(
val applicationFormId: UUID,
val currentState: ApplicationFormStatus,
val expectedState: ApplicationFormStatus,
val operation: String
) : RuntimeException("Cannot $operation application form with ID $applicationFormId. Current state: $currentState, expected state: $expectedState")

View File

@@ -31,6 +31,22 @@ class ExceptionHandler {
)
}
@ResponseBody
@ExceptionHandler(ApplicationFormInvalidStateException::class)
@ResponseStatus(HttpStatus.BAD_REQUEST)
fun handleInvalidStateError(e: ApplicationFormInvalidStateException): ResponseEntity<ProblemDetails> {
logger.warn(e.message, e)
return ResponseEntity.status(HttpStatus.BAD_REQUEST).contentType(MediaType.APPLICATION_PROBLEM_JSON)
.body(
ProblemDetails(
title = "Invalid State",
status = HttpStatus.BAD_REQUEST.value(),
type = URI.create("about:blank"),
detail = e.message ?: "Operation not allowed in current state"
)
)
}
@ResponseBody
@ExceptionHandler(
ApplicationFormNotCreatedException::class,