Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Teo Koon Peng <[email protected]>
  • Loading branch information
koonpeng committed May 29, 2024
1 parent c2594b2 commit b70337d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/api-server/api_server/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
def add_pagination(
query: QuerySet[MODEL],
pagination: Pagination,
field_mappings: Dict[str, str] = {},
field_mappings: Optional[Dict[str, str]] = None,
) -> QuerySet[MODEL]:
"""
Adds pagination and ordering to a query.
Expand All @@ -17,6 +17,7 @@ def add_pagination(
query. e.g. a url of `?order_by=order_field` and a field mapping of `{"order_field": "db_field"}`
will order the query result according to `db_field`.
"""
field_mappings = field_mappings or {}
query = query.limit(pagination.limit).offset(pagination.offset)
if pagination.order_by is not None:
order_fields = []
Expand Down
2 changes: 0 additions & 2 deletions packages/api-server/api_server/routes/tasks/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

from fastapi import Body, Depends, HTTPException, Path, Query
from rx import operators as rxops
from tortoise.expressions import Case, F, Q, RawSQL, Subquery, When
from tortoise.functions import Max

from api_server import models as mdl
from api_server.dependencies import (
Expand Down

0 comments on commit b70337d

Please sign in to comment.