Skip to content
Snippets Groups Projects
Commit adf3ec19 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-4606 add email to grpc profile data

parent d1318d08
Branches
Tags
No related merge requests found
......@@ -33,6 +33,7 @@ message GrpcUserProfile {
string id = 1;
string firstName = 2;
string lastName = 3;
string email = 4;
}
......
......@@ -25,16 +25,26 @@ package de.ozgcloud.user.userprofile;
import org.bson.types.ObjectId;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.NullValueCheckStrategy;
import org.mapstruct.ReportingPolicy;
import de.ozgcloud.user.User;
@Mapper(unmappedTargetPolicy = ReportingPolicy.WARN, //
unmappedSourcePolicy = ReportingPolicy.WARN, //
nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
interface UserProfileMapper {
@Mapping(target = "emailBytes", ignore = true)
@Mapping(target = "mergeFrom", ignore = true)
@Mapping(target = "clearField", ignore = true)
@Mapping(target = "clearOneof", ignore = true)
@Mapping(target = "mergeUnknownFields", ignore = true)
@Mapping(target = "firstNameBytes", ignore = true)
@Mapping(target = "idBytes", ignore = true)
@Mapping(target = "lastNameBytes", ignore = true)
@Mapping(target = "unknownFields", ignore = true)
@Mapping(target = "allFields", ignore = true)
GrpcUserProfile mapTo(User userProfile);
default String toString(ObjectId objectId) {
......
......@@ -56,6 +56,13 @@ class UserProfileMapperTest {
assertThat(userProfile.getLastName()).isEqualTo(UserTestFactory.LAST_NAME);
}
@Test
void shouldMapEMail() {
var userProfile = map();
assertThat(userProfile.getEmail()).isEqualTo(UserTestFactory.EMAIL);
}
@Test
void shouldMapId() {
var userProfile = map();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment