feat: call transcripts api

fix: other small fixes
This commit is contained in:
2025-05-30 15:32:31 +05:30
parent 4df268c8ac
commit 0b6d2442a8
9 changed files with 89 additions and 30 deletions
+9 -2
View File
@@ -60,8 +60,15 @@ async def update_master_data(master_appointment_type_id: int, appointment_type:
@router.get("/master-data")
async def get_master_data():
appointment_types = await MasterAppointmentServices().get_master_appointment_types()
async def get_master_data(
limit: int = DEFAULT_LIMIT,
page: int = DEFAULT_PAGE,
search: str = ""
):
if page < 1:
page = 1
offset = (page - 1) * limit
appointment_types = await MasterAppointmentServices().get_master_appointment_types(limit, offset, search)
return ApiResponse(data=appointment_types, message="Master data retrieved successfully")
+29 -8
View File
@@ -1,21 +1,42 @@
from fastapi import APIRouter, BackgroundTasks
import datetime
from typing import Optional
from fastapi import APIRouter, BackgroundTasks, Depends
from services.callTranscripts import CallTranscriptServices
from utils.constants import DEFAULT_LIMIT, DEFAULT_PAGE
from middleware.auth_dependency import auth_required
from utils.constants import DEFAULT_LIMIT, DEFAULT_ORDER, DEFAULT_ORDER_BY, DEFAULT_PAGE
from schemas.ApiResponse import ApiResponse
from schemas.CreateSchemas import CallTranscriptsCreate
router = APIRouter()
@router.get("/")
async def get_call_transcripts(limit:int = DEFAULT_LIMIT, page:int = DEFAULT_PAGE):
@router.get("/", dependencies=[Depends(auth_required)])
async def get_call_transcripts(limit: int = DEFAULT_LIMIT, page: int = DEFAULT_PAGE, search: str = "", orderBy: str = DEFAULT_ORDER, order: str = DEFAULT_ORDER_BY, startDate: Optional[datetime.datetime] = None, endDate: Optional[datetime.datetime] = None):
if page == 0:
page = 1
offset = (page - 1) * limit
response = await CallTranscriptServices().get_call_transcripts(limit, offset)
response = await CallTranscriptServices().get_call_transcripts(limit, offset, search, orderBy, order, startDate, endDate)
return ApiResponse(data=response, message="Call transcripts retrieved successfully")
@router.post("/bulk-download")
async def bulk_download_call_transcripts(key_ids: list[int], background_tasks: BackgroundTasks):
@router.get("/{key_id}", dependencies=[Depends(auth_required)])
async def download_call_transcript(key_id: str):
service = CallTranscriptServices()
response = await service.download_call_transcript(key_id)
return ApiResponse(data=response, message="Call transcript downloaded successfully")
@router.post("/")
async def create_call_transcript(data: CallTranscriptsCreate):
service = CallTranscriptServices()
await service.create_call_transcript(data)
return ApiResponse(data="OK", message="Call transcript created successfully")
@router.post("/bulk-download", dependencies=[Depends(auth_required)])
async def bulk_download_call_transcripts(
key_ids: list[int], background_tasks: BackgroundTasks
):
service = CallTranscriptServices()
response = await service.bulk_download_call_transcripts(key_ids, background_tasks)
return response
return response