This commit is contained in:
grillazz 2025-08-24 09:34:11 +02:00
parent 700a2d49a6
commit 7d122f7062

View File

@ -84,7 +84,7 @@ async def find_stuff_pool(
HTTPException: If the 'Stuff' object is not found or an SQLAlchemyError occurs. HTTPException: If the 'Stuff' object is not found or an SQLAlchemyError occurs.
""" """
try: try:
stmt = await Stuff.find(db_session, name, compile_sql=True) stmt = await Stuff.get_by_name(db_session, name, compile_sql=True)
result = await request.app.postgres_pool.fetchrow(str(stmt)) result = await request.app.postgres_pool.fetchrow(str(stmt))
except SQLAlchemyError as ex: except SQLAlchemyError as ex:
raise HTTPException( raise HTTPException(
@ -100,7 +100,7 @@ async def find_stuff_pool(
@router.delete("/{name}") @router.delete("/{name}")
async def delete_stuff(name: str, db_session: AsyncSession = Depends(get_db)): async def delete_stuff(name: str, db_session: AsyncSession = Depends(get_db)):
stuff = await Stuff.find(db_session, name) stuff = await Stuff.get_by_name(db_session, name)
return await Stuff.delete(stuff, db_session) return await Stuff.delete(stuff, db_session)
@ -110,6 +110,6 @@ async def update_stuff(
name: str, name: str,
db_session: AsyncSession = Depends(get_db), db_session: AsyncSession = Depends(get_db),
): ):
stuff = await Stuff.find(db_session, name) stuff = await Stuff.get_by_name(db_session, name)
await stuff.update(**payload.model_dump()) await stuff.update(**payload.model_dump())
return stuff return stuff