Files
game-marathon/backend/app/schemas/game.py

43 lines
964 B
Python
Raw Normal View History

2025-12-14 02:38:35 +07:00
from datetime import datetime
from pydantic import BaseModel, Field, HttpUrl
from app.schemas.user import UserPublic
class GameBase(BaseModel):
title: str = Field(..., min_length=1, max_length=100)
download_url: str = Field(..., min_length=1)
genre: str | None = Field(None, max_length=50)
class GameCreate(GameBase):
cover_url: str | None = None
class GameUpdate(BaseModel):
title: str | None = Field(None, min_length=1, max_length=100)
download_url: str | None = None
genre: str | None = None
class GameShort(BaseModel):
id: int
title: str
cover_url: str | None = None
class Config:
from_attributes = True
class GameResponse(GameBase):
id: int
cover_url: str | None = None
2025-12-14 20:21:56 +07:00
status: str = "pending"
proposed_by: UserPublic | None = None
approved_by: UserPublic | None = None
2025-12-14 02:38:35 +07:00
challenges_count: int = 0
created_at: datetime
class Config:
from_attributes = True