diff --git a/modules/Archive/database.py b/modules/Archive/database.py index 99ab419..09c0b10 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 @@ -42,7 +42,7 @@ class Database: posts = [] if result is not None: for result in self.db.run_query(query): - posts.append({"id": result[0], "id_str": str(result[0]), "text": result[1], "files": result[2].split(','), "handle": result[3]}) + posts.append({"id": result[0], "id_str": str(result[0]), "text": result[1], "files": result[2].split(','), "handle": result[3], "date": result[4]}) return posts def reload_data(self): 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