Skip to content

Commit

Permalink
fix(core): entities core members are not processed in batch operations (
Browse files Browse the repository at this point in the history
  • Loading branch information
bobeal authored Apr 16, 2024
1 parent 2cc731c commit 93febc4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ class EntityOperationService(
temporalEntityAttributeService.deleteTemporalAttributesOfEntity(ngsiLdEntity.id).bind()
val updateResult = entityPayloadService.appendAttributes(
ngsiLdEntity.id,
jsonLdEntity.getAttributes(),
jsonLdEntity.getModifiableMembers(),
disallowOverwrite,
sub
).bind()
Expand Down Expand Up @@ -233,7 +233,7 @@ class EntityOperationService(
val (jsonLdEntity, ngsiLdEntity) = entity
val updateResult = entityPayloadService.appendAttributes(
ngsiLdEntity.id,
jsonLdEntity.getAttributes(),
jsonLdEntity.getModifiableMembers(),
disallowOverwrite,
sub
).bind()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ class EntityPayloadServiceTests : WithTimescaleContainer, WithKafkaContainer {

entityPayloadService.mergeEntity(
beehiveTestCId,
jsonLdEntity.getAttributes(),
jsonLdEntity.getModifiableMembers(),
now,
"0123456789-1234-5678-987654321"
).shouldSucceed()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import arrow.core.Either
import arrow.core.left
import arrow.core.right
import com.egm.stellio.shared.util.JsonLdUtils
import com.egm.stellio.shared.util.JsonLdUtils.JSONLD_CONTEXT
import com.egm.stellio.shared.util.JsonLdUtils.JSONLD_EXPANDED_ENTITY_CORE_MEMBERS
import com.egm.stellio.shared.util.JsonLdUtils.JSONLD_ID
import com.egm.stellio.shared.util.JsonLdUtils.JSONLD_TYPE
Expand All @@ -28,6 +29,10 @@ data class ExpandedEntity(
members.filter { !JSONLD_EXPANDED_ENTITY_CORE_MEMBERS.contains(it.key) }
.mapValues { castAttributeValue(it.value) }

fun getModifiableMembers(): ExpandedAttributes =
members.filter { !listOf(JSONLD_ID, JSONLD_CONTEXT).contains(it.key) }
.mapValues { castAttributeValue(it.value) }

fun getScopes(): List<String>? =
(members as Map<String, List<Any>>).getScopes()

Expand Down

0 comments on commit 93febc4

Please sign in to comment.