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,28 @@ async def get(db: AsyncSession, unc_thread_id: int) -> UncThread | None:
|
||||
return await db.get(UncThread, unc_thread_id)
|
||||
|
||||
|
||||
async def get_by_values(
|
||||
db: AsyncSession,
|
||||
*,
|
||||
diameter_fraction: str,
|
||||
tpi: int,
|
||||
series: UncSeries,
|
||||
depth_in: float | None,
|
||||
) -> UncThread | None:
|
||||
depth_clause = (
|
||||
UncThread.depth_in.is_(None) if depth_in is None else UncThread.depth_in == depth_in
|
||||
)
|
||||
result = await db.execute(
|
||||
select(UncThread).where(
|
||||
UncThread.diameter_fraction == diameter_fraction,
|
||||
UncThread.tpi == tpi,
|
||||
UncThread.series == series,
|
||||
depth_clause,
|
||||
)
|
||||
)
|
||||
return result.scalar_one_or_none()
|
||||
|
||||
|
||||
async def list_all(db: AsyncSession, skip: int = 0, limit: int = 100) -> list[UncThread]:
|
||||
result = await db.execute(
|
||||
select(UncThread).order_by(UncThread.id).offset(skip).limit(limit)
|
||||
|
||||
Reference in new issue
Block a user