verify api calls and do lower case db check

This commit is contained in:
2024-07-25 16:48:48 +02:00
parent cbfa6002be
commit 8e1d7978c0

View File

@@ -71,7 +71,7 @@ async def read_patientByID(pat_id: str, session: SessionContainer = Depends(veri
# Get Patient By ID Number
@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()
cursor = db.cursor()
query = "SELECT * FROM patients WHERE id_no=%s"
@@ -95,11 +95,11 @@ async def read_patientByID(id_no: str):
# Get Patient By ID Number
@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()
cursor = db.cursor()
query = "SELECT * FROM patients WHERE email=%s"
cursor.execute(query, (id_no,))
query = "SELECT * FROM patients WHERE lower(email)=%s"
cursor.execute(query, (email.lower(),))
item = cursor.fetchone()
cursor.close()
db.close()