feat: Add ktlint to backend and format all files
This commit is contained in:
@@ -7,5 +7,7 @@ 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")
|
||||
val operation: String,
|
||||
) : RuntimeException(
|
||||
"Cannot $operation application form with ID $applicationFormId. Current state: $currentState, expected state: $expectedState",
|
||||
)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
package com.betriebsratkanzlei.legalconsenthub.error
|
||||
|
||||
class ApplicationFormNotCreatedException(e: Exception): RuntimeException("Couldn't create application form", e)
|
||||
class ApplicationFormNotCreatedException(
|
||||
e: Exception,
|
||||
) : RuntimeException("Couldn't create application form", e)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
package com.betriebsratkanzlei.legalconsenthub.error
|
||||
|
||||
class ApplicationFormNotDeletedException(e: Exception): RuntimeException("Couldn't delete application form", e)
|
||||
class ApplicationFormNotDeletedException(
|
||||
e: Exception,
|
||||
) : RuntimeException("Couldn't delete application form", e)
|
||||
|
||||
@@ -2,4 +2,6 @@ package com.betriebsratkanzlei.legalconsenthub.error
|
||||
|
||||
import java.util.UUID
|
||||
|
||||
class ApplicationFormNotFoundException(id: UUID): RuntimeException("Couldn't find application form with ID: $id")
|
||||
class ApplicationFormNotFoundException(
|
||||
id: UUID,
|
||||
) : RuntimeException("Couldn't find application form with ID: $id")
|
||||
|
||||
@@ -2,4 +2,7 @@ package com.betriebsratkanzlei.legalconsenthub.error
|
||||
|
||||
import java.util.UUID
|
||||
|
||||
class ApplicationFormNotUpdatedException(e: Exception, id: UUID): RuntimeException("Couldn't update application form with ID: $id", e)
|
||||
class ApplicationFormNotUpdatedException(
|
||||
e: Exception,
|
||||
id: UUID,
|
||||
) : RuntimeException("Couldn't update application form with ID: $id", e)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
package com.betriebsratkanzlei.legalconsenthub.error
|
||||
|
||||
class CommentNotCreatedException(e: Exception): RuntimeException("Couldn't create comment", e)
|
||||
class CommentNotCreatedException(
|
||||
e: Exception,
|
||||
) : RuntimeException("Couldn't create comment", e)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
package com.betriebsratkanzlei.legalconsenthub.error
|
||||
|
||||
class CommentNotDeletedException(e: Exception): RuntimeException("Couldn't delete comment", e)
|
||||
class CommentNotDeletedException(
|
||||
e: Exception,
|
||||
) : RuntimeException("Couldn't delete comment", e)
|
||||
|
||||
@@ -2,4 +2,6 @@ package com.betriebsratkanzlei.legalconsenthub.error
|
||||
|
||||
import java.util.UUID
|
||||
|
||||
class CommentNotFoundException(id: UUID): RuntimeException("Couldn't find comment with ID: $id")
|
||||
class CommentNotFoundException(
|
||||
id: UUID,
|
||||
) : RuntimeException("Couldn't find comment with ID: $id")
|
||||
|
||||
@@ -2,4 +2,7 @@ package com.betriebsratkanzlei.legalconsenthub.error
|
||||
|
||||
import java.util.UUID
|
||||
|
||||
class CommentNotUpdatedException(e: Exception, id: UUID): RuntimeException("Couldn't update comment with ID: $id", e)
|
||||
class CommentNotUpdatedException(
|
||||
e: Exception,
|
||||
id: UUID,
|
||||
) : RuntimeException("Couldn't update comment with ID: $id", e)
|
||||
|
||||
@@ -20,14 +20,16 @@ class ExceptionHandler {
|
||||
@ResponseStatus(HttpStatus.NOT_FOUND)
|
||||
fun handleNotFoundError(e: Exception): ResponseEntity<ProblemDetails> {
|
||||
logger.warn(e.message, e)
|
||||
return ResponseEntity.status(HttpStatus.NOT_FOUND).contentType(MediaType.APPLICATION_PROBLEM_JSON)
|
||||
return ResponseEntity
|
||||
.status(HttpStatus.NOT_FOUND)
|
||||
.contentType(MediaType.APPLICATION_PROBLEM_JSON)
|
||||
.body(
|
||||
ProblemDetails(
|
||||
title = "Not Found",
|
||||
status = HttpStatus.NOT_FOUND.value(),
|
||||
type = URI.create("about:blank"),
|
||||
detail = e.message ?: "Something went wrong"
|
||||
)
|
||||
detail = e.message ?: "Something went wrong",
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -36,14 +38,16 @@ class ExceptionHandler {
|
||||
@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)
|
||||
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"
|
||||
)
|
||||
detail = e.message ?: "Operation not allowed in current state",
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -52,14 +56,16 @@ class ExceptionHandler {
|
||||
@ResponseStatus(HttpStatus.CONFLICT)
|
||||
fun handleUserAlreadyExistsError(e: UserAlreadyExistsException): ResponseEntity<ProblemDetails> {
|
||||
logger.warn(e.message, e)
|
||||
return ResponseEntity.status(HttpStatus.CONFLICT).contentType(MediaType.APPLICATION_PROBLEM_JSON)
|
||||
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"
|
||||
)
|
||||
detail = e.message ?: "Resource already exists",
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -72,14 +78,16 @@ class ExceptionHandler {
|
||||
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
fun handleInternalServerError(e: Exception): ResponseEntity<ProblemDetails> {
|
||||
logger.warn(e.message, e)
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).contentType(MediaType.APPLICATION_PROBLEM_JSON)
|
||||
return ResponseEntity
|
||||
.status(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
.contentType(MediaType.APPLICATION_PROBLEM_JSON)
|
||||
.body(
|
||||
ProblemDetails(
|
||||
title = "Internal Server Error",
|
||||
status = HttpStatus.INTERNAL_SERVER_ERROR.value(),
|
||||
type = URI.create("about:blank"),
|
||||
detail = e.message ?: "Something went wrong"
|
||||
)
|
||||
detail = e.message ?: "Something went wrong",
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,4 +2,6 @@ package com.betriebsratkanzlei.legalconsenthub.error
|
||||
|
||||
import java.util.UUID
|
||||
|
||||
class FormElementNotFoundException(id: UUID): RuntimeException("Couldn't find form element with ID: $id")
|
||||
class FormElementNotFoundException(
|
||||
id: UUID,
|
||||
) : RuntimeException("Couldn't find form element with ID: $id")
|
||||
|
||||
@@ -2,4 +2,6 @@ package com.betriebsratkanzlei.legalconsenthub.error
|
||||
|
||||
import java.util.UUID
|
||||
|
||||
class FormElementSectionNotFoundException(id: UUID): RuntimeException("Couldn't find form element section with ID: $id")
|
||||
class FormElementSectionNotFoundException(
|
||||
id: UUID,
|
||||
) : RuntimeException("Couldn't find form element section with ID: $id")
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
package com.betriebsratkanzlei.legalconsenthub.error
|
||||
|
||||
class UserAlreadyExistsException(id: String): RuntimeException("User with ID $id already exists")
|
||||
class UserAlreadyExistsException(
|
||||
id: String,
|
||||
) : RuntimeException("User with ID $id already exists")
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
package com.betriebsratkanzlei.legalconsenthub.error
|
||||
|
||||
class UserNotFoundException(id: String): RuntimeException("Couldn't find user with ID: $id")
|
||||
class UserNotFoundException(
|
||||
id: String,
|
||||
) : RuntimeException("Couldn't find user with ID: $id")
|
||||
|
||||
Reference in New Issue
Block a user