Skip to content

Commit

Permalink
[SELC-6084] feat: add mobilePhone in getUserById and getInstitutionUs…
Browse files Browse the repository at this point in the history
…er response (#500)
  • Loading branch information
giulia-tremolada authored Nov 29, 2024
1 parent 2e9dedd commit 2427db9
Show file tree
Hide file tree
Showing 18 changed files with 52 additions and 6 deletions.
8 changes: 8 additions & 0 deletions app/src/main/resources/swagger/api-docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -3667,6 +3667,10 @@
"description" : "User's unique identifier",
"format" : "uuid"
},
"mobilePhone" : {
"type" : "string",
"description" : "User's institutional phone number"
},
"name" : {
"type" : "string",
"description" : "User's name"
Expand Down Expand Up @@ -4489,6 +4493,10 @@
"description" : "User's unique identifier",
"format" : "uuid"
},
"mobilePhone" : {
"description" : "User's institutional phone number",
"$ref" : "#/components/schemas/CertifiedFieldResourceOfstring"
},
"name" : {
"description" : "User's name",
"$ref" : "#/components/schemas/CertifiedFieldResourceOfstring"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class User {
private CertifiedField<String> name;
private CertifiedField<String> familyName;
private CertifiedField<String> email;
private CertifiedField<String> mobilePhone;
private Map<String, WorkContact> workContacts;


Expand Down
3 changes: 3 additions & 0 deletions connector/rest/docs/openapi/selfcare-user-docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -1898,6 +1898,9 @@
"email" : {
"type" : "string"
},
"mobilePhone" : {
"type" : "string"
},
"workContacts" : {
"type" : "object",
"additionalProperties" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ default CertifiedField<String> toCertifiedField(CertifiableFieldResponseString f
@Mapping(target = "name", expression = "java(toCertifiedField(response.getName()))")
@Mapping(target = "familyName", expression = "java(toCertifiedField(response.getFamilyName()))")
@Mapping(target = "email", expression = "java(toCertifiedField(response.getEmail()))")
@Mapping(target = "mobilePhone", expression = "java(toCertifiedField(response.getMobilePhone()))")
@Mapping(target = "workContacts", expression = "java(toCertifiedWorkContact(response.getWorkContacts()))")
User toUser(UserDetailResponse response);

Expand All @@ -38,6 +39,7 @@ default CertifiedField<String> toCertifiedField(CertifiableFieldResponseString f
@Mapping(target = "user.name", expression = "java(toCertifiedField(userResponse.getName()))")
@Mapping(target = "user.familyName", expression = "java(toCertifiedField(userResponse.getSurname()))")
@Mapping(target = "user.email", expression = "java(toCertifiedField(userResponse.getEmail()))")
@Mapping(target = "user.mobilePhone", expression = "java(toCertifiedField(userResponse.getMobilePhone()))")
@Mapping(target = "user.workContacts", expression = "java(toUserInfoContacts(userResponse.getWorkContacts()))")
@Mapping(target = "role", expression = "java(it.pagopa.selfcare.commons.base.security.PartyRole.valueOf(userDashboardResponse.getRole()).getSelfCareAuthority())")
@Mapping(target = "products", expression = "java(toProductInfoMap(userDashboardResponse.getProducts()))")
Expand Down
3 changes: 3 additions & 0 deletions connector/rest/src/test/resources/stubs/User.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"email": {
"value": "[email protected]"
},
"mobilePhone": {
"value": "0000000000"
},
"workContacts": {
"institution1": {
"email": {
Expand Down
9 changes: 5 additions & 4 deletions connector/rest/src/test/resources/stubs/UserDataResponse.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@
],
"userResponse": {
"id": "id",
"taxCode": "name",
"name": "email",
"surname": "ACTIVE",
"email": "2020-01-01T00:00:00Z",
"taxCode": "taxCode",
"name": "name",
"surname": "surname",
"email": "email",
"mobilePhone": "phone",
"workContacts": null
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"email": {
"value": "[email protected]"
},
"mobilePhone": {
"value": "0000000000"
},
"workContacts": {
"institution1": {
"email": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ public interface InstitutionV2Service {

UserInfo getInstitutionUser(String institutionId, String userId, String loggedUserId);


Institution findInstitutionById(String institutionId);

Boolean verifyIfExistsPendingOnboarding(String taxCode, String subunitCode, String productId);
Expand Down
3 changes: 3 additions & 0 deletions core/src/test/resources/expectations/User.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"email": {
"value": "[email protected]"
},
"mobilePhone": {
"value": "0000000000"
},
"workContacts": {
"institution1": {
"email": {
Expand Down
3 changes: 3 additions & 0 deletions core/src/test/resources/expectations/UserInfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
"email": {
"value": "[email protected]"
},
"mobilePhone": {
"value": "0000000000"
},
"workContacts": {
"institution1": {
"email": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ public class InstitutionUserResource {
@ApiModelProperty(value = "${swagger.dashboard.user.model.email}")
private String email;

@ApiModelProperty(value = "${swagger.dashboard.user.model.institutionalPhone}")
private String mobilePhone;

@ApiModelProperty(value = "${swagger.dashboard.user.model.role}")
private SelfCareAuthority role;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ private static <T extends InstitutionUserResource> T toInstitutionUser(UserInfo
resource.setName(CertifiedFieldMapper.toValue(model.getUser().getName()));
resource.setSurname(CertifiedFieldMapper.toValue(model.getUser().getFamilyName()));
resource.setEmail(CertifiedFieldMapper.toValue(model.getUser().getEmail()));
resource.setMobilePhone(CertifiedFieldMapper.toValue(model.getUser().getMobilePhone()));
}
if (model.getProducts() != null) {
resource.setProducts(model.getProducts().values().stream()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package it.pagopa.selfcare.dashboard.web.model.mapper;

import it.pagopa.selfcare.dashboard.connector.exception.InvalidRequestException;
import it.pagopa.selfcare.dashboard.connector.model.user.*;
import it.pagopa.selfcare.dashboard.web.model.UpdateUserDto;
import it.pagopa.selfcare.dashboard.web.model.user.CertifiedFieldResource;
Expand All @@ -22,6 +21,7 @@ public interface UserMapperV2 {
@Mapping(target = "name", expression = "java(toCertifiedFieldResource(model.getName()))")
@Mapping(target = "familyName", expression = "java(toCertifiedFieldResource(model.getFamilyName()))")
@Mapping(target = "email", expression = "java(toCertifiedFieldResource(model.getEmail()))")
@Mapping(target = "mobilePhone", expression = "java(toCertifiedFieldResource(model.getMobilePhone()))")
UserResource toUserResource(User model);

UpdateUserRequestDto fromUpdateUser(UpdateUserDto userDto);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ public class UserResource {
@ApiModelProperty(value = "${swagger.dashboard.user.model.institutionalEmail}")
private CertifiedFieldResource<String> email;

@ApiModelProperty(value = "${swagger.dashboard.user.model.institutionalPhone}")
private CertifiedFieldResource<String> mobilePhone;

@ApiModelProperty(value = "${swagger.dashboard.user.model.fiscalCode}")
private String fiscalCode;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"name": "string",
"surname": "string",
"email": "string",
"mobilePhone": "string",
"role": "ADMIN",
"status": "string",
"products": [
Expand Down
4 changes: 4 additions & 0 deletions web/src/test/resources/json/User.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
"certification": "SPID",
"value": "[email protected]"
},
"mobilePhone": {
"certification": "SPID",
"value": "0000000000"
},
"workContacts": {
"contact1": {
"email": {
Expand Down
4 changes: 4 additions & 0 deletions web/src/test/resources/json/UserInfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
"certification": "NONE",
"value": "string"
},
"mobilePhone": {
"certification": "NONE",
"value": "string"
},
"workContacts": {
"string": {
"email": {
Expand Down
4 changes: 4 additions & 0 deletions web/src/test/resources/json/UserResource.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
"certified": true,
"value": "[email protected]"
},
"mobilePhone": {
"certified": true,
"value": "0000000000"
},
"fiscalCode": "fiscalCode",
"workContacts": {
"contact1": {
Expand Down

0 comments on commit 2427db9

Please sign in to comment.