From 723fb8e743072e0eb69aca3876e5da7050fadf01 Mon Sep 17 00:00:00 2001 From: Fabian Engelniederhammer Date: Wed, 24 Jan 2024 09:46:43 +0100 Subject: [PATCH] feat(backend): add group that a sequence entry for submitted by to metadata in SILO #778 --- .../main/kotlin/org/loculus/backend/model/ReleasedDataModel.kt | 1 + .../backend/service/submission/SubmissionDatabaseService.kt | 3 +++ .../controller/submission/GetReleasedDataEndpointTest.kt | 3 +++ kubernetes/loculus/templates/_common-metadata.tpl | 2 ++ 4 files changed, 9 insertions(+) diff --git a/backend/src/main/kotlin/org/loculus/backend/model/ReleasedDataModel.kt b/backend/src/main/kotlin/org/loculus/backend/model/ReleasedDataModel.kt index 9b74b3917..5696f9f17 100644 --- a/backend/src/main/kotlin/org/loculus/backend/model/ReleasedDataModel.kt +++ b/backend/src/main/kotlin/org/loculus/backend/model/ReleasedDataModel.kt @@ -45,6 +45,7 @@ class ReleasedDataModel(private val submissionDatabaseService: SubmissionDatabas ("accessionVersion" to TextNode(rawProcessedData.displayAccessionVersion())) + ("isRevocation" to TextNode(rawProcessedData.isRevocation.toString())) + ("submitter" to TextNode(rawProcessedData.submitter)) + + ("group" to TextNode(rawProcessedData.group)) + ("submittedAt" to LongNode(rawProcessedData.submittedAt.toTimestamp())) + ("releasedAt" to LongNode(rawProcessedData.releasedAt.toTimestamp())) + ("versionStatus" to TextNode(siloVersionStatus.name)) diff --git a/backend/src/main/kotlin/org/loculus/backend/service/submission/SubmissionDatabaseService.kt b/backend/src/main/kotlin/org/loculus/backend/service/submission/SubmissionDatabaseService.kt index 80665571c..f6f24d31a 100644 --- a/backend/src/main/kotlin/org/loculus/backend/service/submission/SubmissionDatabaseService.kt +++ b/backend/src/main/kotlin/org/loculus/backend/service/submission/SubmissionDatabaseService.kt @@ -268,6 +268,7 @@ class SubmissionDatabaseService( table.isRevocationColumn, table.processedDataColumn, table.submitterColumn, + table.groupNameColumn, table.submittedAtColumn, table.releasedAtColumn, table.submissionIdColumn, @@ -281,6 +282,7 @@ class SubmissionDatabaseService( version = it[table.versionColumn], isRevocation = it[table.isRevocationColumn], submitter = it[table.submitterColumn], + group = it[table.groupNameColumn], submissionId = it[table.submissionIdColumn], processedData = it[table.processedDataColumn]!!, submittedAt = it[table.submittedAtColumn], @@ -572,6 +574,7 @@ data class RawProcessedData( override val version: Version, val isRevocation: Boolean, val submitter: String, + val group: String, val submittedAt: LocalDateTime, val releasedAt: LocalDateTime, val submissionId: String, diff --git a/backend/src/test/kotlin/org/loculus/backend/controller/submission/GetReleasedDataEndpointTest.kt b/backend/src/test/kotlin/org/loculus/backend/controller/submission/GetReleasedDataEndpointTest.kt index 3a0e465b1..cbc44cfb7 100644 --- a/backend/src/test/kotlin/org/loculus/backend/controller/submission/GetReleasedDataEndpointTest.kt +++ b/backend/src/test/kotlin/org/loculus/backend/controller/submission/GetReleasedDataEndpointTest.kt @@ -15,6 +15,7 @@ import org.junit.jupiter.api.Test import org.loculus.backend.api.AccessionVersion import org.loculus.backend.api.ProcessedData import org.loculus.backend.api.SiloVersionStatus +import org.loculus.backend.controller.DEFAULT_GROUP_NAME import org.loculus.backend.controller.EndpointTest import org.loculus.backend.controller.expectForbiddenResponse import org.loculus.backend.controller.expectNdjsonAndGetContent @@ -80,6 +81,7 @@ class GetReleasedDataEndpointTest( "accessionVersion" to TextNode("$id.$version"), "isRevocation" to TextNode("false"), "submitter" to TextNode(DEFAULT_USER_NAME), + "group" to TextNode(DEFAULT_GROUP_NAME), "versionStatus" to TextNode("LATEST_VERSION"), ) @@ -178,6 +180,7 @@ class GetReleasedDataEndpointTest( "submittedAt" -> expectIsTimestampWithCurrentYear(value) "releasedAt" -> expectIsTimestampWithCurrentYear(value) "submitter" -> assertThat(value, `is`(TextNode(DEFAULT_USER_NAME))) + "group" -> assertThat(value, `is`(TextNode(DEFAULT_GROUP_NAME))) "accession", "version", "accessionVersion", "submissionId" -> {} else -> assertThat("value for $key", value, `is`(NullNode.instance)) } diff --git a/kubernetes/loculus/templates/_common-metadata.tpl b/kubernetes/loculus/templates/_common-metadata.tpl index 81bb55ef7..768f8aed7 100644 --- a/kubernetes/loculus/templates/_common-metadata.tpl +++ b/kubernetes/loculus/templates/_common-metadata.tpl @@ -15,6 +15,8 @@ fields: notSearchable: true - name: submitter type: string + - name: group + type: string - name: submittedAt type: timestamp - name: releasedAt