This commit is contained in:
2025-12-14 02:38:35 +07:00
commit 5343a8f2c3
84 changed files with 7406 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
from datetime import datetime
from pydantic import BaseModel, Field
from app.models.challenge import ChallengeType, Difficulty, ProofType
from app.schemas.game import GameShort
class ChallengeBase(BaseModel):
title: str = Field(..., min_length=1, max_length=100)
description: str = Field(..., min_length=1)
type: ChallengeType
difficulty: Difficulty
points: int = Field(..., ge=1, le=500)
estimated_time: int | None = Field(None, ge=1) # minutes
proof_type: ProofType
proof_hint: str | None = None
class ChallengeCreate(ChallengeBase):
pass
class ChallengeUpdate(BaseModel):
title: str | None = Field(None, min_length=1, max_length=100)
description: str | None = None
type: ChallengeType | None = None
difficulty: Difficulty | None = None
points: int | None = Field(None, ge=1, le=500)
estimated_time: int | None = None
proof_type: ProofType | None = None
proof_hint: str | None = None
class ChallengeResponse(ChallengeBase):
id: int
game: GameShort
is_generated: bool
created_at: datetime
class Config:
from_attributes = True
class ChallengeGenerated(BaseModel):
"""Schema for GPT-generated challenges"""
title: str
description: str
type: str
difficulty: str
points: int
estimated_time: int | None = None
proof_type: str
proof_hint: str | None = None