from fastapi import APIRouter, Depends, HTTPException | |
from fastapi.security import OAuth2PasswordBearer | |
from sqlalchemy.orm import Session | |
from app.database import get_db | |
from app.models import User | |
router = APIRouter() | |
# Define specific routes and request handlers | |
def read_user(user_id: int, db: Session = Depends(get_db)): | |
user = db.query(User).filter(User.id == user_id).first() | |
if user is None: | |
raise HTTPException(status_code=404, detail="User not found") | |
return user |