1
0

fix(project): delete all related entities when deleting a project

This commit is contained in:
kolaente
2024-04-13 21:43:44 +02:00
parent ce1d7778c7
commit e9de7d8a24
2 changed files with 52 additions and 0 deletions

View File

@ -1486,6 +1486,18 @@ func (t *Task) Delete(s *xorm.Session, a web.Auth) (err error) {
return
}
// Delete all positions
_, err = s.Where("task_id = ?", t.ID).Delete(&TaskPosition{})
if err != nil {
return
}
// Delete all bucket relations
_, err = s.Where("task_id = ?", t.ID).Delete(&TaskBucket{})
if err != nil {
return
}
// Actually delete the task
_, err = s.ID(t.ID).Delete(Task{})
if err != nil {