forked from yaso_meth/mih-project
fresh
This commit is contained in:
Binary file not shown.
@@ -1,12 +1,13 @@
|
||||
from fastapi import FastAPI, HTTPException
|
||||
from pydantic import BaseModel
|
||||
from .routers import docOffices, patients, patients_files, patients_notes
|
||||
from .routers import docOffices, patients, patients_files, patients_notes, users
|
||||
|
||||
app = FastAPI()
|
||||
app.include_router(docOffices.router)
|
||||
app.include_router(patients.router)
|
||||
app.include_router(patients_files.router)
|
||||
app.include_router(patients_notes.router)
|
||||
app.include_router(users.router)
|
||||
|
||||
# Check if server is up
|
||||
@app.get("/")
|
||||
|
||||
BIN
backend/routers/__pycache__/users.cpython-310.pyc
Normal file
BIN
backend/routers/__pycache__/users.cpython-310.pyc
Normal file
Binary file not shown.
29
backend/routers/users.py
Normal file
29
backend/routers/users.py
Normal file
@@ -0,0 +1,29 @@
|
||||
from fastapi import APIRouter, HTTPException
|
||||
from pydantic import BaseModel
|
||||
from ..database import dbConnection
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
class userRequest(BaseModel):
|
||||
DocOfficeID: int
|
||||
patientID: int
|
||||
|
||||
# Get List of all files
|
||||
@router.get("/users/", tags="users")
|
||||
async def read_all_users():
|
||||
db = dbConnection.dbConnect()
|
||||
cursor = db.cursor()
|
||||
query = "SELECT * FROM users"
|
||||
cursor.execute(query)
|
||||
items = [
|
||||
{
|
||||
"idUser": item[0],
|
||||
"UserName": item[1],
|
||||
"Password": item[2],
|
||||
"docOffice_ID": item[3],
|
||||
}
|
||||
for item in cursor.fetchall()
|
||||
]
|
||||
cursor.close()
|
||||
db.close()
|
||||
return items
|
||||
Reference in New Issue
Block a user