feat: new endpoints for agent
feat: new auth middleware for agent
This commit is contained in:
@@ -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