rankora-api / app /utils /user_response.py
Shoaib898's picture
Deploy Rankora API with Stripe billing
139f568
Raw
History Blame Contribute Delete
349 Bytes
"""Serialize users for API responses."""
from app.models.user import User
from app.schemas.user import UserResponse
from app.services.billing.plans import is_paid_plan
def to_user_response(user: User) -> UserResponse:
base = UserResponse.model_validate(user)
return base.model_copy(update={"subscription_active": is_paid_plan(user.plan)})