Skip to content

Commit

Permalink
delete emails
Browse files Browse the repository at this point in the history
  • Loading branch information
azliu0 committed Apr 15, 2024
1 parent 22369a4 commit 9de7ad5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion server/models/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ class Thread(db.Model):
resolved: Mapped[bool] = mapped_column(nullable=False, default=False)
last_email: Mapped[int] = mapped_column(nullable=False)

emails: Mapped[List[Email]] = relationship("Email", back_populates="thread")
emails: Mapped[List[Email]] = relationship(
"Email",
back_populates="thread",
default_factory=list,
cascade="all, delete-orphan",
)

@hybrid_property
def first_sender(self):
Expand Down

0 comments on commit 9de7ad5

Please sign in to comment.