wip
This commit is contained in:
parent
6b1c60a550
commit
839cbd0dc0
17 changed files with 213 additions and 35 deletions
|
|
@ -6,8 +6,7 @@ from learn_sql_model.models.fast_model import FastModel
|
|||
from learn_sql_model.models.pet import Pet
|
||||
|
||||
|
||||
class Hero(FastModel, table=True):
|
||||
id: Optional[int] = Field(default=None, primary_key=True)
|
||||
class HeroBase(FastModel, table=False):
|
||||
name: str
|
||||
secret_name: str
|
||||
age: Optional[int] = None
|
||||
|
|
@ -15,3 +14,23 @@ class Hero(FastModel, table=True):
|
|||
|
||||
pet_id: Optional[int] = Field(default=None, foreign_key="pet.id")
|
||||
pet: Optional[Pet] = Relationship(back_populates="hero")
|
||||
|
||||
|
||||
class Hero(HeroBase, table=True):
|
||||
id: Optional[int] = Field(default=None, primary_key=True)
|
||||
|
||||
|
||||
class HeroCreate(HeroBase):
|
||||
...
|
||||
|
||||
|
||||
class HeroRead(HeroBase):
|
||||
id: Optional[int] = Field(default=None, primary_key=True)
|
||||
|
||||
|
||||
class HeroUpdate(HeroBase):
|
||||
...
|
||||
|
||||
|
||||
class HeroDelete(HeroBase):
|
||||
id: Optional[int] = Field(default=None, primary_key=True)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue