diff --git a/back/main.py b/back/main.py index d1533e9..b005efd 100644 --- a/back/main.py +++ b/back/main.py @@ -7,7 +7,7 @@ from fastapi.templating import Jinja2Templates from fastapi.requests import Request from pydantic import json -from typing import Any, Annotated +from typing import Any, Annotated, List from starlette.staticfiles import StaticFiles import requests diff --git a/back/utils.py b/back/utils.py index 1b75c7b..175952c 100644 --- a/back/utils.py +++ b/back/utils.py @@ -12,14 +12,12 @@ from sqlalchemy import select from .db import Session, database from . import models, schemas -from .db import SessionLocal - SECRET_KEY = "SECRET" ALGORITHM = "HS256" ACCESS_TOKEN_EXPIRE_MINUTES = 30 pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto") -oauth2_scheme = OAuth2PasswordBearer(tokenUrl="/api/token") +oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token") def get_db(): @@ -30,14 +28,6 @@ def get_db(): db.close() -def get_db(): - db = SessionLocal() - try: - yield db - finally: - db.close() - - def verify_password(plain_password, hashed_password): return pwd_context.verify(plain_password, hashed_password) @@ -100,10 +90,3 @@ async def get_current_active_user( if current_user.disabled: raise HTTPException(status_code=400, detail="Inactive user") return current_user - -<<<<<<< HEAD -======= - -# def get_db(request: Request): -# return request.state.db ->>>>>>> 3e2555084388b8d23113ce4698714b993895142b