- 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
42 lines
851 B
Python
42 lines
851 B
Python
from datetime import datetime
|
|
|
|
from pydantic import BaseModel, ConfigDict
|
|
|
|
|
|
class ServerRead(BaseModel):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
id: int
|
|
name: str
|
|
host: str
|
|
port: int
|
|
protocol: str
|
|
location: str
|
|
country_code: str
|
|
load_percent: int = 0
|
|
is_active: bool = True
|
|
max_users: int = 100
|
|
created_at: datetime
|
|
|
|
|
|
class ServerCreate(BaseModel):
|
|
name: str
|
|
host: str
|
|
port: int
|
|
protocol: str
|
|
location: str
|
|
country_code: str
|
|
max_users: int = 100
|
|
|
|
|
|
class ServerUpdate(BaseModel):
|
|
name: str | None = None
|
|
host: str | None = None
|
|
port: int | None = None
|
|
protocol: str | None = None
|
|
location: str | None = None
|
|
country_code: str | None = None
|
|
load_percent: int | None = None
|
|
is_active: bool | None = None
|
|
max_users: int | None = None
|