Serverside spool find limit and offset

This commit is contained in:
Donkie
2023-08-25 10:04:21 +02:00
parent 4fdea75e3f
commit b9f1b71c1f
2 changed files with 18 additions and 1 deletions

View File

@@ -119,6 +119,16 @@ async def find(
),
example="filament.name:asc,location:desc",
),
limit: Optional[int] = Query(
default=None,
title="Limit",
description="Maximum number of items in the response.",
),
offset: int = Query(
default=0,
title="Offset",
description="Offset in the full result set if a limit is set.",
),
) -> list[Spool]:
sort_by: dict[str, SortOrder] = {}
if sort is not None:
@@ -137,6 +147,8 @@ async def find(
lot_nr=lot_nr,
allow_archived=allow_archived,
sort_by=sort_by,
limit=limit,
offset=offset,
)
return [Spool.from_db(db_item) for db_item in db_items]