diff --git a/modules/Archive/database.py b/modules/Archive/database.py index 99ab419..cfb5b2f 100644 --- a/modules/Archive/database.py +++ b/modules/Archive/database.py @@ -19,17 +19,17 @@ class Database: api.add_resource(Archive_Query, "/Archive/Query") api.add_resource(Archive_GetPosts, "/Archive/GetPosts") - def get_posts(self, num_posts, actions_taken = [0, 1, 2], last_id = -1, offset = 0): + def get_posts(self, num_posts, actions_taken = [0, 1, 2, 3], last_id = -1, offset = 0): num_posts = max(1, min(num_posts, 30)) where_query = "WHERE x_post_details.id NOT NULL AND x_posts.error_id = 0" if last_id != -1: where_query += f" AND x_posts.id < {last_id}" - if actions_taken != [0, 1, 2]: + if actions_taken != [0, 1, 2, 3]: where_query += " AND (" + " OR ".join([f"x_posts.action_taken = {action}" for action in actions_taken]) + ")" query = f''' - SELECT x_posts.id, x_post_details.text, x_post_details.files, accounts.x_handle FROM x_posts + SELECT x_posts.id, x_post_details.text, x_post_details.files, accounts.x_handle, x_post_details.date FROM x_posts LEFT JOIN x_post_details ON x_posts.id = x_post_details.id LEFT JOIN accounts diff --git a/modules/Archive/endpoints/get_posts.py b/modules/Archive/endpoints/get_posts.py index 0cc6807..60bcb18 100644 --- a/modules/Archive/endpoints/get_posts.py +++ b/modules/Archive/endpoints/get_posts.py @@ -26,8 +26,10 @@ class Archive_GetPosts(Resource): param.append(1) if "denied" in request.args: param.append(2) + if "hidden" in request.args: + param.append(3) if param == []: - param = [0,1,2] + param = [0,1,2,3] real_page = page-1 offset = real_page * count