fix sorting on /sources

This commit is contained in:
fadingNA
2024-11-09 14:57:15 -05:00
parent 3482474265
commit d59ffaf0bd

View File

@@ -485,8 +485,6 @@ class CombinedJson(Resource):
@api.doc(description="Provide JSON file with combined available indexes")
def get(self):
user = "local"
sort_field = request.args.get("sort", "date") # Default to 'date'
sort_order = request.args.get("order", "desc") # Default to 'desc'
data = [
{
"name": "default",
@@ -500,7 +498,7 @@ class CombinedJson(Resource):
try:
for index in sources_collection.find({"user": user}).sort(
sort_field, 1 if sort_order == "asc" else -1
"date", -1
):
data.append(
{