feat: call transcripts apis

refactor: api response for list
This commit is contained in:
2025-05-14 15:38:31 +05:30
parent 2fc0c88ed8
commit b6e390f77c
9 changed files with 215 additions and 3 deletions
+21
View File
@@ -0,0 +1,21 @@
from fastapi import APIRouter, BackgroundTasks
from services.callTranscripts import CallTranscriptServices
from utils.constants import DEFAULT_LIMIT, DEFAULT_PAGE
from schemas.ApiResponse import ApiResponse
router = APIRouter()
@router.get("/")
def get_call_transcripts(limit:int = DEFAULT_LIMIT, page:int = DEFAULT_PAGE):
if page == 0:
page = 1
offset = (page - 1) * limit
response = CallTranscriptServices().get_call_transcripts(limit, offset)
return ApiResponse(data=response, message="Call transcripts retrieved successfully")
@router.post("/bulk-download")
def bulk_download_call_transcripts(key_ids: list[int], background_tasks: BackgroundTasks):
service = CallTranscriptServices()
response = service.bulk_download_call_transcripts(key_ids, background_tasks)
return response