Adding filters and controls for scopes
This commit is contained in:
1 parent
3febc15a8f
commit
2587ccbceb
6 files changed
+292
-94
No files matched your search
@@ -31,20 +31,6 @@ async def list_all(
|
||||
return list(result.scalars().all())
|
||||
|
||||
|
||||
async def list_by_part_type(
|
||||
db: AsyncSession, part_type_id: int, skip: int = 0, limit: int = 1000
|
||||
) -> list[AugmentedPart]:
|
||||
"""All augmented parts of a given part type, ordered by description."""
|
||||
result = await db.execute(
|
||||
select(AugmentedPart)
|
||||
.where(AugmentedPart.part_type_id == part_type_id)
|
||||
.order_by(AugmentedPart.description)
|
||||
.offset(skip)
|
||||
.limit(limit)
|
||||
)
|
||||
return list(result.scalars().all())
|
||||
|
||||
|
||||
async def get_many(db: AsyncSession, ids: list[int]) -> list[AugmentedPart]:
|
||||
"""Fetch augmented parts by id in one query (selectin relationships loaded)."""
|
||||
if not ids:
|
||||
|
||||
Reference in new issue
Block a user