Skip to content

Commit

Permalink
DefaultRestRouterService now supports read model classes for find_ent…
Browse files Browse the repository at this point in the history
…ities
  • Loading branch information
douwevandermeij committed Sep 3, 2024
1 parent b7aaa39 commit 4903b67
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 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__ = "5.2.1"
__version__ = "5.2.2"

from abc import ABC

Expand Down
6 changes: 5 additions & 1 deletion fractal/contrib/fastapi/routers/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def info(

class DefaultRestRouterService(Service, ABC):
domain_entity_class: Type[Model]
domain_read_model_class: Type[Model] = None
entities_route: str
entity_route: str
entities_endpoint: str
Expand Down Expand Up @@ -246,7 +247,10 @@ def add_entity(

@router.get(
router_service_class().entities_route,
response_model=List[router_service_class().domain_entity_class],
response_model=List[
router_service_class().domain_entity_class
| router_service_class().domain_read_model_class
],
status_code=status.HTTP_200_OK,
name=f"Find {router_service_class().domain_entity_class.__name__} entities",
)
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 = "5.2.1"
version = "5.2.2"
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 4903b67

Please sign in to comment.