2024-08-24 17:39:13 +02:00
|
|
|
from sqlmodel import SQLModel, Field, Relationship
|
2024-08-24 18:13:32 +02:00
|
|
|
from src.classes.play_classes import PlayPlayer, PlayPlayerPublicNoPlayer
|
2024-08-24 17:39:13 +02:00
|
|
|
|
2024-08-24 18:13:32 +02:00
|
|
|
class PlayerBase(SQLModel):
|
|
|
|
|
name: str
|
|
|
|
|
|
|
|
|
|
class Player(PlayerBase, table=True):
|
2024-08-24 17:39:13 +02:00
|
|
|
name: str | None = Field(default=None, primary_key=True)
|
|
|
|
|
|
|
|
|
|
playplayers: list[PlayPlayer] = Relationship(back_populates="player")
|
|
|
|
|
|
|
|
|
|
|
2024-08-24 18:13:32 +02:00
|
|
|
class PlayerPublic(PlayerBase):
|
|
|
|
|
playplayers: list[PlayPlayerPublicNoPlayer]
|
2024-08-24 17:39:13 +02:00
|
|
|
|
2024-08-24 18:13:32 +02:00
|
|
|
class PlayerPublicNoPlayPlayers(PlayerBase):
|
|
|
|
|
pass
|