1- """FastAPI API routes for file processing and conversion"""
1+ """FastAPI API routes for file processing and conversion. """
22
33import asyncio
44import io
55import zipfile
66
77from api .auth .auth_utils import get_authenticated_user
88from api .status_updates import app_connection_manager , close_connection
9+
910from common .logger .app_logger import AppLogger
1011from common .services .batch_service import BatchService
12+
1113from fastapi import (
1214 APIRouter ,
1315 File ,
2426logger = AppLogger ("APIRoutes" )
2527
2628# start processing the batch
27- from sql_agents_start import process_batch_async
29+ from sql_agents_start import process_batch_async # noqa: E402
2830
2931
3032@router .post ("/start-processing" )
3133async def start_processing (request : Request ):
3234 """
33- Start processing files for a given batch
35+ Start processing files for a given batch.
36+
3437 ---
3538 tags:
3639 - File Processing
@@ -50,6 +53,7 @@ async def start_processing(request: Request):
5053 responses:
5154 200:
5255 description: Processing initiated successfully
56+
5357 content:
5458 application/json:
5559 schema:
@@ -61,6 +65,7 @@ async def start_processing(request: Request):
6165 type: string
6266 400:
6367 description: Invalid processing request
68+
6469 500:
6570 description: Internal server error
6671 """
@@ -89,7 +94,7 @@ async def start_processing(request: Request):
8994)
9095async def download_files (batch_id : str ):
9196 """
92- Download files as ZIP
97+ Download files as ZIP.
9398
9499 ---
95100 tags:
@@ -118,7 +123,6 @@ async def download_files(batch_id: str):
118123 type: string
119124 example: Batch not found
120125 """
121-
122126 # call batch_service get_batch_for_zip to get all files for batch_id
123127 batch_service = BatchService ()
124128 await batch_service .initialize_database ()
@@ -172,7 +176,7 @@ async def batch_status_updates(
172176 websocket : WebSocket , batch_id : str
173177): # , request: Request):
174178 """
175- WebSocket endpoint for real-time batch status updates
179+ Web-Socket endpoint for real-time batch status updates.
176180
177181 ---
178182 tags:
@@ -248,7 +252,7 @@ async def batch_status_updates(
248252@router .get ("/batch-story/{batch_id}" )
249253async def get_batch_status (request : Request , batch_id : str ):
250254 """
251- Retrieve batch history and file statuses
255+ Retrieve batch history and file statuses.
252256
253257 ---
254258 tags:
@@ -371,9 +375,7 @@ async def get_batch_status(request: Request, batch_id: str):
371375
372376@router .get ("/batch-summary/{batch_id}" )
373377async def get_batch_summary (request : Request , batch_id : str ):
374- """
375- Retrieve batch summary for a given batch ID.
376- """
378+ """Retrieve batch summary for a given batch ID."""
377379 try :
378380 batch_service = BatchService ()
379381 await batch_service .initialize_database ()
@@ -404,7 +406,7 @@ async def upload_file(
404406 request : Request , file : UploadFile = File (...), batch_id : str = Form (...)
405407):
406408 """
407- Upload file for conversion
409+ Upload file for conversion.
408410
409411 ---
410412 tags:
@@ -634,7 +636,7 @@ async def get_file_details(request: Request, file_id: str):
634636@router .delete ("/delete-batch/{batch_id}" )
635637async def delete_batch_details (request : Request , batch_id : str ):
636638 """
637- delete batch history using batch_id
639+ Delete batch history using batch_id.
638640
639641 ---
640642 tags:
@@ -689,7 +691,7 @@ async def delete_batch_details(request: Request, batch_id: str):
689691@router .delete ("/delete-file/{file_id}" )
690692async def delete_file_details (request : Request , file_id : str ):
691693 """
692- delete file history using batch_id
694+ Delete file history using batch_id.
693695
694696 ---
695697 tags:
@@ -747,7 +749,7 @@ async def delete_file_details(request: Request, file_id: str):
747749@router .delete ("/delete_all" )
748750async def delete_all_details (request : Request ):
749751 """
750- delete all the history of batches, files and logs
752+ Delete all the history of batches, files and logs.
751753
752754 ---
753755 tags:
0 commit comments