diff --git a/src/main/kotlin/no/fdk/concept_catalog/configuration/ApplicationProperties.kt b/src/main/kotlin/no/fdk/concept_catalog/configuration/ApplicationProperties.kt index 199b3703..9bc90efb 100644 --- a/src/main/kotlin/no/fdk/concept_catalog/configuration/ApplicationProperties.kt +++ b/src/main/kotlin/no/fdk/concept_catalog/configuration/ApplicationProperties.kt @@ -6,6 +6,5 @@ import org.springframework.boot.context.properties.ConfigurationProperties data class ApplicationProperties( val collectionBaseUri: String, val historyServiceUri: String, - val adminServiceUri: String, - val namespace: String + val adminServiceUri: String ) diff --git a/src/main/kotlin/no/fdk/concept_catalog/service/ConceptService.kt b/src/main/kotlin/no/fdk/concept_catalog/service/ConceptService.kt index b7dc9f7e..228d2738 100644 --- a/src/main/kotlin/no/fdk/concept_catalog/service/ConceptService.kt +++ b/src/main/kotlin/no/fdk/concept_catalog/service/ConceptService.kt @@ -153,16 +153,19 @@ class ConceptService( return saveConceptsAndUpdateHistory(mapOf(Pair(patched, operations)), user, jwt).first() } - private fun saveConceptsAndUpdateHistory(conceptsAndOperations: Map>, user: User, jwt: Jwt) = - if (applicationProperties.namespace == "staging") { - val locations = conceptsAndOperations.map { historyService.updateHistory(it.key, it.value, user, jwt) } - try { - conceptRepository.saveAll(conceptsAndOperations.keys).map { it.withHighestVersionDTO() } - } catch (ex: Exception) { - locations.filterNotNull().forEach { historyService.removeHistoryUpdate(it, jwt) } - throw ex - } - } else conceptRepository.saveAll(conceptsAndOperations.keys).map { it.withHighestVersionDTO() } + private fun saveConceptsAndUpdateHistory( + conceptsAndOperations: Map>, + user: User, + jwt: Jwt + ): List { + val locations = conceptsAndOperations.map { historyService.updateHistory(it.key, it.value, user, jwt) } + try { + return conceptRepository.saveAll(conceptsAndOperations.keys).map { it.withHighestVersionDTO() } + } catch (ex: Exception) { + locations.filterNotNull().forEach { historyService.removeHistoryUpdate(it, jwt) } + throw ex + } + } fun isPublishedAndNotValid(concept: Begrep): Boolean { val published = getLastPublished(concept.originaltBegrep) diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 5911ac47..f5e1f2f4 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -28,7 +28,6 @@ application: collectionBaseUri: ${COLLECTION_BASE_URI:https://concept-catalog.fellesdatakatalog.digdir.no} historyServiceUri: ${CATALOG_HISTORY_SERVICE_URI:http://localhost:9090} adminServiceUri: ${CATALOG_ADMIN_SERVICE_URI:https://catalog-admin-service.fellesdatakatalog.digdir.no} - namespace: ${NAMESPACE:staging} --- spring: