Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def confirmCode(
- userModel: UserModel,
- confirmationCodeType: ConfirmationCodeType,
- confirmationCode: String,
- newPhone: String
- ): DBIO[Either[Throwable, UpdateUserResult]] = {
- (for {
- code <- findActiveCode(confirmationCode, confirmationCodeType) eitherT
- _ <- confirmCodeByIdAndBindUserToIt(code.id, userId, now) eitherT
- _ <- updateUnconfirmedPhoneOrUserPhone(confirmationCodeType, userModel, newPhone) eitherT
- _ <- deactivateCodesByUser(userModel, confirmationCodeType) eitherT
- newCode <- autoCreateNewPhoneConfirmationCodeIfOldPhoneConfirmed(
- confirmationCodeType,
- userModel,
- newPhone) eitherT
- userUpdated <- findUserById(userModel.id) eitherT
- } yield UpdateUserResult(newPhoneCodeModel.confirmationCodeModel, Some(userUpdated.toAggregate))
- ).value
- }
Add Comment
Please, Sign In to add comment