42 lines
757 B
Python
42 lines
757 B
Python
from typing import Optional
|
|
|
|
from pydantic import BaseModel, EmailStr
|
|
|
|
|
|
# Shared properties
|
|
class PlayerBase(BaseModel):
|
|
firstname: Optional[str] = None
|
|
lastname: Optional[str] = None
|
|
|
|
|
|
# Properties to receive via API on creation
|
|
class PlayerCreate(PlayerBase):
|
|
firstname: str
|
|
lastname: str
|
|
|
|
|
|
class PlayerInDBBase(PlayerBase):
|
|
id: Optional[int] = None
|
|
|
|
class Config:
|
|
orm_mode = True
|
|
|
|
|
|
class PlayerUpdate(PlayerBase):
|
|
firstname: str
|
|
lastname: str
|
|
|
|
|
|
class PlayerUpdateTeam(PlayerBase):
|
|
team_id: Optional[int]
|
|
|
|
|
|
# Additional properties to return via API
|
|
class Player(PlayerInDBBase):
|
|
pass
|
|
|
|
|
|
# Additional properties stored in DB
|
|
class PlayerInDB(PlayerInDBBase):
|
|
pass
|