add search by nick

add sql special chars test
This commit is contained in:
2021-07-12 21:13:12 +02:00
parent cd2a7853dd
commit 76e95311f0
7 changed files with 66 additions and 31 deletions

View File

@ -18,11 +18,15 @@ def find_profiles():
if page_size > 100:
return make_response({"messages": {"page_size": "Die maximale Anzahl Einträge pro Seite beträgt 100"}}, 400)
offset = (page - 1) * page_size
query = Profile.query.filter(Profile.visible.is_(True))
if "nickname" in request.args:
nickname = request.args.get("nickname")
query = query.filter(Profile.nickname.like(f"%{nickname}%"))
query = Profile.query.filter(Profile.visible is True)
count = query.count()
offset = (page - 1) * page_size
db_profiles = query.limit(page_size).offset(offset).all()
api_profiles = []