From 3392d8720fdd8a69f4f08ef2cf2cae764431979f Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Sun, 15 Oct 2023 16:26:20 +0200 Subject: [PATCH] add or operator --- app/routers/mail.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/routers/mail.py b/app/routers/mail.py index 247210c..919402e 100644 --- a/app/routers/mail.py +++ b/app/routers/mail.py @@ -15,7 +15,7 @@ async def read_users_me(userSingle: users.UserCreate | None = None): detail="Body request is empty" ) user_repository = users.UserRepository(database=database.database) - user = user_repository.find_one_by({"username": {'$eq': userSingle.username}}) + user = user_repository.find_one_by({"$or": [{"username": {'$eq': userSingle.username}},{"email": {"$eq": userSingle.email}}] }) if user is not None: raise HTTPException( status_code=status.HTTP_204_NO_CONTENT,