mirror of
https://github.com/creyD/creyPY.git
synced 2026-04-15 21:00:36 +02:00
Adjusted files for isort & autopep
This commit is contained in:
committed by
github-actions[bot]
parent
89997372ef
commit
dce897c247
@@ -21,6 +21,7 @@ from fastapi import Query
|
|||||||
|
|
||||||
T = TypeVar("T")
|
T = TypeVar("T")
|
||||||
|
|
||||||
|
|
||||||
class PaginationParams(BaseModel, AbstractParams):
|
class PaginationParams(BaseModel, AbstractParams):
|
||||||
page: int = Query(1, ge=1, description="Page number")
|
page: int = Query(1, ge=1, description="Page number")
|
||||||
size: int = Query(50, ge=1, le=100, description="Page size")
|
size: int = Query(50, ge=1, le=100, description="Page size")
|
||||||
@@ -28,13 +29,10 @@ class PaginationParams(BaseModel, AbstractParams):
|
|||||||
|
|
||||||
def to_raw_params(self) -> RawParams:
|
def to_raw_params(self) -> RawParams:
|
||||||
if not self.pagination:
|
if not self.pagination:
|
||||||
return RawParams(limit=None, offset=None)
|
return RawParams(limit=None, offset=None)
|
||||||
|
|
||||||
return RawParams(
|
return RawParams(limit=self.size, offset=(self.page - 1) * self.size)
|
||||||
limit=self.size,
|
|
||||||
offset=(self.page - 1) * self.size
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
# TODO: Add complete fastapi-pagination proxy here
|
# TODO: Add complete fastapi-pagination proxy here
|
||||||
# TODO: Add pagination off functionality
|
# TODO: Add pagination off functionality
|
||||||
|
|||||||
Reference in New Issue
Block a user