15 lines
473 B
Python
15 lines
473 B
Python
from db.models import User
|
|
from db.session import UnitOfWork
|
|
from repositories.users import UserRepository
|
|
from schemas.jwt import ServiceJWTPayload
|
|
|
|
|
|
async def fetch_subject_from_service(payload: ServiceJWTPayload, uow: UnitOfWork) -> User | None:
|
|
repo = UserRepository(uow)
|
|
|
|
if payload.acting_as.startswith("telegram:"):
|
|
telegram_id = int(payload.acting_as.split("telegram:")[1])
|
|
return await repo.get_user_by_telegram_id(telegram_id)
|
|
|
|
return
|