delete users and tasks when session was deleted
This commit is contained in:
parent
f2d29a9523
commit
1d7f87a7a0
|
@ -10,9 +10,9 @@ class Session(db.Model):
|
||||||
name: Mapped[str] = mapped_column(unique=True)
|
name: Mapped[str] = mapped_column(unique=True)
|
||||||
|
|
||||||
authorized: Mapped[bool]
|
authorized: Mapped[bool]
|
||||||
users: Mapped[List[User]] = relationship("User", back_populates="session")
|
users: Mapped[List[User]] = relationship("User", cascade="all, delete-orphan", back_populates="session")
|
||||||
|
|
||||||
tasks: Mapped[List[Task]] = relationship("Task", back_populates="session")
|
tasks: Mapped[List[Task]] = relationship("Task", cascade="all, delete-orphan", back_populates="session")
|
||||||
|
|
||||||
def has_depending_tasks(self):
|
def has_depending_tasks(self):
|
||||||
tasks = Task.query \
|
tasks = Task.query \
|
||||||
|
|
Loading…
Reference in New Issue