added post order modes

This commit is contained in:
2025-01-11 18:32:03 +01:00
parent 155394ab75
commit 5e27727e1a
2 changed files with 16 additions and 6 deletions

View File

@@ -42,10 +42,17 @@ class Archive_GetPosts(Resource):
if ratings == []:
ratings = ["SFW", "NSFW"]
if "random" in request.args:
order = "RAND"
elif "ascending" in request.args:
order = "ASC"
else:
order = "DESC"
real_page = page-1
offset = real_page * count
result = db.get_posts(count, artist, actions_taken=actions, last_id= -1, offset= offset, include_ratings= ratings)
result = db.get_posts(count, artist, actions_taken=actions, last_id= -1, offset= offset, include_ratings= ratings, order=order)
if result is None:
response = app.response_class(status=400)