forked from kompetenzinventar/ki-backend
add search by nick
add sql special chars test
This commit is contained in:
@ -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 = []
|
||||
|
||||
|
Reference in New Issue
Block a user