Skip to content

Commit

Permalink
add createdAt and fiscalCode fields
Browse files Browse the repository at this point in the history
  • Loading branch information
giulia-tremolada committed Nov 21, 2024
1 parent 7fb0aa0 commit f83faa6
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 1 deletion.
9 changes: 9 additions & 0 deletions app/src/main/resources/swagger/api-docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import lombok.Data;

import java.time.LocalDateTime;
import java.util.List;

@Data
Expand All @@ -10,5 +11,6 @@ public class ProductInfo {
private String id;
private String title;
private List<RoleInfo> roleInfos;
private LocalDateTime createdAt;

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -92,6 +91,7 @@ default Map<String, ProductInfo> toProductInfoMap(List<OnboardedProductResponse>
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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,15 @@ public static List<ProductUserResource> 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)
.map(CertifiedFieldMapper::toValue)
.ifPresent(resource::setEmail);
}
resource.setProduct(UserMapper.toUserProductInfoResource(productInfo));
resource.setCreatedAt(productInfo.getCreatedAt());
response.add(resource);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import it.pagopa.selfcare.commons.base.security.SelfCareAuthority;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.UUID;

@Data
Expand All @@ -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;

Expand All @@ -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;


}
1 change: 1 addition & 0 deletions web/src/main/resources/swagger/swagger_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f83faa6

Please sign in to comment.