SessionLocal ->Session
This commit is contained in:
parent
bd7d4f3c5d
commit
b37443b862
@ -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()
|
user_with_required_email = db.query(UserDatabase).filter(UserDatabase.email == email).one()
|
||||||
if user_with_required_email:
|
if user_with_required_email:
|
||||||
return 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
|
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(
|
credentials_exception = HTTPException(
|
||||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||||
detail="Could not validate credentials",
|
detail="Could not validate credentials",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user