Skip to content

feat: filters can be dynamically generated per route #196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 20, 2025
Merged

Conversation

cofin
Copy link
Member

@cofin cofin commented Jan 20, 2025

Filters are now completely configurable per-route. There's a dependency generator that will allow you to enable specific feature types per endpoint.

Here are the currently enabled configurable parameters:

    id_filter: NotRequired[type[UUID | int]]
    """Indicates that the id filter should be enabled.  When set, the type specified will be used for the :class:`CollectionFilter`."""
    id_field: NotRequired[str]
    """The field on the model that stored the primary key or identifier."""
    sort_field: NotRequired[str]
    """The default field to use for the sort filter."""
    sort_order: NotRequired[SortOrder]
    """The default order to use for the sort filter."""
    pagination_type: NotRequired[Literal["limit_offset"]]
    """When set, pagination is enabled based on the type specified."""
    pagination_size: NotRequired[int]
    """The size of the pagination."""
    search: NotRequired[bool]
    """When set, search is enabled."""
    search_ignore_case: NotRequired[bool]
    """When set, search is case insensitive by default."""
    created_at: NotRequired[bool]
    """When set, created_at filter is enabled."""
    updated_at: NotRequired[bool]
    """When set, updated_at filter is enabled."""

@cofin cofin requested review from a team as code owners January 20, 2025 19:49
@railway-app railway-app bot temporarily deployed to litestar-fullstack-pr-196 January 20, 2025 19:50 Destroyed
Copy link

railway-app bot commented Jan 20, 2025

🚅 Previously deployed to Railway in the Litestar Fullstack project. Environment has been deleted.

@railway-app railway-app bot temporarily deployed to litestar-fullstack-pr-196 January 20, 2025 20:02 Destroyed
Copy link

@railway-app railway-app bot temporarily deployed to litestar-fullstack-pr-196 January 20, 2025 20:12 Destroyed
@cofin cofin merged commit fd571a9 into main Jan 20, 2025
9 of 10 checks passed
@cofin cofin deleted the filter-generator branch January 20, 2025 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant