Skip to content

Commit

Permalink
add offset, limit and sort/order_by to default fastapi find route
Browse files Browse the repository at this point in the history
  • Loading branch information
douwevandermeij committed Jun 9, 2023
1 parent a5ad9c3 commit 76a8da2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion fractal/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Fractal is a scaffolding toolkit for building SOLID logic for your Python applications."""

__version__ = "4.0.1"
__version__ = "4.1.0"

from abc import ABC

Expand Down
9 changes: 7 additions & 2 deletions fractal/contrib/fastapi/routers/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,14 @@ def to_entity(self, **kwargs):
class BasicRestRouterService(DefaultRestRouterService):
def find_entities(
self,
q: str = "",
*,
specification: Specification = None,
**kwargs,
):
return self.ingress_service.find(
account_id=str(kwargs.get("account")),
q=q,
specification=specification,
**kwargs,
)

def get_entity(
Expand Down Expand Up @@ -235,6 +234,9 @@ def add_entity(
)
def find_entities(
q: Optional[str] = "",
offset: int = 0,
limit: int = 0,
sort: str = "",
payload: TokenPayloadRoles = Depends(
get_payload_roles(
fractal,
Expand All @@ -245,6 +247,9 @@ def find_entities(
):
return router_service_class().find_entities(
q=q,
offset=offset,
limit=limit,
order_by=sort,
specification=payload.specification,
**payload.asdict(),
)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "fractal-toolkit"
version = "4.0.1"
version = "4.1.0"
description = "Fractal is a scaffolding toolkit for building SOLID logic for your Python applications."
authors = ["Douwe van der Meij <douwe@karibu-online.nl>"]

Expand Down

0 comments on commit 76a8da2

Please sign in to comment.