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