Skip to content

Commit

Permalink
[SELC-6087] Fix: findMailUuidAndUpdateUserRegistry method to retrieve…
Browse files Browse the repository at this point in the history
… workContact id (#235)
  • Loading branch information
flaminiaScarciofolo authored Nov 29, 2024
1 parent a59271a commit 167cfab
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion apps/user-ms/src/main/docs/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1632,7 +1632,7 @@
"type" : "string"
},
"mobilePhone" : {
"pattern" : "^\\+?[0-9]{9,15}$",
"pattern" : "^\\+?[0-9]{7,15}$",
"type" : "string"
}
}
Expand Down
2 changes: 1 addition & 1 deletion apps/user-ms/src/main/docs/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1191,7 +1191,7 @@ components:
email:
type: string
mobilePhone:
pattern: "^\\+?[0-9]{9,15}$"
pattern: "^\\+?[0-9]{7,15}$"
type: string
User:
required:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,15 @@
import org.mapstruct.Mapping;
import org.mapstruct.Named;
import org.mapstruct.factory.Mappers;
import org.openapi.quarkus.user_registry_json.model.*;
import org.openapi.quarkus.user_registry_json.model.BirthDateCertifiableSchema;
import org.openapi.quarkus.user_registry_json.model.EmailCertifiableSchema;
import org.openapi.quarkus.user_registry_json.model.FamilyNameCertifiableSchema;
import org.openapi.quarkus.user_registry_json.model.MobilePhoneCertifiableSchema;
import org.openapi.quarkus.user_registry_json.model.MutableUserFieldsDto;
import org.openapi.quarkus.user_registry_json.model.NameCertifiableSchema;
import org.openapi.quarkus.user_registry_json.model.SaveUserDto;
import org.openapi.quarkus.user_registry_json.model.UserResource;
import org.openapi.quarkus.user_registry_json.model.WorkContactResource;

import java.time.LocalDate;
import java.util.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,12 @@ private Uni<String> 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<String, WorkContactResource> stringWorkContactResourceEntry, String emailToCompare, String mobilePhoneToCompare) {
Expand Down

0 comments on commit 167cfab

Please sign in to comment.