From 993de8e06d53c5240e9ef6ea7c670a43103a2b83 Mon Sep 17 00:00:00 2001 From: flaminiaScarciofolo Date: Fri, 29 Nov 2024 10:51:33 +0100 Subject: [PATCH] [SELC-6087] fix findMailUuidAndUpdateUserRegistry method to retrieve workContact id --- apps/user-ms/src/main/docs/openapi.json | 2 +- apps/user-ms/src/main/docs/openapi.yaml | 2 +- .../it/pagopa/selfcare/user/model/UpdateUserRequest.java | 2 +- .../selfcare/user/service/UserRegistryServiceImpl.java | 7 ++++--- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/apps/user-ms/src/main/docs/openapi.json b/apps/user-ms/src/main/docs/openapi.json index ca69cf80..0ffc9925 100644 --- a/apps/user-ms/src/main/docs/openapi.json +++ b/apps/user-ms/src/main/docs/openapi.json @@ -1632,7 +1632,7 @@ "type" : "string" }, "mobilePhone" : { - "pattern" : "^\\+?[0-9]{9,15}$", + "pattern" : "^\\+?[0-9]{7,15}$", "type" : "string" } } diff --git a/apps/user-ms/src/main/docs/openapi.yaml b/apps/user-ms/src/main/docs/openapi.yaml index 822e1c46..3394b481 100644 --- a/apps/user-ms/src/main/docs/openapi.yaml +++ b/apps/user-ms/src/main/docs/openapi.yaml @@ -1191,7 +1191,7 @@ components: email: type: string mobilePhone: - pattern: "^\\+?[0-9]{9,15}$" + pattern: "^\\+?[0-9]{7,15}$" type: string User: required: diff --git a/apps/user-ms/src/main/java/it/pagopa/selfcare/user/model/UpdateUserRequest.java b/apps/user-ms/src/main/java/it/pagopa/selfcare/user/model/UpdateUserRequest.java index 3b167150..a9381996 100644 --- a/apps/user-ms/src/main/java/it/pagopa/selfcare/user/model/UpdateUserRequest.java +++ b/apps/user-ms/src/main/java/it/pagopa/selfcare/user/model/UpdateUserRequest.java @@ -9,6 +9,6 @@ public class UpdateUserRequest { private String name; private String familyName; private String email; - @Pattern(regexp = "^\\+?[0-9]{9,15}$", message = "Il numero di telefono non è valido") + @Pattern(regexp = "^\\+?[0-9]{7,15}$", message = "Il numero di telefono non è valido") private String mobilePhone; } diff --git a/apps/user-ms/src/main/java/it/pagopa/selfcare/user/service/UserRegistryServiceImpl.java b/apps/user-ms/src/main/java/it/pagopa/selfcare/user/service/UserRegistryServiceImpl.java index ad141d0c..13485f30 100644 --- a/apps/user-ms/src/main/java/it/pagopa/selfcare/user/service/UserRegistryServiceImpl.java +++ b/apps/user-ms/src/main/java/it/pagopa/selfcare/user/service/UserRegistryServiceImpl.java @@ -139,11 +139,12 @@ private Uni findMailUuidAndUpdateUserRegistry(UserResource userResource, .filter(stringWorkContactResourceEntry -> existsWorkContactResourceForPhoneAndMail(stringWorkContactResourceEntry, emailToCompare, mobilePhoneToCompare)) .findFirst() .map(Map.Entry::getKey)) - .orElse(null); + .orElse(idContacts); + return updateUsingPATCH(userResource.getId().toString(), - userMapper.toMutableUserFieldsDto(userDto, userResource, idContacts)) - .replaceWith(StringUtils.isBlank(existedUserMailUuid) ? idContacts : existedUserMailUuid); + userMapper.toMutableUserFieldsDto(userDto, userResource, existedUserMailUuid)) + .replaceWith(existedUserMailUuid); } private static boolean existsWorkContactResourceForPhoneAndMail(Map.Entry stringWorkContactResourceEntry, String emailToCompare, String mobilePhoneToCompare) {