fix: data loading after login fixed
This commit is contained in:
@@ -6,6 +6,7 @@ from sqlalchemy.ext.asyncio import AsyncSession
|
||||
from backend.session import get_session
|
||||
from backend.wms_session import get_wms_session
|
||||
from models import User
|
||||
from schemas.auth import UserUnion
|
||||
from schemas.base import PaginationSchema
|
||||
from services.auth import get_current_user, authorized_user, guest_user
|
||||
from utils.dependecies import pagination_parameters
|
||||
@@ -13,6 +14,6 @@ from utils.dependecies import pagination_parameters
|
||||
SessionDependency = Annotated[AsyncSession, Depends(get_session)]
|
||||
WmsSessionDependency = Annotated[AsyncSession, Depends(get_wms_session)]
|
||||
PaginationDependency = Annotated[PaginationSchema, Depends(pagination_parameters)]
|
||||
CurrentUserDependency = Annotated[User, Depends(get_current_user)]
|
||||
CurrentUserDependency = Annotated[UserUnion, Depends(get_current_user)]
|
||||
AuthorizedUserDependency = Annotated[User, Depends(authorized_user)]
|
||||
GuestUserDependency = Annotated[User, Depends(guest_user)]
|
||||
|
||||
@@ -123,7 +123,6 @@ async def get_all(
|
||||
'/get/{card_id}',
|
||||
response_model=CardSchema,
|
||||
operation_id='getCardById',
|
||||
dependencies=[Depends(guest_user)]
|
||||
)
|
||||
async def get_card_by_id(
|
||||
card_id: int,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from datetime import datetime
|
||||
from typing import Union, Annotated
|
||||
from typing import Annotated
|
||||
|
||||
from fastapi import Depends, HTTPException
|
||||
from fastapi.security import HTTPBearer, HTTPAuthorizationCredentials
|
||||
@@ -12,8 +12,7 @@ import backend.config
|
||||
import constants
|
||||
from backend.session import get_session
|
||||
from constants import DEALS_VIEWER, DEAL_EDITOR
|
||||
from enums.user import UserRole
|
||||
from models import User, InviteCode
|
||||
from models import InviteCode
|
||||
from schemas.auth import *
|
||||
from services.base import BaseService
|
||||
|
||||
@@ -24,7 +23,7 @@ algorithm = 'HS256'
|
||||
async def get_current_user(
|
||||
session: Annotated[AsyncSession, Depends(get_session)],
|
||||
token: Annotated[HTTPAuthorizationCredentials, Depends(oauth2_schema)]
|
||||
) -> Optional[UserUnion]:
|
||||
) -> UserUnion:
|
||||
if not token.credentials:
|
||||
raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail='Invalid token')
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user