Skip to content

Commit

Permalink
Api fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitolo-Andrea committed Dec 13, 2024
1 parent 31dbfa8 commit 9692ff6
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,14 @@ public Mono<CitizenConsentDTO> createCitizenConsent(String fiscalCode, String tp
.flatMap(tppResponse -> citizenRepository.findByFiscalCode(fiscalCode)
.flatMap(citizenConsent -> {
if (!citizenConsent.getConsents().containsKey(tppId)) {
citizenConsent.getConsents().put(tppId, ConsentDetails.builder()
citizenConsent
.getConsents().put(tppId, ConsentDetails.builder()
.tppState(true)
.tcDate(LocalDateTime.now())
.build());
citizenRepository.save(citizenConsent);
citizenRepository
.save(citizenConsent)
.doOnSuccess(savedConsent -> bloomFilterService.add(fiscalCode));
}
Map<String, ConsentDetails> consents = new HashMap<>();
consents.put(tppId, citizenConsent.getConsents().get(tppId));
Expand All @@ -77,9 +80,9 @@ public Mono<CitizenConsentDTO> createCitizenConsent(String fiscalCode, String tp
.build();
return citizenRepository
.save(citizenConsentToSave)
.map(mapperToDTO::map);
.map(mapperToDTO::map)
.doOnSuccess(savedConsent -> bloomFilterService.add(fiscalCode));
}))
.doOnSuccess(savedConsent -> bloomFilterService.add(fiscalCode))
)
.doOnSuccess(savedConsent -> log.info("[EMD][CREATE-CITIZEN-CONSENT] Created new citizen consent for fiscal code: {}", Utils.createSHA256(fiscalCode)));
}
Expand Down

0 comments on commit 9692ff6

Please sign in to comment.