Добавлена поддержка обмена играми с типом прохождения (playthrough)

- Обновлены схемы SwapCandidate и SwapRequestChallengeInfo для поддержки прохождений
- get_swap_candidates теперь возвращает и челленджи, и прохождения
- accept_swap_request теперь корректно меняет challenge_id, game_id, is_playthrough и bonus_assignments
- Обновлён UI для отображения прохождений в списке кандидатов и запросах обмена

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-21 15:56:34 +03:00
parent 58c390c768
commit 9f79daf796
4 changed files with 192 additions and 59 deletions

View File

@@ -128,10 +128,16 @@ class SwapCandidate(BaseModel):
"""Participant available for assignment swap"""
participant_id: int
user: UserPublic
challenge_title: str
challenge_description: str
challenge_points: int
challenge_difficulty: str
is_playthrough: bool = False
# Challenge fields (used when is_playthrough=False)
challenge_title: str | None = None
challenge_description: str | None = None
challenge_points: int | None = None
challenge_difficulty: str | None = None
# Playthrough fields (used when is_playthrough=True)
playthrough_description: str | None = None
playthrough_points: int | None = None
# Common field
game_title: str
@@ -145,11 +151,17 @@ class SwapRequestCreate(BaseModel):
class SwapRequestChallengeInfo(BaseModel):
"""Challenge info for swap request display"""
title: str
description: str
points: int
difficulty: str
"""Challenge or playthrough info for swap request display"""
is_playthrough: bool = False
# Challenge fields (used when is_playthrough=False)
title: str | None = None
description: str | None = None
points: int | None = None
difficulty: str | None = None
# Playthrough fields (used when is_playthrough=True)
playthrough_description: str | None = None
playthrough_points: int | None = None
# Common field
game_title: str