- FastAPI REST API with JWT auth - aiogram 3 Telegram bot with admin middleware - APScheduler daily tasks (expiry, reminders, revoke, sync) - SQLAlchemy 2 async ORM with Alembic migrations - Jinja2 admin panel (Dashboard, Users, Payments, Servers, Tariffs) - VPN provider abstraction with MockProvider - Stats service with revenue/subscription analytics - Docker Compose (PostgreSQL + Redis + app) - Healthcheck endpoint
32 lines
618 B
Python
32 lines
618 B
Python
from datetime import datetime
|
|
|
|
from pydantic import BaseModel, ConfigDict
|
|
|
|
|
|
class PaymentRead(BaseModel):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
id: int
|
|
user_id: int
|
|
tariff_id: int
|
|
amount: float
|
|
currency: str = "RUB"
|
|
status: str
|
|
provider: str
|
|
external_id: str | None = None
|
|
created_at: datetime
|
|
paid_at: datetime | None = None
|
|
|
|
|
|
class PaymentCreate(BaseModel):
|
|
user_id: int
|
|
tariff_id: int
|
|
provider: str
|
|
amount: float
|
|
currency: str = "RUB"
|
|
external_id: str | None = None
|
|
|
|
|
|
class PaymentConfirm(BaseModel):
|
|
external_id: str | None = None
|