Skip to content

Commit

Permalink
Add TypeAlias typing for dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
javadzarezadeh committed Nov 18, 2024
1 parent e345273 commit 4829b63
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions backend/app/api/deps.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from collections.abc import Generator
from typing import Annotated
from typing import Annotated, TypeAlias

import jwt
from fastapi import Depends, HTTPException, status
Expand All @@ -23,8 +23,8 @@ def get_db() -> Generator[Session, None, None]:
yield session


SessionDep = Annotated[Session, Depends(get_db)]
TokenDep = Annotated[str, Depends(reusable_oauth2)]
SessionDep : TypeAlias = Annotated[Session, Depends(get_db)]
TokenDep : TypeAlias = Annotated[str, Depends(reusable_oauth2)]


def get_current_user(session: SessionDep, token: TokenDep) -> User:
Expand All @@ -46,7 +46,7 @@ def get_current_user(session: SessionDep, token: TokenDep) -> User:
return user


CurrentUser = Annotated[User, Depends(get_current_user)]
CurrentUser : TypeAlias = Annotated[User, Depends(get_current_user)]


def get_current_active_superuser(current_user: CurrentUser) -> User:
Expand Down

0 comments on commit 4829b63

Please sign in to comment.