verify api calls and do lower case db check
This commit is contained in:
@@ -71,7 +71,7 @@ async def read_patientByID(pat_id: str, session: SessionContainer = Depends(veri
|
|||||||
|
|
||||||
# Get Patient By ID Number
|
# Get Patient By ID Number
|
||||||
@router.get("/patients/{id_no}", tags="patients")
|
@router.get("/patients/{id_no}", tags="patients")
|
||||||
async def read_patientByID(id_no: str):
|
async def read_patientByID(id_no: str, session: SessionContainer = Depends(verify_session())):
|
||||||
db = database.dbConnection.dbConnect()
|
db = database.dbConnection.dbConnect()
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
query = "SELECT * FROM patients WHERE id_no=%s"
|
query = "SELECT * FROM patients WHERE id_no=%s"
|
||||||
@@ -95,11 +95,11 @@ async def read_patientByID(id_no: str):
|
|||||||
|
|
||||||
# Get Patient By ID Number
|
# Get Patient By ID Number
|
||||||
@router.get("/patients/{email}", tags="patients")
|
@router.get("/patients/{email}", tags="patients")
|
||||||
async def read_patientByID(id_no: str):
|
async def read_patientByID(email: str, session: SessionContainer = Depends(verify_session())):
|
||||||
db = database.dbConnection.dbConnect()
|
db = database.dbConnection.dbConnect()
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
query = "SELECT * FROM patients WHERE email=%s"
|
query = "SELECT * FROM patients WHERE lower(email)=%s"
|
||||||
cursor.execute(query, (id_no,))
|
cursor.execute(query, (email.lower(),))
|
||||||
item = cursor.fetchone()
|
item = cursor.fetchone()
|
||||||
cursor.close()
|
cursor.close()
|
||||||
db.close()
|
db.close()
|
||||||
|
|||||||
Reference in New Issue
Block a user