add or operator

This commit is contained in:
Valentin CZERYBA 2023-10-15 16:26:20 +02:00
parent dc4043acd9
commit 3392d8720f

View File

@ -15,7 +15,7 @@ async def read_users_me(userSingle: users.UserCreate | None = None):
detail="Body request is empty" detail="Body request is empty"
) )
user_repository = users.UserRepository(database=database.database) 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: if user is not None:
raise HTTPException( raise HTTPException(
status_code=status.HTTP_204_NO_CONTENT, status_code=status.HTTP_204_NO_CONTENT,