Reformatting everything with black
This commit is contained in:
1 parent
7bd07f084a
commit
8185f1f8b3
48 files changed
+1000
-348
No files matched your search
+12
-11
@@ -48,7 +48,9 @@ async def list_filtered(
|
||||
q = q.where(AugmentedPart.part_type_id == part_type_id)
|
||||
if sub_part_type_id is not None:
|
||||
q = q.where(AugmentedPart.sub_part_type_id == sub_part_type_id)
|
||||
result = await db.execute(q.order_by(AugmentedPart.description).offset(skip).limit(limit))
|
||||
result = await db.execute(
|
||||
q.order_by(AugmentedPart.description).offset(skip).limit(limit)
|
||||
)
|
||||
return list(result.scalars().all())
|
||||
|
||||
|
||||
@@ -62,6 +64,7 @@ async def count_filtered(
|
||||
sub_part_type_id: int | None = None,
|
||||
) -> int:
|
||||
from sqlalchemy import func
|
||||
|
||||
q = select(func.count()).select_from(AugmentedPart)
|
||||
if description.strip():
|
||||
q = q.where(AugmentedPart.description.ilike(f"%{description.strip()}%"))
|
||||
@@ -86,19 +89,18 @@ async def get_unlinked_imported_parts_filtered(
|
||||
skip: int = 0,
|
||||
limit: int = 50,
|
||||
) -> list[ImportedPart]:
|
||||
q = (
|
||||
select(ImportedPart)
|
||||
.where(
|
||||
ImportedPart.InventoryID.not_in(
|
||||
select(augmented_part_imported_parts.c.imported_part_id)
|
||||
)
|
||||
q = select(ImportedPart).where(
|
||||
ImportedPart.InventoryID.not_in(
|
||||
select(augmented_part_imported_parts.c.imported_part_id)
|
||||
)
|
||||
)
|
||||
if description.strip():
|
||||
q = q.where(ImportedPart.Description.ilike(f"%{description.strip()}%"))
|
||||
if colour.strip():
|
||||
q = q.where(ImportedPart.TBXColour.ilike(f"%{colour.strip()}%"))
|
||||
result = await db.execute(q.order_by(ImportedPart.InventoryID).offset(skip).limit(limit))
|
||||
result = await db.execute(
|
||||
q.order_by(ImportedPart.InventoryID).offset(skip).limit(limit)
|
||||
)
|
||||
return list(result.scalars().all())
|
||||
|
||||
|
||||
@@ -108,6 +110,7 @@ async def count_unlinked_filtered(
|
||||
colour: str = "",
|
||||
) -> int:
|
||||
from sqlalchemy import func
|
||||
|
||||
q = (
|
||||
select(func.count())
|
||||
.select_from(ImportedPart)
|
||||
@@ -166,9 +169,7 @@ async def create(
|
||||
return ap
|
||||
|
||||
|
||||
async def update(
|
||||
db: AsyncSession, ap: AugmentedPart, data: dict
|
||||
) -> AugmentedPart:
|
||||
async def update(db: AsyncSession, ap: AugmentedPart, data: dict) -> AugmentedPart:
|
||||
for field, value in data.items():
|
||||
setattr(ap, field, value)
|
||||
await db.commit()
|
||||
|
||||
Reference in new issue
Block a user