File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ class User(UserBase, table=True):
4545 id : uuid .UUID = Field (default_factory = uuid .uuid4 , primary_key = True )
4646 hashed_password : str
4747 items : list ["Item" ] = Relationship (back_populates = "owner" , cascade_delete = True )
48+ posts : list ["Post" ] = Relationship (back_populates = "owner" , cascade_delete = True )
4849
4950
5051# Properties to return via API, id is always required
@@ -139,8 +140,7 @@ class PostUpdate(SQLModel):
139140class Post (PostBase , table = True ):
140141 id : uuid .UUID = Field (default_factory = uuid .uuid4 , primary_key = True )
141142 user_id : uuid .UUID = Field (foreign_key = "user.id" , nullable = False , ondelete = "CASCADE" )
142- user : Optional ["User" ] = Relationship (back_populates = "posts" )
143-
143+ owner : User | None = Relationship (back_populates = "posts" )
144144
145145# Properties to return via API
146146class PostPublic (PostBase ):
You can’t perform that action at this time.
0 commit comments