feat(sub): handling upgrade/downgrade
rw integration and /me endpoints are left
This commit is contained in:
@@ -6,6 +6,7 @@ from core.auth import jwt
|
||||
from db.session import get_db
|
||||
from external.pally import PallyClient
|
||||
from schemas.dto import AuthContext
|
||||
from services.subscriptions import sync_user_subscription
|
||||
|
||||
|
||||
async def get_auth_context(
|
||||
@@ -18,7 +19,10 @@ async def get_auth_context(
|
||||
|
||||
if auth.startswith("Bearer"):
|
||||
token = auth.removeprefix("Bearer ").strip()
|
||||
return await jwt.authorize(token, session)
|
||||
ctx = await jwt.authorize(token, session)
|
||||
await sync_user_subscription(session, user=ctx.user)
|
||||
await session.commit()
|
||||
return ctx
|
||||
|
||||
|
||||
def get_pally_client() -> PallyClient:
|
||||
|
||||
Reference in New Issue
Block a user