Created boardgame class for DB
This commit is contained in:
parent
ec30a9c364
commit
5ee3f89647
1 changed files with 18 additions and 0 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
from pydantic import BaseModel, HttpUrl
|
from pydantic import BaseModel, HttpUrl
|
||||||
from datetime import date
|
from datetime import date
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
|
from sqlmodel import Field, SQLModel, Column, JSON
|
||||||
|
|
||||||
class BoardgameType(Enum):
|
class BoardgameType(Enum):
|
||||||
BOARDGAME = 'boardgame'
|
BOARDGAME = 'boardgame'
|
||||||
|
|
@ -26,6 +27,23 @@ class BoardGame(BaseModel):
|
||||||
all_expansion_ids: list[int]
|
all_expansion_ids: list[int]
|
||||||
type: BoardgameType = BoardgameType.BOARDGAME
|
type: BoardgameType = BoardgameType.BOARDGAME
|
||||||
|
|
||||||
|
|
||||||
|
class BoardGameTable(SQLModel, table=True):
|
||||||
|
id: int = Field(primary_key=True)
|
||||||
|
name: str
|
||||||
|
description: str
|
||||||
|
image_url : str
|
||||||
|
thumbnail_url : str
|
||||||
|
year_published: int
|
||||||
|
min_players: int
|
||||||
|
max_players: int
|
||||||
|
min_playing_time: int
|
||||||
|
max_playing_time: int
|
||||||
|
min_age: int
|
||||||
|
all_expansion_ids: list[int] = Field(sa_column=Column(JSON))
|
||||||
|
type: BoardgameType = BoardgameType.BOARDGAME
|
||||||
|
|
||||||
|
|
||||||
class BoardGameExpansion(BoardGame):
|
class BoardGameExpansion(BoardGame):
|
||||||
type: BoardgameType = BoardgameType.BOARDGAMEEXPANSION
|
type: BoardgameType = BoardgameType.BOARDGAMEEXPANSION
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue