Improve template #1

Merged
eriks merged 7 commits from feature/updates into main 2025-04-05 13:15:42 +03:00
2 changed files with 6 additions and 5 deletions
Showing only changes of commit 507c948e21 - Show all commits

View File

@ -1,9 +1,8 @@
from service.api.dependencies import QueryParams
from service.core.security import verify_password
from service.crud.user.models import UserPublic, UserRegister
from service.crud.utils import order_queryset
from service.database.models import User
from ..utils import order_queryset
from ...api.dependencies import QueryParams
from .models import UserPublic, UserRegister
async def authenticate(*, username: str, password: str) -> User | None:

View File

@ -4,5 +4,7 @@ from service.constants.types import PaginationParams
def order_queryset(qs: QuerySet, filters: PaginationParams, default: str) -> QuerySet:
ordering = None
if filters.order:
ordering = [f for f in filters.order.split(",") if f.split("-")[-1] in qs.fields]
return qs.order_by(*(ordering or (default, )))