added filter by account rating

This commit is contained in:
2025-01-02 22:12:35 +01:00
parent cbe0074c70
commit db728f21ba
2 changed files with 21 additions and 9 deletions

View File

@@ -19,22 +19,32 @@ class Archive_GetPosts(Resource):
response.headers.add("Access-Control-Allow-Origin", "*")
return response
param = []
actions = []
if "undecided" in request.args:
param.append(0)
actions.append(0)
if "approved" in request.args:
param.append(1)
actions.append(1)
if "denied" in request.args:
param.append(2)
actions.append(2)
if "hidden" in request.args:
param.append(3)
if param == []:
param = [0,1,2,3]
actions.append(3)
if actions == []:
actions = [0,1,2,3]
ratings = []
if "SFW" in request.args:
ratings.append("SFW")
if "NSFW" in request.args:
ratings.append("NSFW")
if "NSFL" in request.args:
ratings.append("NSFL")
if ratings == []:
ratings = ["SFW", "NSFW"]
real_page = page-1
offset = real_page * count
result = db.get_posts(count, param, last_id, offset)
result = db.get_posts(count, actions_taken=actions, last_id= -1, offset= offset, include_ratings= ratings)
if result is None:
response = app.response_class(status=400)