فهرست منبع

Delete posts (apparently cascade was not working)

sbkwgh 7 سال پیش
والد
کامیت
ff9ccf98c1
1فایلهای تغییر یافته به همراه1 افزوده شده و 0 حذف شده
  1. 1 0
      routes/thread.js

+ 1 - 0
routes/thread.js

@@ -137,6 +137,7 @@ router.delete('/:thread_id', async (req, res) => {
 			let destroyPromises = reports.map(report => report.destroy())
 
 			await Promise.all(destroyPromises)
+			await Post.destroy({ where: { ThreadId: thread.id } })
 			await thread.destroy()
 
 			res.json({ success: true })