You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
asyncdefview_patient(patient_id: str=Path(..., description='ID of the patient in the DB', examples=['P001']), current_doctor: str=Depends(get_current_doctor)):
74
-
patient=awaitPatient.get(patient_id)
75
-
ifnotpatientorpatient.doctor_id!=current_doctor:
76
-
raiseHTTPException(status_code=404, detail='Patient not found')
77
-
returnpatient
78
-
79
-
@app.get('/sort')
80
-
asyncdefsort_patients(sort_by: str=Query(..., description='Sort on the basis of height, weight, age or _id'), order: str=Query('asc', description='sort in asc or desc order'), current_doctor: str=Depends(get_current_doctor)):
81
-
82
-
valid_fields= ['height', 'weight', 'age', '_id']
83
-
84
-
ifsort_bynotinvalid_fields:
85
-
raiseHTTPException(status_code=400, detail=f'Invalid field select from {valid_fields}')
86
-
87
-
ifordernotin ['asc', 'desc']:
88
-
raiseHTTPException(status_code=400, detail='Invalid order select between asc and desc')
asyncdefview_patient(patient_id: str=Path(..., description='ID of the patient in the DB', examples=['P001']), current_doctor: str=Depends(get_current_doctor)):
17
+
patient=awaitPatient.get(patient_id)
18
+
ifnotpatientorpatient.doctor_id!=current_doctor:
19
+
raiseHTTPException(status_code=404, detail='Patient not found')
20
+
returnpatient
21
+
22
+
@router.get("/sort")
23
+
asyncdefsort_patients(sort_by: str=Query(..., description='Sort on the basis of height, weight, age or _id'), order: str=Query('asc', description='sort in asc or desc order'), current_doctor: str=Depends(get_current_doctor)):
24
+
25
+
valid_fields= ['height', 'weight', 'age', '_id']
26
+
27
+
ifsort_bynotinvalid_fields:
28
+
raiseHTTPException(status_code=400, detail=f'Invalid field select from {valid_fields}')
29
+
30
+
ifordernotin ['asc', 'desc']:
31
+
raiseHTTPException(status_code=400, detail='Invalid order select between asc and desc')
0 commit comments