Spaces:
Sleeping
Sleeping
Update api/routes.py
Browse files- api/routes.py +8 -0
api/routes.py
CHANGED
|
@@ -156,3 +156,11 @@ async def delete_patient(patient_id: str, current_user: dict = Depends(get_curre
|
|
| 156 |
raise HTTPException(status_code=404, detail="Patient not found or unauthorized")
|
| 157 |
|
| 158 |
return {"message": "Patient deleted successfully"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 156 |
raise HTTPException(status_code=404, detail="Patient not found or unauthorized")
|
| 157 |
|
| 158 |
return {"message": "Patient deleted successfully"}
|
| 159 |
+
|
| 160 |
+
# --- COUNT PATIENTS BY DOCTOR ---
|
| 161 |
+
@router.get("/patients/count")
|
| 162 |
+
async def count_patients(current_user: dict = Depends(get_current_user)):
|
| 163 |
+
count = await patients_collection.count_documents({
|
| 164 |
+
"created_by": current_user["email"]
|
| 165 |
+
})
|
| 166 |
+
return {"count": count}
|