diff --git a/legalconsenthub-backend/src/main/kotlin/com/betriebsratkanzlei/legalconsenthub/comment/CommentService.kt b/legalconsenthub-backend/src/main/kotlin/com/betriebsratkanzlei/legalconsenthub/comment/CommentService.kt index 364dece..fed337d 100644 --- a/legalconsenthub-backend/src/main/kotlin/com/betriebsratkanzlei/legalconsenthub/comment/CommentService.kt +++ b/legalconsenthub-backend/src/main/kotlin/com/betriebsratkanzlei/legalconsenthub/comment/CommentService.kt @@ -177,8 +177,8 @@ class CommentService( * Extracts plain text from TipTap/ProseMirror JSON content. * TipTap stores content as JSON like: {"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","text":"Hello"}]}]} */ - private fun extractPlainTextFromTipTap(jsonContent: String): String { - return try { + private fun extractPlainTextFromTipTap(jsonContent: String): String = + try { val rootNode = objectMapper.readTree(jsonContent) val textBuilder = StringBuilder() extractTextRecursively(rootNode, textBuilder) @@ -187,7 +187,6 @@ class CommentService( // If parsing fails, return the original content (might be plain text) jsonContent } - } private fun extractTextRecursively( node: JsonNode, @@ -203,7 +202,10 @@ class CommentService( content.forEachIndexed { index, child -> extractTextRecursively(child, builder) // Add newline between paragraphs - if (child.has("type") && child.get("type").asText() == "paragraph" && index < content.size() - 1) { + if (child.has("type") && + child.get("type").asText() == "paragraph" && + index < content.size() - 1 + ) { builder.append("\n") } } diff --git a/legalconsenthub-backend/src/main/resources/application-testcontainers.yaml b/legalconsenthub-backend/src/main/resources/application-testcontainers.yaml index a8929d4..a34882a 100644 --- a/legalconsenthub-backend/src/main/resources/application-testcontainers.yaml +++ b/legalconsenthub-backend/src/main/resources/application-testcontainers.yaml @@ -13,7 +13,7 @@ spring: database-platform: org.hibernate.dialect.PostgreSQLDialect hibernate: ddl-auto: create - show-sql: false + show-sql: true properties: hibernate: format_sql: true diff --git a/legalconsenthub-backend/src/main/resources/db/migrations/001-schema.sql b/legalconsenthub-backend/src/main/resources/db/migrations/001-schema.sql index 73707f3..748470a 100644 --- a/legalconsenthub-backend/src/main/resources/db/migrations/001-schema.sql +++ b/legalconsenthub-backend/src/main/resources/db/migrations/001-schema.sql @@ -1,7 +1,9 @@ create table app_user ( + email_on_comment_added boolean not null, email_on_form_created boolean not null, email_on_form_submitted boolean not null, + email_on_form_updated boolean not null, created_at timestamp(6) with time zone not null, modified_at timestamp(6) with time zone not null, email varchar(255), @@ -119,16 +121,17 @@ create table form_element_sub_section create table notification ( - is_read boolean not null, - created_at timestamp(6) with time zone not null, - id uuid not null, - click_target varchar(255) not null, - message TEXT not null, - organization_id varchar(255) not null, - recipient_id varchar(255), - target_roles TEXT, - title varchar(255) not null, - type varchar(255) not null check (type in ('INFO', 'WARNING', 'ERROR')), + is_read boolean not null, + created_at timestamp(6) with time zone not null, + id uuid not null, + click_target varchar(255) not null, + excluded_user_id varchar(255), + message TEXT not null, + organization_id varchar(255) not null, + recipient_id varchar(255), + target_roles TEXT, + title varchar(255) not null, + type varchar(255) not null check (type in ('INFO', 'WARNING', 'ERROR')), primary key (id) );