Update metadat of apis for api docs
This commit is contained in:
@@ -12,8 +12,8 @@ import database.dbConnection
|
|||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
|
|
||||||
# Get Doctors Office By ID
|
# Get Doctors Office By ID
|
||||||
@router.get("/docOffices/{docOffic_id}", tags="DocOffice")
|
@router.get("/docOffices/{docOffic_id}", tags=["Doctor Office"])
|
||||||
async def read_docOfficeByID(docOffic_id: int, session: SessionContainer = Depends(verify_session())):
|
async def read_docOffice_By_ID(docOffic_id: int, session: SessionContainer = Depends(verify_session())):
|
||||||
db = database.dbConnection.dbConnect()
|
db = database.dbConnection.dbConnect()
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
query = "SELECT * FROM doctor_offices WHERE iddoctor_offices=%s"
|
query = "SELECT * FROM doctor_offices WHERE iddoctor_offices=%s"
|
||||||
@@ -27,8 +27,8 @@ async def read_docOfficeByID(docOffic_id: int, session: SessionContainer = Depen
|
|||||||
"office_name": item[1]}
|
"office_name": item[1]}
|
||||||
|
|
||||||
# Get Doctors Office By user
|
# Get Doctors Office By user
|
||||||
@router.get("/docOffices/user/{user}", tags="DocOffice")
|
@router.get("/docOffices/user/{user}", tags=["Doctor Office"])
|
||||||
async def read_docOfficeByID(user: str, session: SessionContainer = Depends(verify_session())):
|
async def read_docOffice_By_ID(user: str, session: SessionContainer = Depends(verify_session())):
|
||||||
db = database.dbConnection.dbConnect()
|
db = database.dbConnection.dbConnect()
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
query = "SELECT * FROM users WHERE email=%s"
|
query = "SELECT * FROM users WHERE email=%s"
|
||||||
@@ -48,8 +48,8 @@ async def read_docOfficeByID(user: str, session: SessionContainer = Depends(veri
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Get List of all Doctors Office
|
# Get List of all Doctors Office
|
||||||
@router.get("/docOffices/", tags="DocOffice")
|
@router.get("/docOffices/", tags=["Doctor Office"])
|
||||||
async def read_All_DoctorsOffice(session: SessionContainer = Depends(verify_session())):
|
async def read_All_Doctors_Office(session: SessionContainer = Depends(verify_session())):
|
||||||
db = database.dbConnection.dbConnect()
|
db = database.dbConnection.dbConnect()
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
query = "SELECT * FROM doctor_offices"
|
query = "SELECT * FROM doctor_offices"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from fastapi import APIRouter, HTTPException, File, UploadFile
|
from fastapi import APIRouter, HTTPException, File, UploadFile, Form
|
||||||
import requests
|
import requests
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
from minio import Minio
|
from minio import Minio
|
||||||
@@ -22,10 +22,20 @@ class medCertUploud(BaseModel):
|
|||||||
endDate: str
|
endDate: str
|
||||||
returnDate: str
|
returnDate: str
|
||||||
|
|
||||||
#=================understand Supertoken multirequest for file submission================================
|
@router.post("/minio/upload/file/", tags=["Minio"])
|
||||||
|
async def upload_File_to_user(file: UploadFile = File(...), app_id: str= Form(...)):
|
||||||
|
extension = file.filename.split(".")
|
||||||
|
return {
|
||||||
|
"app_id": app_id,
|
||||||
|
"file_name": file.filename,
|
||||||
|
"file_extension": extension,
|
||||||
|
"file_size": file.size,
|
||||||
|
"content":file
|
||||||
|
}
|
||||||
|
|
||||||
# Get List of all files by patient
|
# Get List of all files by patient
|
||||||
@router.post("/files/upload/file/", tags="patients_files")
|
@router.post("/files/upload/file/", tags=["Minio"])
|
||||||
async def generateAndUploudMedCert( file: UploadFile = File(...)):
|
async def upload_File_to_user( file: UploadFile = File(...)):
|
||||||
extension = file.filename.split(".")
|
extension = file.filename.split(".")
|
||||||
print(file.file)
|
print(file.file)
|
||||||
print(file.filename)
|
print(file.filename)
|
||||||
@@ -35,9 +45,11 @@ async def generateAndUploudMedCert( file: UploadFile = File(...)):
|
|||||||
|
|
||||||
return {"message": "Successfully Uploaded File"}
|
return {"message": "Successfully Uploaded File"}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Get List of all files by patient
|
# Get List of all files by patient
|
||||||
@router.post("/files/generate/med-cert/", tags="patients_files")
|
@router.post("/files/generate/med-cert/", tags=["Minio"])
|
||||||
async def generateAndUploudMedCert(requestItem: medCertUploud, session: SessionContainer = Depends(verify_session())):
|
async def upload_File_to_user(requestItem: medCertUploud, session: SessionContainer = Depends(verify_session())):
|
||||||
uploudMedCert(requestItem.fullName,
|
uploudMedCert(requestItem.fullName,
|
||||||
requestItem.docfname,
|
requestItem.docfname,
|
||||||
requestItem.startDate,
|
requestItem.startDate,
|
||||||
@@ -45,6 +57,10 @@ async def generateAndUploudMedCert(requestItem: medCertUploud, session: SessionC
|
|||||||
requestItem.returnDate)
|
requestItem.returnDate)
|
||||||
return {"message": "Successfully Generated File"}
|
return {"message": "Successfully Generated File"}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def uploudFile(fileName, extension, content, size):
|
def uploudFile(fileName, extension, content, size):
|
||||||
client = Minio("minio:9000",
|
client = Minio("minio:9000",
|
||||||
access_key="user1",
|
access_key="user1",
|
||||||
|
|||||||
@@ -14,13 +14,13 @@ class medicine(BaseModel):
|
|||||||
unit: str
|
unit: str
|
||||||
|
|
||||||
#get all medicines
|
#get all medicines
|
||||||
@router.get("/users/medicine/all", tags="medicine")
|
@router.get("/users/medicine/all", tags=["Medicine"])
|
||||||
async def read_all_medicine(session: SessionContainer = Depends(verify_session())):
|
async def read_all_medicine(session: SessionContainer = Depends(verify_session())):
|
||||||
return getMedicineData("")
|
return getMedicineData("")
|
||||||
|
|
||||||
#get all medicines by search
|
#get all medicines by search
|
||||||
@router.get("/users/medicine/{medSearch}", tags="medicine")
|
@router.get("/users/medicine/{medSearch}", tags=["Medicine"])
|
||||||
async def read_all_medicine(medSearch: str, session: SessionContainer = Depends(verify_session())):
|
async def read_medicineby_search(medSearch: str, session: SessionContainer = Depends(verify_session())):
|
||||||
return getMedicineData(medSearch)
|
return getMedicineData(medSearch)
|
||||||
|
|
||||||
def getMedicineData(medsearch: str):
|
def getMedicineData(medsearch: str):
|
||||||
|
|||||||
@@ -69,8 +69,8 @@ class patientDeleteRequest(BaseModel):
|
|||||||
|
|
||||||
|
|
||||||
# Get Patient By app ID
|
# Get Patient By app ID
|
||||||
@router.get("/patients/{app_id}", tags="patients")
|
@router.get("/patients/{app_id}", tags=["Patients"])
|
||||||
async def read_patientByID(app_id: str, session: SessionContainer = Depends(verify_session())):
|
async def read_patient_By_app_ID(app_id: 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 app_id=%s"
|
query = "SELECT * FROM patients WHERE app_id=%s"
|
||||||
@@ -211,8 +211,8 @@ async def read_patientByID(app_id: str, session: SessionContainer = Depends(veri
|
|||||||
# return items
|
# return items
|
||||||
|
|
||||||
# Insert Patient into table
|
# Insert Patient into table
|
||||||
@router.post("/patients/insert/", tags="patients", status_code=201)
|
@router.post("/patients/insert/", tags=["Patients"], status_code=201)
|
||||||
async def insertPatient(itemRequest : patientInsertRequest, session: SessionContainer = Depends(verify_session())):
|
async def insert_Patient(itemRequest : patientInsertRequest, session: SessionContainer = Depends(verify_session())):
|
||||||
db = database.dbConnection.dbConnect()
|
db = database.dbConnection.dbConnect()
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
query = "insert into patients "
|
query = "insert into patients "
|
||||||
@@ -244,8 +244,8 @@ async def insertPatient(itemRequest : patientInsertRequest, session: SessionCont
|
|||||||
return {"message": "Successfully Created Record"}
|
return {"message": "Successfully Created Record"}
|
||||||
|
|
||||||
# Update Patient on table
|
# Update Patient on table
|
||||||
@router.put("/patients/update/", tags="patients")
|
@router.put("/patients/update/", tags=["Patients"])
|
||||||
async def UpdatePatient(itemRequest : patientUpdateRequest, session: SessionContainer = Depends(verify_session())):
|
async def Update_Patient(itemRequest : patientUpdateRequest, session: SessionContainer = Depends(verify_session())):
|
||||||
db = database.dbConnection.dbConnect()
|
db = database.dbConnection.dbConnect()
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
query = "update patients "
|
query = "update patients "
|
||||||
@@ -278,8 +278,8 @@ async def UpdatePatient(itemRequest : patientUpdateRequest, session: SessionCont
|
|||||||
return {"message": "Successfully Updated Record"}
|
return {"message": "Successfully Updated Record"}
|
||||||
|
|
||||||
# delete Patient on table
|
# delete Patient on table
|
||||||
@router.delete("/patients/delete/", tags="patients")
|
@router.delete("/patients/delete/", tags=["Patients"])
|
||||||
async def DeletePatient(itemRequest : patientDeleteRequest, session: SessionContainer = Depends(verify_session())):
|
async def Delete_Patient(itemRequest : patientDeleteRequest, session: SessionContainer = Depends(verify_session())):
|
||||||
db = database.dbConnection.dbConnect()
|
db = database.dbConnection.dbConnect()
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
query = "delete from patients "
|
query = "delete from patients "
|
||||||
|
|||||||
@@ -42,8 +42,8 @@ class fileInsertRequest(BaseModel):
|
|||||||
# return items
|
# return items
|
||||||
|
|
||||||
# Get List of all files by patient
|
# Get List of all files by patient
|
||||||
@router.get("/files/patients/{app_id}", tags="patients_files")
|
@router.get("/files/patients/{app_id}", tags=["Patients Files"])
|
||||||
async def read_all_files_by_patient(app_id: str, session: SessionContainer = Depends(verify_session())):
|
async def read_all_patient_files_by_app_id(app_id: str, session: SessionContainer = Depends(verify_session())):
|
||||||
db = database.dbConnection.dbConnect()
|
db = database.dbConnection.dbConnect()
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
query = "SELECT * FROM patient_files where app_id = %s ORDER BY insert_date DESC"
|
query = "SELECT * FROM patient_files where app_id = %s ORDER BY insert_date DESC"
|
||||||
|
|||||||
@@ -47,8 +47,8 @@ class patientNoteUpdateRequest(BaseModel):
|
|||||||
# return items
|
# return items
|
||||||
|
|
||||||
# Get List of all notes by patient
|
# Get List of all notes by patient
|
||||||
@router.get("/notes/patients/{app_id}", tags="patients_notes")
|
@router.get("/notes/patients/{app_id}", tags=["Patients Notes"])
|
||||||
async def read_all_patientsby(app_id: str, session: SessionContainer = Depends(verify_session())):
|
async def read_all_patient_notes_by_app_id(app_id: str, session: SessionContainer = Depends(verify_session())):
|
||||||
db = database.dbConnection.dbConnect()
|
db = database.dbConnection.dbConnect()
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
query = "SELECT * FROM patient_notes where app_id = %s ORDER BY insert_date DESC"
|
query = "SELECT * FROM patient_notes where app_id = %s ORDER BY insert_date DESC"
|
||||||
@@ -92,8 +92,8 @@ async def read_all_patientsby(app_id: str, session: SessionContainer = Depends(v
|
|||||||
# return items
|
# return items
|
||||||
|
|
||||||
# Insert Patient note into table
|
# Insert Patient note into table
|
||||||
@router.post("/notes/insert/", tags="patients_notes", status_code=201)
|
@router.post("/notes/insert/", tags=["Patients Notes"], status_code=201)
|
||||||
async def insertPatientNotes(itemRequest : patientNoteInsertRequest, session: SessionContainer = Depends(verify_session())):
|
async def insert_Patient_Note(itemRequest : patientNoteInsertRequest, session: SessionContainer = Depends(verify_session())):
|
||||||
today = date.today()
|
today = date.today()
|
||||||
db = database.dbConnection.dbConnect()
|
db = database.dbConnection.dbConnect()
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
|
|||||||
@@ -74,12 +74,12 @@ class userUpdateRequest(BaseModel):
|
|||||||
# return items
|
# return items
|
||||||
|
|
||||||
# Get List of all files
|
# Get List of all files
|
||||||
@router.get("/user/{uid}", tags="users")
|
@router.get("/user/{app_id}", tags=["MIH Users"])
|
||||||
async def read_all_users(uid: str, session: SessionContainer = Depends(verify_session())):
|
async def read_users_by_app_id(app_id: str, session: SessionContainer = Depends(verify_session())):
|
||||||
db = database.dbConnection.dbAppDataConnect()
|
db = database.dbConnection.dbAppDataConnect()
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
query = "SELECT * FROM users where app_id = %s"
|
query = "SELECT * FROM users where app_id = %s"
|
||||||
cursor.execute(query, (uid,))
|
cursor.execute(query, (app_id,))
|
||||||
items = [
|
items = [
|
||||||
{
|
{
|
||||||
"idUser": item[0],
|
"idUser": item[0],
|
||||||
@@ -97,8 +97,8 @@ async def read_all_users(uid: str, session: SessionContainer = Depends(verify_se
|
|||||||
return items[0]
|
return items[0]
|
||||||
|
|
||||||
# Insert Patient into table
|
# Insert Patient into table
|
||||||
@router.post("/user/insert/", tags="user", status_code=201)
|
@router.post("/user/insert/", tags=["MIH Users"], status_code=201)
|
||||||
async def insertPatient(itemRequest : userInsertRequest, session: SessionContainer = Depends(verify_session())):
|
async def insert_User_details(itemRequest : userInsertRequest, session: SessionContainer = Depends(verify_session())):
|
||||||
db = database.dbConnection.dbAppDataConnect()
|
db = database.dbConnection.dbAppDataConnect()
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
query = "insert into users "
|
query = "insert into users "
|
||||||
@@ -117,8 +117,8 @@ async def insertPatient(itemRequest : userInsertRequest, session: SessionContain
|
|||||||
return {"message": "Successfully Created Record"}
|
return {"message": "Successfully Created Record"}
|
||||||
|
|
||||||
# Update User on table
|
# Update User on table
|
||||||
@router.put("/user/update/", tags="user")
|
@router.put("/user/update/", tags=["MIH Users"])
|
||||||
async def UpdateUser(itemRequest : userUpdateRequest, session: SessionContainer = Depends(verify_session())):
|
async def Update_User_details(itemRequest : userUpdateRequest, session: SessionContainer = Depends(verify_session())):
|
||||||
db = database.dbConnection.dbAppDataConnect()
|
db = database.dbConnection.dbAppDataConnect()
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
query = "update users "
|
query = "update users "
|
||||||
|
|||||||
Reference in New Issue
Block a user