Update main.py
Browse files
main.py
CHANGED
|
@@ -531,3 +531,39 @@ def reset_password(body: ResetPasswordIn, authorization: str = Header(None)):
|
|
| 531 |
|
| 532 |
supa_delete("user_sessions", eq("user_id", u["id"]))
|
| 533 |
return {"message":"password changed successfully!"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 531 |
|
| 532 |
supa_delete("user_sessions", eq("user_id", u["id"]))
|
| 533 |
return {"message":"password changed successfully!"}
|
| 534 |
+
|
| 535 |
+
# ====== Details Endpoints ======
|
| 536 |
+
|
| 537 |
+
# ====== Doctors (public, anon-read) ======
|
| 538 |
+
|
| 539 |
+
@app.get("/api/doctors")
|
| 540 |
+
def list_doctors(limit: int = 100, offset: int = 0, order: str = "id.asc"):
|
| 541 |
+
"""
|
| 542 |
+
يرجّع قائمة الدكاترة من جدول doctors.
|
| 543 |
+
باراميترات اختيارية: limit, offset, order (مثلاً: "created_at.desc")
|
| 544 |
+
"""
|
| 545 |
+
params = {
|
| 546 |
+
"select": "id,fname,lname,brief,image,created_at",
|
| 547 |
+
"limit": str(limit),
|
| 548 |
+
"offset": str(offset),
|
| 549 |
+
"order": order,
|
| 550 |
+
}
|
| 551 |
+
rows = supa_select("doctors", params)
|
| 552 |
+
return {"count": len(rows), "data": rows}
|
| 553 |
+
|
| 554 |
+
|
| 555 |
+
@app.get("/api/doctors/{doctor_id}/details")
|
| 556 |
+
def doctor_details(doctor_id: int):
|
| 557 |
+
"""
|
| 558 |
+
يرجّع تفاصيل دكتور واحد من جدول doctor_details حسب الـ id.
|
| 559 |
+
"""
|
| 560 |
+
params = {
|
| 561 |
+
**eq("doctor_id", doctor_id),
|
| 562 |
+
"select": "doctor_id,gender,qualifications,experience,"
|
| 563 |
+
"%22Speciality%22,%22Degree%22,phone,email,highligthed,branches,created_at",
|
| 564 |
+
"limit": "1",
|
| 565 |
+
}
|
| 566 |
+
rows = supa_select("doctor_details", params)
|
| 567 |
+
if not rows:
|
| 568 |
+
raise HTTPException(status_code=404, detail="Doctor details not found")
|
| 569 |
+
return rows[0]
|