Merge pull request #230 from yaso-meth/QOL--Remove-not-set-up-accounts
remove blank usernames from search
This commit is contained in:
commit
57a7bb78ad
1 changed files with 1 additions and 1 deletions
|
|
@ -72,7 +72,7 @@ class userDeleteRequest(BaseModel):
|
||||||
async def read_all_users(search: str, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session())
|
async def read_all_users(search: str, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session())
|
||||||
db = database.dbConnection.dbAppDataConnect()
|
db = database.dbConnection.dbAppDataConnect()
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
query = "SELECT * FROM users WHERE LOWER(email) LIKE %s OR LOWER(username) LIKE %s"
|
query = "SELECT * FROM users WHERE LOWER(email) LIKE %s OR LOWER(username) LIKE %s AND username != ''"
|
||||||
search_term = f"%{search.lower()}%" # Add wildcards and lowercase
|
search_term = f"%{search.lower()}%" # Add wildcards and lowercase
|
||||||
cursor.execute(query, (search_term, search_term))
|
cursor.execute(query, (search_term, search_term))
|
||||||
items = [
|
items = [
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue