Skip to content

Commit

Permalink
fix sorting mess
Browse files Browse the repository at this point in the history
  • Loading branch information
AAGaming00 committed Dec 30, 2023
1 parent 936c254 commit d0ebb87
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion plugin_store/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ async def plugins_list(
tags: list[str] = fastapi.Query(default=[]),
hidden: bool = False,
sort_by: Optional[SortType] = None,
sort_direction: SortDirection = SortDirection.desc,
sort_direction: SortDirection = SortDirection.asc,
db: "Database" = Depends(database),
):
tags = list(filter(None, reduce(add, (el.split(",") for el in tags), [])))
Expand Down
3 changes: 3 additions & 0 deletions plugin_store/database/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@ async def search(
statement = statement.order_by(direction(Artifact.created))
elif sort_by == SortType.downloads:
statement = statement.order_by(direction(Artifact.downloads))
else:
statement = statement.order_by(direction(Artifact.id))


result = (await session.execute(statement)).scalars().all()
return result or []
Expand Down

0 comments on commit d0ebb87

Please sign in to comment.