SessionLocal ->Session

This commit is contained in:
DmitryGantimurov 2023-07-27 20:17:37 +03:00
parent bd7d4f3c5d
commit b37443b862

View File

@ -32,7 +32,7 @@ def get_password_hash(password):
# проблема здесь
def get_user(db: SessionLocal, email: str):
def get_user(db: Session, email: str):
user_with_required_email = db.query(UserDatabase).filter(UserDatabase.email == email).one()
if user_with_required_email:
return user_with_required_email
@ -59,7 +59,7 @@ def create_access_token(data: dict, expires_delta: Union[timedelta, None] = None
return encoded_jwt
async def get_current_user(db: SessionLocal, token: Annotated[str, Depends(oauth2_scheme)]):
async def get_current_user(db: Session, token: Annotated[str, Depends(oauth2_scheme)]):
credentials_exception = HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED,
detail="Could not validate credentials",