feat: new endpoints for agent
feat: new auth middleware for agent
This commit is contained in:
+6
-1
@@ -1,11 +1,12 @@
|
||||
from fastapi import APIRouter, Depends
|
||||
from middleware.auth_dependency import auth_required
|
||||
from middleware.auth_secret import verify_secret
|
||||
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, call_transcripts, notifications,sns, stripe
|
||||
from .endpoints import clinics, doctors, calender, appointments, patients, admin, auth, s3, users, clinicDoctor, dashboard, call_transcripts, notifications,sns, stripe, agent
|
||||
|
||||
api_router = APIRouter()
|
||||
|
||||
@@ -42,3 +43,7 @@ api_router.include_router(dashboard.router, prefix="/dashboard", tags=["dashboar
|
||||
api_router.include_router(call_transcripts.router, prefix="/call-transcripts", tags=["call-transcripts"])
|
||||
|
||||
api_router.include_router(notifications.router, prefix="/notifications", tags=["notifications"], dependencies=[Depends(auth_required)])
|
||||
|
||||
|
||||
# agent (bot) routes
|
||||
api_router.include_router(agent.router, prefix="/agent", tags=["agent"], dependencies=[Depends(verify_secret)], include_in_schema=False)
|
||||
@@ -0,0 +1,18 @@
|
||||
'''
|
||||
this route is for agent (bot)
|
||||
'''
|
||||
|
||||
from fastapi import APIRouter
|
||||
|
||||
from services.agentServices import AgentServices
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@router.get("/clinic/docs/{clinic_id}")
|
||||
async def get_clinic_doctors_with_appointments(clinic_id: int):
|
||||
return await AgentServices().get_clinic_doctors_with_appointments(clinic_id)
|
||||
|
||||
@router.get("/clinic/{phone}")
|
||||
async def get_clinic_by_phone(phone: str):
|
||||
return await AgentServices().get_clinic_by_phone(phone)
|
||||
|
||||
@@ -62,6 +62,7 @@ async def verify_otp(data: AuthOTP):
|
||||
|
||||
@router.get("/is-valid-domain")
|
||||
async def is_valid_domain(req:Request):
|
||||
host = req.headers.get("host")
|
||||
host = req.client.host
|
||||
print(host)
|
||||
is_valid = await ClinicServices().is_valid_domain(host)
|
||||
return status.HTTP_200_OK if is_valid else status.HTTP_404_NOT_FOUND
|
||||
|
||||
@@ -20,7 +20,9 @@ async def get_clinic_doctors(
|
||||
if page < 1:
|
||||
page = 1
|
||||
offset = (page - 1) * limit
|
||||
clinic_doctors = await ClinicDoctorsServices().get_clinic_doctors(req.state.user, limit, offset, search, sort_by, sort_order)
|
||||
user = req.state.user
|
||||
clinic_id = user["created_clinics"][0]["id"]
|
||||
clinic_doctors = await ClinicDoctorsServices().get_clinic_doctors(clinic_id, limit, offset, search, sort_by, sort_order)
|
||||
return ApiResponse(data=clinic_doctors, message="Clinic doctors retrieved successfully")
|
||||
|
||||
@router.post("/")
|
||||
|
||||
Reference in New Issue
Block a user