When getting just the email for invitation, find it's user and set it's

id to the invited user
This commit is contained in:
George Kalampokis 2020-09-28 12:36:37 +03:00
parent 5a5043f432
commit 08271c88cb
1 changed files with 4 additions and 0 deletions

View File

@ -35,6 +35,10 @@ public class InvitationsManager {
public void inviteUsers(Invitation invitation, Principal principal) throws Exception {
UserInfo principalUser = new UserInfo();
principalUser.setId(principal.getId());
invitation.getUsers().stream().filter(item -> item.getId() == null).forEach(item -> {
UUID id = apiContext.getOperationsContext().getDatabaseRepository().getUserInfoDao().asQueryable().where((builder, root) -> builder.equal(root.get("email"), item.getEmail())).getSingle().getId();
item.setId(id);
});
List<UserInfoInvitationModel> alreadySignedInUsers = invitation.getUsers().stream().filter(item -> item.getId() != null).collect(Collectors.toList());
List<UserInfo> alreadySignedInUsersEntities = alreadySignedInUsers.stream().map(UserInfoInvitationModel::toDataModel).collect(Collectors.toList());
List<UserDMP> userInfoToUserDmp = new LinkedList<>();