Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SELC-6087] Fix: findMailUuidAndUpdateUserRegistry method to retrieve workContact id #235

Merged
merged 6 commits into from
Nov 29, 2024
Merged
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
Loading