Adding automatic attachment point addition
This commit is contained in:
1 parent
c5d1186b95
commit
87ba8cd169
4 files changed
+175
-1
No files matched your search
@@ -8,6 +8,26 @@ async def get(db: AsyncSession, iso_thread_id: int) -> IsoThread | None:
|
||||
return await db.get(IsoThread, iso_thread_id)
|
||||
|
||||
|
||||
async def get_by_values(
|
||||
db: AsyncSession,
|
||||
*,
|
||||
diameter_mm: float,
|
||||
pitch_mm: float,
|
||||
depth_mm: float | None,
|
||||
) -> IsoThread | None:
|
||||
depth_clause = (
|
||||
IsoThread.depth_mm.is_(None) if depth_mm is None else IsoThread.depth_mm == depth_mm
|
||||
)
|
||||
result = await db.execute(
|
||||
select(IsoThread).where(
|
||||
IsoThread.diameter_mm == diameter_mm,
|
||||
IsoThread.pitch_mm == pitch_mm,
|
||||
depth_clause,
|
||||
)
|
||||
)
|
||||
return result.scalar_one_or_none()
|
||||
|
||||
|
||||
async def list_all(db: AsyncSession, skip: int = 0, limit: int = 100) -> list[IsoThread]:
|
||||
result = await db.execute(
|
||||
select(IsoThread).order_by(IsoThread.id).offset(skip).limit(limit)
|
||||
|
||||
Reference in new issue
Block a user