Skip to content

Commit

Permalink
Add BaseSort logic
Browse files Browse the repository at this point in the history
  • Loading branch information
so-saf committed Sep 18, 2024
1 parent 09a60be commit 88968e7
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 45 deletions.
2 changes: 1 addition & 1 deletion pydantic_filters/drivers/sqlalchemy/_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def append_sort_to_statement(
sort: _Sort,
) -> sa.Select[_T]:

if sort.sort_by is None or sort.sort_by_order is None:
if sort.sort_by is None:
return statement

try:
Expand Down
4 changes: 2 additions & 2 deletions pydantic_filters/sort/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from .base import BaseSort
from .misc import SortByOrder
from ._base import BaseSort
from ._types import SortByOrder
10 changes: 10 additions & 0 deletions pydantic_filters/sort/_base.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from typing import Optional

from pydantic import BaseModel, Field

from ._types import SortByOrder


class BaseSort(BaseModel):
sort_by: Optional[str] = None
sort_by_order: SortByOrder = Field(SortByOrder.asc)
25 changes: 0 additions & 25 deletions pydantic_filters/sort/_meta.py

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
from enum import Enum

__all__ = (
"SortByOrder",
)


class SortByOrder(str, Enum):
asc = "asc"
Expand Down
13 changes: 0 additions & 13 deletions pydantic_filters/sort/base.py

This file was deleted.

0 comments on commit 88968e7

Please sign in to comment.