Spaces:
Paused
Paused
from fastapi import APIRouter, Body, Request, status | |
from typing import List | |
from datetime import date | |
import sys | |
# sys.path.append('/Users/benolojo/DCU/CA4/ca400_FinalYearProject/2024-ca400-olojob2-majdap2/src/backend/src/') | |
from ..operations import calls as calls | |
from ..models.calls import UserCall, UpdateCall | |
router = APIRouter(prefix="/call", | |
tags=["Calls"]) | |
async def create_calls(request: Request, user_calls: UserCall = Body(...)): | |
return calls.create_calls(request, user_calls) | |
async def list_calls(request: Request, limit: int): | |
return calls.list_calls(request, 100) | |
async def find_calls(request: Request, call_id: str): | |
return calls.find_calls(request, call_id) | |
async def find_user_calls(request: Request, user_id: str): | |
return calls.find_user_calls(request, user_id) | |
'''Key terms list can have variable length -> using POST request over GET''' | |
async def list_transcripts_by_key_terms(request: Request, key_terms: List[str]): | |
return calls.list_transcripts_by_key_terms(request, key_terms) | |
async def list_transcripts_by_dates(request: Request, start_date: str, end_date: str): | |
return calls.list_transcripts_by_dates(request, start_date, end_date) | |
async def list_transcripts_by_duration(request: Request, min_len: int, max_len: int): | |
return calls.list_transcripts_by_duration(request, min_len, max_len) | |
async def update_calls(request: Request, call_id: str, user_calls: UpdateCall = Body(...)): | |
return calls.update_calls(request, call_id, user_calls) | |
async def update_captions(request: Request, call_id: str, user_calls: UpdateCall = Body(...)): | |
return calls.update_captions(request, call_id, user_calls) | |
async def delete_call(request: Request, call_id :str): | |
return calls.delete_calls(request, call_id) |