Update GPT and add Profile

This commit is contained in:
2025-12-16 22:12:12 +07:00
parent 08b96fd1f7
commit 696dc714c4
15 changed files with 1063 additions and 90 deletions

View File

@@ -6,6 +6,9 @@ from app.schemas.user import (
UserWithTelegram,
TokenResponse,
TelegramLink,
PasswordChange,
UserStats,
UserProfilePublic,
)
from app.schemas.marathon import (
MarathonCreate,
@@ -87,6 +90,9 @@ __all__ = [
"UserWithTelegram",
"TokenResponse",
"TelegramLink",
"PasswordChange",
"UserStats",
"UserProfilePublic",
# Marathon
"MarathonCreate",
"MarathonUpdate",

View File

@@ -58,3 +58,28 @@ class TokenResponse(BaseModel):
class TelegramLink(BaseModel):
telegram_id: int
telegram_username: str | None = None
class PasswordChange(BaseModel):
current_password: str = Field(..., min_length=6)
new_password: str = Field(..., min_length=6, max_length=100)
class UserStats(BaseModel):
"""Статистика пользователя по марафонам"""
marathons_count: int
wins_count: int
completed_assignments: int
total_points_earned: int
class UserProfilePublic(BaseModel):
"""Публичный профиль пользователя со статистикой"""
id: int
nickname: str
avatar_url: str | None = None
created_at: datetime
stats: UserStats
class Config:
from_attributes = True