Files
malenia-backend/schemas/user.py

22 lines
618 B
Python

from datetime import datetime
from pydantic import BaseModel, Field, computed_field
class SubscriptionData(BaseModel):
devices: int | None = Field(None)
expires_at: datetime | None = Field(None)
addon_ids: list[str] = Field(default_factory=list)
subscription_link: str | None = Field(None)
@property
@computed_field
def has_subscription(self) -> bool:
return all([self.devices, self.expires_at, self.subscription_link, self.addon_ids])
class UserInfo(BaseModel):
username: str | None = Field(None)
telegram_id: str | None = Field(None)
referal_code: str = Field()