feat: call transcripts apis
refactor: api response for list
This commit is contained in:
+3
-1
@@ -5,7 +5,7 @@ from fastapi.security import HTTPBearer
|
||||
# Import the security scheme
|
||||
bearer_scheme = HTTPBearer(scheme_name="Bearer Authentication")
|
||||
|
||||
from .endpoints import clinics, doctors, calender, appointments, patients, admin, auth, s3, users, clinicDoctor, dashboard
|
||||
from .endpoints import clinics, doctors, calender, appointments, patients, admin, auth, s3, users, clinicDoctor, dashboard, call_transcripts
|
||||
|
||||
api_router = APIRouter()
|
||||
# api_router.include_router(twilio.router, prefix="/twilio")
|
||||
@@ -35,3 +35,5 @@ api_router.include_router(users.router, prefix="/users", tags=["users"], depende
|
||||
api_router.include_router(clinicDoctor.router, prefix="/clinic-doctors", tags=["clinic-doctors"], dependencies=[Depends(auth_required)])
|
||||
|
||||
api_router.include_router(dashboard.router, prefix="/dashboard", tags=["dashboard"], dependencies=[Depends(auth_required)])
|
||||
|
||||
api_router.include_router(call_transcripts.router, prefix="/call-transcripts", tags=["call-transcripts"], dependencies=[Depends(auth_required)])
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user