Skip to content

Commit

Permalink
fix(infrastructure): upsert entities in scorpio instead of update (#62)
Browse files Browse the repository at this point in the history
* fix(infrastructure): upsert entities in scorpio instead of update

* Update CHANGELOG.md

---------

Co-authored-by: Oriol Canadés <oriol.canades@in2.es>
  • Loading branch information
albertrodriguezin2 and oriolcanades authored Dec 13, 2024
1 parent 7e98f9d commit f201ca8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Retry mechanism for Blockchain Adapter and Context Broker.
- Recover after a failure mechanism for Blockchain Adapter and Context Broker.

## [Released]: v1.0.2
- Change the update entity to allow adding new attributes to the entity.

## [Released]: v1.0.1
- Set startDateTime as non required

## [Released]: v1.0.0
- DOME Participant validation
- P2P synchronization
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ plugins {
}

group = 'es.in2'
version = '1.0.1'
version = '1.0.2'

java {
sourceCompatibility = '17'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,15 @@ public Mono<String> getEntityById(String processId, String entityId) {

@Override
public Mono<Void> updateEntity(String processId, String requestBody) {
String requestBodyAsArray = "[" + requestBody + "]";
return extractEntityIdFromRequestBody(processId, requestBody)
.flatMap(entityId -> {
MediaType mediaType = getContentTypeAndAcceptMediaType(requestBody);
return webClient.patch()
.uri(brokerConfig.getEntitiesPath() + "/" + entityId + "/attrs")
return webClient.post()
.uri(brokerConfig.getEntityOperationsPath() + "/upsert")
.accept(mediaType)
.contentType(mediaType)
.bodyValue(requestBody)
.bodyValue(requestBodyAsArray)
.retrieve()
.bodyToMono(Void.class)
.retry(3);
Expand Down

0 comments on commit f201ca8

Please sign in to comment.