diff --git a/persistence-service-v1/persistence-service-processor-v1/build.gradle.kts b/persistence-service-v1/persistence-service-processor-v1/build.gradle.kts index 639085e55..9c78e94ed 100644 --- a/persistence-service-v1/persistence-service-processor-v1/build.gradle.kts +++ b/persistence-service-v1/persistence-service-processor-v1/build.gradle.kts @@ -35,6 +35,7 @@ dependencies { exclude(group = "com.iqser.red.service", module = "persistence-service-shared-api-v1") } api("com.knecon.fforesight:jobs-commons:0.10.0") + api("com.knecon.fforesight:mongo-database-commons:maverick-mongo4") api("com.knecon.fforesight:database-tenant-commons:maverick-mongo") api("com.knecon.fforesight:keycloak-commons:maverick-mongo") api("com.knecon.fforesight:tracing-commons:0.5.0") diff --git a/persistence-service-v1/persistence-service-processor-v1/src/main/resources/mongo/changelog/mongo.changelog-tenant.xml b/persistence-service-v1/persistence-service-processor-v1/src/main/resources/mongo/changelog/mongo.changelog-tenant.xml new file mode 100644 index 000000000..688421db8 --- /dev/null +++ b/persistence-service-v1/persistence-service-processor-v1/src/main/resources/mongo/changelog/mongo.changelog-tenant.xml @@ -0,0 +1,7 @@ + + + + diff --git a/persistence-service-v1/persistence-service-processor-v1/src/main/resources/mongo/changelog/tenant/1-initial-database.changelog.xml b/persistence-service-v1/persistence-service-processor-v1/src/main/resources/mongo/changelog/tenant/1-initial-database.changelog.xml new file mode 100644 index 000000000..ed643c742 --- /dev/null +++ b/persistence-service-v1/persistence-service-processor-v1/src/main/resources/mongo/changelog/tenant/1-initial-database.changelog.xml @@ -0,0 +1,222 @@ + + + + + + { + validator: { + $jsonSchema: { + bsonType: "object", + required: ["entryId", "entityLogId", "type", "entryType", "state", "value", "reason", "matchedRule", "legalBasis", "containingNodeId", "closestHeadline", "section", + "positions", "textBefore", "textAfter", "startOffset", "endOffset", "imageHasTransparency", "dictionaryEntry", "dossierDictionaryEntry", "excluded", "changes", + "manualChanges", "engines", "reference", "importedRedactionIntersections", "numberOfComments"], + properties: { + entryId: { + bsonType: "string", + description: "The Entry ID" + }, + entityLogId: { + bsonType: "string", + description: "The Entity Log ID" + }, + type: { + bsonType: "string", + description: "The Type" + }, + entryType: { + bsonType: "string", + description: "The Entry Type" + }, + state: { + bsonType: "string", + description: "The Entry State" + }, + value: { + bsonType: "string", + description: "The Value" + }, + reason: { + bsonType: "string", + description: "The Reason" + }, + matchedRule: { + bsonType: "string", + description: "The Matched Rule" + }, + legalBasis: { + bsonType: "string", + description: "The Legal Basis" + }, + containingNodeId: { + bsonType: "array", + items: { + bsonType: "int", + description: "The Containing Node ID" + } + }, + closestHeadline: { + bsonType: "string", + description: "The Closest Headline" + }, + section: { + bsonType: "string", + description: "The Section" + }, + positions: { + bsonType: "array", + description: "The Positions", + items: { + bsonType: "object" + } + }, + textBefore: { + bsonType: "string", + description: "Text before the entry" + }, + textAfter: { + bsonType: "string", + description: "Text after the entry" + }, + startOffset: { + bsonType: "int", + description: "Start offset of the entry" + }, + endOffset: { + bsonType: "int", + description: "End offset of the entry" + }, + imageHasTransparency: { + bsonType: "bool", + description: "Whether the image has transparency" + }, + dictionaryEntry: { + bsonType: "bool", + description: "Whether it's a dictionary entry" + }, + dossierDictionaryEntry: { + bsonType: "bool", + description: "Whether it's a dossier dictionary entry" + }, + excluded: { + bsonType: "bool", + description: "Whether it's excluded" + }, + changes: { + bsonType: "array", + description: "The Changes", + items: { + bsonType: "object" + } + }, + manualChanges: { + bsonType: "array", + description: "The Manual Changes", + items: { + bsonType: "object" + } + }, + engines: { + bsonType: "array", + description: "The Engines", + items: { + bsonType: "string" + } + }, + reference: { + bsonType: "array", + description: "The Reference", + items: { + bsonType: "string" + } + }, + importedRedactionIntersections: { + bsonType: "array", + description: "The Imported Redaction Intersections", + items: { + bsonType: "string" + } + }, + numberOfComments: { + bsonType: "int", + description: "The Number of Comments" + } + } + } + }, + validationAction: "warn", + validationLevel: "strict" + } + + + + + + { + validator: { + $jsonSchema: { + bsonType: "object", + required: ["dossierId", "fileId", "analysisVersion", "analysisNumber", "entityLogEntryDocument", "legalBasis"], + properties: { + dossierId: { + bsonType: "string", + description: "The Dossier ID" + }, + fileId: { + bsonType: "string", + description: "The File ID" + }, + analysisVersion: { + bsonType: "long", + description: "The Analysis Version" + }, + analysisNumber: { + bsonType: "int", + description: "The Analysis Number" + }, + entityLogEntryDocument: { + bsonType: "array", + description: "The Entity Log Entry Documents", + items: { + bsonType: "objectId" + } + }, + legalBasis: { + bsonType: "array", + description: "The Legal Basis", + items: { + bsonType: "object" + } + }, + dictionaryVersion: { + bsonType: "long", + description: "The Dictionary Version" + }, + dossierDictionaryVersion: { + bsonType: "long", + description: "The Dossier Dictionary Version" + }, + rulesVersion: { + bsonType: "long", + description: "The Rules Version" + }, + legalBasisVersion: { + bsonType: "long", + description: "The Legal Basis Version" + } + } + } + }, + validationAction: "warn", + validationLevel: "strict" + } + + + + + + \ No newline at end of file diff --git a/persistence-service-v1/persistence-service-processor-v1/src/main/resources/mongo/changelog/tenant/2-remove-entry-number-of-comments.changelog.xml b/persistence-service-v1/persistence-service-processor-v1/src/main/resources/mongo/changelog/tenant/2-remove-entry-number-of-comments.changelog.xml new file mode 100644 index 000000000..9665c17b0 --- /dev/null +++ b/persistence-service-v1/persistence-service-processor-v1/src/main/resources/mongo/changelog/tenant/2-remove-entry-number-of-comments.changelog.xml @@ -0,0 +1,26 @@ + + + + + + { + update: "entity-log-entries", + updates: [ + { + q: {}, + u: { $unset: { "numberOfComments": "" } }, + multi: true + } + ] + } + + + + + + \ No newline at end of file diff --git a/persistence-service-v1/persistence-service-server-v1/build.gradle.kts b/persistence-service-v1/persistence-service-server-v1/build.gradle.kts index aaef5e539..521247b80 100644 --- a/persistence-service-v1/persistence-service-server-v1/build.gradle.kts +++ b/persistence-service-v1/persistence-service-server-v1/build.gradle.kts @@ -23,7 +23,6 @@ dependencies { api(project(":persistence-service-external-api-impl-v2")) api(project(":persistence-service-internal-api-impl-v1")) api("com.iqser.red.commons:storage-commons:2.45.0") - api("com.knecon.fforesight:mongo-database-commons:maverick-mongo3") api("junit:junit:4.13.2") api("org.apache.logging.log4j:log4j-slf4j-impl:2.19.0") api("net.logstash.logback:logstash-logback-encoder:7.4") diff --git a/persistence-service-v1/persistence-service-server-v1/src/main/resources/application-dev.yaml b/persistence-service-v1/persistence-service-server-v1/src/main/resources/application-dev.yaml index ca4607034..c6c3cd1d6 100644 --- a/persistence-service-v1/persistence-service-server-v1/src/main/resources/application-dev.yaml +++ b/persistence-service-v1/persistence-service-server-v1/src/main/resources/application-dev.yaml @@ -23,6 +23,9 @@ multitenancy: liquibase: changeLog: classpath:db/changelog/db.changelog-tenant.yaml clear-checksums: true + mongo: + liquibase: + changeLog: classpath:mongo/changelog/mongo.changelog-tenant.xml monitoring:enabled: true cors.enabled: true diff --git a/persistence-service-v1/persistence-service-server-v1/src/main/resources/application.yaml b/persistence-service-v1/persistence-service-server-v1/src/main/resources/application.yaml index 6960236c6..cd7a95353 100644 --- a/persistence-service-v1/persistence-service-server-v1/src/main/resources/application.yaml +++ b/persistence-service-v1/persistence-service-server-v1/src/main/resources/application.yaml @@ -114,6 +114,10 @@ multitenancy: liquibase: changeLog: classpath:db/changelog/db.changelog-tenant.yaml clear-checksums: true + mongo: + liquibase: + changeLog: classpath:mongo/changelog/mongo.changelog-tenant.xml + bucket4j: diff --git a/persistence-service-v1/persistence-service-server-v1/src/test/resources/application.yml b/persistence-service-v1/persistence-service-server-v1/src/test/resources/application.yml index 7f5c1f6a7..7d6a5ccea 100644 --- a/persistence-service-v1/persistence-service-server-v1/src/test/resources/application.yml +++ b/persistence-service-v1/persistence-service-server-v1/src/test/resources/application.yml @@ -110,6 +110,9 @@ multitenancy: prepStmtCacheSqlLimit: 2048 liquibase: changeLog: classpath:db/changelog/db.changelog-tenant.yaml + mongo: + liquibase: + changeLog: classpath:mongo/changelog/mongo.changelog-tenant.xml