Skip to content

Commit

Permalink
chore: align import generated resources
Browse files Browse the repository at this point in the history
  • Loading branch information
manuraf committed Oct 4, 2024
1 parent 745abd9 commit 5be2c79
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@
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.CertifiableFieldResourceOfstring;
import org.openapi.quarkus.user_registry_json.model.MutableUserFieldsDto;
import org.openapi.quarkus.user_registry_json.model.UserResource;
import org.openapi.quarkus.user_registry_json.model.WorkContactResource;
import org.openapi.quarkus.user_registry_json.model.SaveUserDto;
import org.openapi.quarkus.user_registry_json.model.CertifiableFieldResourceOfLocalDate;

import java.time.LocalDate;
import java.util.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@
import io.smallrye.mutiny.Uni;
import it.pagopa.selfcare.user.entity.UserInstitution;
import it.pagopa.selfcare.user.model.UpdateUserRequest;
import org.openapi.quarkus.user_registry_json.model.*;
import org.openapi.quarkus.user_registry_json.model.SaveUserDto;
import org.openapi.quarkus.user_registry_json.model.UserId;
import org.openapi.quarkus.user_registry_json.model.UserResource;
import org.openapi.quarkus.user_registry_json.model.UserSearchDto;
import org.openapi.quarkus.user_registry_json.model.MutableUserFieldsDto;

import java.util.List;

public interface UserRegistryService {
Uni<List<UserInstitution>> updateUserRegistry(UpdateUserRequest updateUserRequest, String userId, String institutionId);
Uni<UserResource> findByIdUsingGET( String fl, String id);
Uni<UserResource> findByIdUsingGET(String fl, String id);
Uni<UserId> saveUsingPATCH(SaveUserDto saveUserDto);
Uni<UserResource> searchUsingPOST(String fl, UserSearchDto userSearchDto);
Uni<jakarta.ws.rs.core.Response> updateUsingPATCH(String id, MutableUserFieldsDto mutableUserFieldsDto );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
import it.pagopa.selfcare.user.entity.filter.UserInstitutionFilter;
import it.pagopa.selfcare.user.mapper.UserMapper;
import it.pagopa.selfcare.user.model.UpdateUserRequest;
import it.pagopa.selfcare.user.model.UserNotificationToSend;
import it.pagopa.selfcare.user.model.constants.QueueEvent;
import it.pagopa.selfcare.user.util.UserUtils;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import jakarta.ws.rs.WebApplicationException;
Expand All @@ -19,7 +16,11 @@
import org.eclipse.microprofile.rest.client.inject.RestClient;
import org.gradle.internal.impldep.org.apache.commons.lang.StringUtils;
import org.openapi.quarkus.user_registry_json.api.UserApi;
import org.openapi.quarkus.user_registry_json.model.*;
import org.openapi.quarkus.user_registry_json.model.MutableUserFieldsDto;
import org.openapi.quarkus.user_registry_json.model.SaveUserDto;
import org.openapi.quarkus.user_registry_json.model.UserId;
import org.openapi.quarkus.user_registry_json.model.UserResource;
import org.openapi.quarkus.user_registry_json.model.UserSearchDto;

import java.time.Duration;
import java.util.*;
Expand All @@ -35,23 +36,21 @@ public class UserRegistryServiceImpl implements UserRegistryService {
private static final String USERS_FIELD_LIST_WITHOUT_FISCAL_CODE = "name,familyName,email,workContacts";

private final UserInstitutionService userInstitutionService;
private final UserUtils userUtils;
private final UserNotificationService userNotificationService;
private final UserMapper userMapper;

@ConfigProperty(name = "user-ms.retry.min-backoff")
private Integer retryMinBackOff;
Integer retryMinBackOff;

@ConfigProperty(name = "user-ms.retry.max-backoff")
private Integer retryMaxBackOff;
Integer retryMaxBackOff;

@ConfigProperty(name = "user-ms.retry")
private Integer maxRetry;
Integer maxRetry;


@RestClient
@Inject
private UserApi userRegistryApi;
UserApi userRegistryApi;

@Override
public Uni<UserResource> findByIdUsingGET(String fl, String id) {
Expand Down Expand Up @@ -107,12 +106,12 @@ public Uni<List<UserInstitution>> updateUserRegistry(UpdateUserRequest updateUse
.onItem().ifNotNull().invoke(() -> log.debug("UserInstitution founded for userId: {} and institutionId: {}", userId, institutionId)))
.asTuple()
.onItem().transformToMulti(tuple -> findMailUuidAndUpdateUserRegistry(tuple.getItem1(), updateUserRequest)
.onItem().transformToMulti(uuidMail -> updateUserInstitution(tuple.getItem1(), tuple.getItem2(), uuidMail)))
.onItem().transformToMulti(uuidMail -> updateUserInstitution(tuple.getItem2(), uuidMail)))
.collect().asList()
.onItem().invoke(items -> log.trace("update {} users on userRegistry", items.size()));
}

private Multi<UserInstitution> updateUserInstitution(UserResource userResource, List<UserInstitution> userInstitutions, String mailUuid) {
private Multi<UserInstitution> updateUserInstitution(List<UserInstitution> userInstitutions, String mailUuid) {
return Multi.createFrom().iterable(userInstitutions.stream()
.peek(userInstitution -> userInstitution.setUserMailUuid(mailUuid))
.toList())
Expand Down

0 comments on commit 5be2c79

Please sign in to comment.