This commit is contained in:
Waylon Walker 2023-06-06 11:50:49 -05:00
parent 839cbd0dc0
commit a9ee4a2bd8
No known key found for this signature in database
GPG key ID: 66E2BF2B4190EFE4
7 changed files with 199 additions and 31 deletions

View file

@ -9,8 +9,27 @@ if TYPE_CHECKING:
from learn_sql_model.models.hero import Hero
class Pet(FastModel, table=True):
id: Optional[int] = Field(default=None, primary_key=True)
class PetBase(FastModel, table=False):
name: str = "Jim"
birthday: Optional[datetime] = None
hero: "Hero" = Relationship(back_populates="pet")
class Pet(PetBase, table=True):
id: Optional[int] = Field(default=None, primary_key=True)
class PetCreate(PetBase):
...
class PetRead(PetBase):
id: int
class PetUpdate(PetBase):
...
class PetDelete(PetBase):
id: int