initial
This commit is contained in:
40
backend/app/schemas/game.py
Normal file
40
backend/app/schemas/game.py
Normal file
@@ -0,0 +1,40 @@
|
||||
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
|
||||
added_by: UserPublic | None = None
|
||||
challenges_count: int = 0
|
||||
created_at: datetime
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
Reference in New Issue
Block a user