Mbonea's picture
testing deployment
9e798a1
raw
history blame
1.1 kB
from pydantic import BaseModel, Field
from typing import Optional, List
from datetime import datetime
class BaseResponse(BaseModel):
code: int
message: str
payload: Optional[dict] = None
class CreateSubscriptionRequest(BaseModel):
user_id: str = Field(..., description="ID of the user to create subscription for")
plan_id: str = Field(..., description="ID of the plan to base the subscription on")
class UpdateUsageRequest(BaseModel):
download_mb: float = Field(0.0, ge=0, description="Download usage in megabytes")
upload_mb: float = Field(0.0, ge=0, description="Upload usage in megabytes")
class SubscriptionResponse(BaseModel):
id: str
user_id: str
plan_id: Optional[str]
active: bool
duration: int
download_mb: float
upload_mb: float
remaining_hours: float
created_time: datetime
expiration_time: datetime
class Config:
from_attributes = True
class SubscriptionListResponse(BaseModel):
subscriptions: List[SubscriptionResponse]
total_count: int
class Config:
from_attributes = True