wip
This commit is contained in:
parent
839cbd0dc0
commit
a9ee4a2bd8
7 changed files with 199 additions and 31 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue