feat(/me): subscription data + rw controls
This commit is contained in:
5
schemas/common.py
Normal file
5
schemas/common.py
Normal file
@@ -0,0 +1,5 @@
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class OperationData(BaseModel):
|
||||
success: bool = Field(False)
|
||||
8
schemas/devices.py
Normal file
8
schemas/devices.py
Normal file
@@ -0,0 +1,8 @@
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class Device(BaseModel):
|
||||
os: str | None = Field(None)
|
||||
model: str | None = Field(None)
|
||||
client: str | None = Field(None)
|
||||
hwid: str = Field()
|
||||
@@ -1,16 +1,21 @@
|
||||
from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
from pydantic import BaseModel, Field, computed_field
|
||||
|
||||
|
||||
class SubscriptionData(BaseModel):
|
||||
devices: int = Field()
|
||||
expires_at: datetime = Field()
|
||||
addon_ids: list[str] = Field()
|
||||
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)
|
||||
subscription: SubscriptionData | None = Field(None)
|
||||
referal_code: str = Field()
|
||||
|
||||
Reference in New Issue
Block a user