Skip to content

Commit 86bc2b4

Browse files
code-rootclaude
andcommitted
fix: use AsyncSession type hints in firmware_route for proper type checking
Import AsyncSession from sqlalchemy.ext.asyncio instead of Session from sqlalchemy.orm, and update all endpoint type hints to reflect that the get_db() dependency provides AsyncSession for async endpoints. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
1 parent 96d0549 commit 86bc2b4

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

backend/api/routes/firmware_route.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
from fastapi import APIRouter, Depends, HTTPException, UploadFile, File
2222
from pydantic import BaseModel
23-
from sqlalchemy.orm import Session
23+
from sqlalchemy.ext.asyncio import AsyncSession
2424
from sqlalchemy import select
2525

2626
from api.deps import get_current_user, get_db
@@ -156,7 +156,7 @@ async def get_firmware_sources(
156156
@router.post("/upload")
157157
async def upload_firmware_file(
158158
file: UploadFile = File(...),
159-
db: Session = Depends(get_db),
159+
db: AsyncSession = Depends(get_db),
160160
_user: User = Depends(get_current_user),
161161
) -> FirmwareEntryResponse:
162162
"""
@@ -327,7 +327,7 @@ async def list_available_packages(
327327
async def list_firmware_entries(
328328
model: Optional[str] = None,
329329
csc: Optional[str] = None,
330-
db: Session = Depends(get_db),
330+
db: AsyncSession = Depends(get_db),
331331
_user: User = Depends(get_current_user),
332332
) -> List[FirmwareEntryResponse]:
333333
"""
@@ -356,7 +356,7 @@ async def list_firmware_entries(
356356
@router.post("/entries")
357357
async def create_firmware_entry(
358358
req: FirmwareEntryCreate,
359-
db: Session = Depends(get_db),
359+
db: AsyncSession = Depends(get_db),
360360
_user: User = Depends(get_current_user),
361361
) -> FirmwareEntryResponse:
362362
"""
@@ -405,7 +405,7 @@ async def create_firmware_entry(
405405
async def update_firmware_entry(
406406
entry_id: int,
407407
req: FirmwareEntryUpdate,
408-
db: Session = Depends(get_db),
408+
db: AsyncSession = Depends(get_db),
409409
_user: User = Depends(get_current_user),
410410
) -> FirmwareEntryResponse:
411411
"""
@@ -435,7 +435,7 @@ async def update_firmware_entry(
435435
@router.delete("/entries/{entry_id}")
436436
async def delete_firmware_entry(
437437
entry_id: int,
438-
db: Session = Depends(get_db),
438+
db: AsyncSession = Depends(get_db),
439439
_user: User = Depends(get_current_user),
440440
) -> Dict[str, Any]:
441441
"""
@@ -458,7 +458,7 @@ async def delete_firmware_entry(
458458

459459
@router.post("/sync")
460460
async def sync_firmware_entries(
461-
db: Session = Depends(get_db),
461+
db: AsyncSession = Depends(get_db),
462462
_user: User = Depends(get_current_user),
463463
) -> Dict[str, Any]:
464464
"""

0 commit comments

Comments
 (0)