let mods search users by previous email - requires new mongodb index
This commit is contained in:
parent
0430859e01
commit
251b392233
|
@ -20,6 +20,6 @@ final class UserSearch(
|
|||
private def searchUsername(username: String) = UserRepo named username map (_.toList)
|
||||
|
||||
private def searchEmail(email: EmailAddress) = emailValidator.validate(email) ?? { fixed =>
|
||||
UserRepo byEmail fixed map (_.toList)
|
||||
UserRepo.byEmail(fixed) orElse UserRepo.byPrevEmail(fixed) map (_.toList)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ object UserRepo {
|
|||
def byIdsSecondary(ids: Iterable[ID]): Fu[List[User]] = coll.byIds[User](ids, ReadPreference.secondaryPreferred)
|
||||
|
||||
def byEmail(email: EmailAddress): Fu[Option[User]] = coll.uno[User]($doc(F.email -> email))
|
||||
def byPrevEmail(email: EmailAddress): Fu[Option[User]] = coll.uno[User]($doc(F.prevEmail -> email))
|
||||
|
||||
def idByEmail(email: EmailAddress): Fu[Option[String]] =
|
||||
coll.primitiveOne[String]($doc(F.email -> email), "_id")
|
||||
|
|
Loading…
Reference in a new issue