fix: ruff lint + format fixes in tests, ESLint fixes in frontend
This commit is contained in:
@@ -2,7 +2,17 @@
|
||||
|
||||
import uuid
|
||||
|
||||
from fastapi import APIRouter, BackgroundTasks, Depends, File, Form, HTTPException, Query, UploadFile, status
|
||||
from fastapi import (
|
||||
APIRouter,
|
||||
BackgroundTasks,
|
||||
Depends,
|
||||
File,
|
||||
Form,
|
||||
HTTPException,
|
||||
Query,
|
||||
UploadFile,
|
||||
status,
|
||||
)
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from app.config import settings
|
||||
@@ -78,7 +88,12 @@ async def upload_scan(
|
||||
except (ValueError, TypeError):
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
|
||||
detail={"error": {"code": "INVALID_VEHICLE_ID", "message": "Invalid vehicle UUID"}},
|
||||
detail={
|
||||
"error": {
|
||||
"code": "INVALID_VEHICLE_ID",
|
||||
"message": "Invalid vehicle UUID",
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
try:
|
||||
@@ -101,7 +116,9 @@ async def upload_scan(
|
||||
return OCRUploadResponse(
|
||||
message="OCR processing queued",
|
||||
ocr_result_id=ocr_result.id,
|
||||
status=ocr_result.status.value if isinstance(ocr_result.status, OCRStatus) else str(ocr_result.status),
|
||||
status=ocr_result.status.value
|
||||
if isinstance(ocr_result.status, OCRStatus)
|
||||
else str(ocr_result.status),
|
||||
)
|
||||
|
||||
|
||||
@@ -120,7 +137,9 @@ async def get_ocr_result(
|
||||
if ocr_result is None:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_404_NOT_FOUND,
|
||||
detail={"error": {"code": "OCR_NOT_FOUND", "message": "OCR result not found"}},
|
||||
detail={
|
||||
"error": {"code": "OCR_NOT_FOUND", "message": "OCR result not found"}
|
||||
},
|
||||
)
|
||||
return OCRResultResponse.model_validate(ocr_result)
|
||||
|
||||
@@ -164,7 +183,9 @@ async def apply_ocr_to_vehicle(
|
||||
):
|
||||
"""Apply OCR structured data to the linked vehicle."""
|
||||
try:
|
||||
ocr_result, vehicle, updated_fields = await ocr_service.apply_to_vehicle(db, result_id)
|
||||
ocr_result, vehicle, updated_fields = await ocr_service.apply_to_vehicle(
|
||||
db, result_id
|
||||
)
|
||||
except ValueError as exc:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_400_BAD_REQUEST,
|
||||
|
||||
Reference in New Issue
Block a user