From f83faa6f366da385f4c6b668474ffd599adcf9df Mon Sep 17 00:00:00 2001 From: Giulia Tremolada Date: Thu, 21 Nov 2024 12:46:28 +0100 Subject: [PATCH] add createdAt and fiscalCode fields --- app/src/main/resources/swagger/api-docs.json | 9 +++++++++ .../dashboard/connector/model/user/ProductInfo.java | 2 ++ .../connector/rest/model/mapper/UserMapper.java | 2 +- .../selfcare/dashboard/web/model/mapper/UserMapper.java | 2 ++ .../dashboard/web/model/product/ProductUserResource.java | 7 +++++++ web/src/main/resources/swagger/swagger_en.properties | 1 + 6 files changed, 22 insertions(+), 1 deletion(-) diff --git a/app/src/main/resources/swagger/api-docs.json b/app/src/main/resources/swagger/api-docs.json index 64ec83690..754bf89f1 100644 --- a/app/src/main/resources/swagger/api-docs.json +++ b/app/src/main/resources/swagger/api-docs.json @@ -4003,10 +4003,19 @@ "title" : "ProductUserResource", "type" : "object", "properties" : { + "createdAt" : { + "type" : "string", + "description" : "User's creation date associated with a product", + "format" : "date-time" + }, "email" : { "type" : "string", "description" : "User's personal email" }, + "fiscalCode" : { + "type" : "string", + "description" : "User's fiscal code" + }, "id" : { "type" : "string", "description" : "User's unique identifier", diff --git a/connector-api/src/main/java/it/pagopa/selfcare/dashboard/connector/model/user/ProductInfo.java b/connector-api/src/main/java/it/pagopa/selfcare/dashboard/connector/model/user/ProductInfo.java index e5f46fdf6..20b162915 100644 --- a/connector-api/src/main/java/it/pagopa/selfcare/dashboard/connector/model/user/ProductInfo.java +++ b/connector-api/src/main/java/it/pagopa/selfcare/dashboard/connector/model/user/ProductInfo.java @@ -2,6 +2,7 @@ import lombok.Data; +import java.time.LocalDateTime; import java.util.List; @Data @@ -10,5 +11,6 @@ public class ProductInfo { private String id; private String title; private List roleInfos; + private LocalDateTime createdAt; } diff --git a/connector/rest/src/main/java/it/pagopa/selfcare/dashboard/connector/rest/model/mapper/UserMapper.java b/connector/rest/src/main/java/it/pagopa/selfcare/dashboard/connector/rest/model/mapper/UserMapper.java index 12e50ec55..21076161d 100644 --- a/connector/rest/src/main/java/it/pagopa/selfcare/dashboard/connector/rest/model/mapper/UserMapper.java +++ b/connector/rest/src/main/java/it/pagopa/selfcare/dashboard/connector/rest/model/mapper/UserMapper.java @@ -3,7 +3,6 @@ import it.pagopa.selfcare.dashboard.connector.model.user.User; import it.pagopa.selfcare.dashboard.connector.model.user.*; import it.pagopa.selfcare.user.generated.openapi.v1.dto.*; -import it.pagopa.selfcare.user.generated.openapi.v1.dto.UserInstitutionWithActions; import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.mapstruct.Named; @@ -92,6 +91,7 @@ default Map toProductInfoMap(List onboardedProducts.forEach(onboardedProduct -> { RoleInfo roleInfo = new RoleInfo(); productInfo.setId(onboardedProduct.getProductId()); + productInfo.setCreatedAt(onboardedProduct.getCreatedAt()); roleInfo.setRole(onboardedProduct.getProductRole()); roleInfo.setStatus(onboardedProduct.getStatus().name()); roleInfo.setSelcRole(it.pagopa.selfcare.commons.base.security.PartyRole.valueOf(onboardedProduct.getRole()).getSelfCareAuthority()); diff --git a/web/src/main/java/it/pagopa/selfcare/dashboard/web/model/mapper/UserMapper.java b/web/src/main/java/it/pagopa/selfcare/dashboard/web/model/mapper/UserMapper.java index 2a9263e3a..193212117 100644 --- a/web/src/main/java/it/pagopa/selfcare/dashboard/web/model/mapper/UserMapper.java +++ b/web/src/main/java/it/pagopa/selfcare/dashboard/web/model/mapper/UserMapper.java @@ -154,6 +154,7 @@ public static List toProductUsers(UserInfo model) { if (model.getUser() != null) { resource.setName(CertifiedFieldMapper.toValue(model.getUser().getName())); resource.setSurname(CertifiedFieldMapper.toValue(model.getUser().getFamilyName())); + resource.setFiscalCode(model.getUser().getFiscalCode()); Optional.ofNullable(model.getUser().getWorkContacts()) .map(map -> map.get(model.getUserMailUuid())) .map(WorkContact::getEmail) @@ -161,6 +162,7 @@ public static List toProductUsers(UserInfo model) { .ifPresent(resource::setEmail); } resource.setProduct(UserMapper.toUserProductInfoResource(productInfo)); + resource.setCreatedAt(productInfo.getCreatedAt()); response.add(resource); }); } diff --git a/web/src/main/java/it/pagopa/selfcare/dashboard/web/model/product/ProductUserResource.java b/web/src/main/java/it/pagopa/selfcare/dashboard/web/model/product/ProductUserResource.java index 83c94e2cd..3bc71289e 100644 --- a/web/src/main/java/it/pagopa/selfcare/dashboard/web/model/product/ProductUserResource.java +++ b/web/src/main/java/it/pagopa/selfcare/dashboard/web/model/product/ProductUserResource.java @@ -16,6 +16,7 @@ import it.pagopa.selfcare.commons.base.security.SelfCareAuthority; import lombok.Data; +import java.time.LocalDateTime; import java.util.UUID; @Data @@ -30,6 +31,9 @@ public class ProductUserResource { @ApiModelProperty(value = "${swagger.dashboard.user.model.surname}") private String surname; + @ApiModelProperty(value = "${swagger.dashboard.user.model.fiscalCode}") + private String fiscalCode; + @ApiModelProperty(value = "${swagger.dashboard.user.model.email}") private String email; @@ -42,5 +46,8 @@ public class ProductUserResource { @ApiModelProperty(value = "${swagger.dashboard.user.model.status}") private String status; + @ApiModelProperty(value = "${swagger.dashboard.user.model.createdAt}") + private LocalDateTime createdAt; + } diff --git a/web/src/main/resources/swagger/swagger_en.properties b/web/src/main/resources/swagger/swagger_en.properties index 8bd4c72a9..70beb4e95 100644 --- a/web/src/main/resources/swagger/swagger_en.properties +++ b/web/src/main/resources/swagger/swagger_en.properties @@ -105,6 +105,7 @@ swagger.dashboard.user.model.workContacts=User's workcontacts, contains the emai swagger.dashboard.user.model.institutionalEmail=User's institutional email swagger.dashboard.user.model.role=User's role, available value: [MANAGER, DELEGATE, SUBDELEGATE, OPERATOR, ADMIN_EA] swagger.dashboard.user.model.fields=Fields to retrieve from pdv when searching for user +swagger.dashboard.user.model.createdAt=User's creation date associated with a product swagger.dashboard.products.model.roleInfos=User's role infos in product swagger.dashboard.user.model.productRoles=User's roles in product swagger.dashboard.user.model.productRole=User's role in product