From 43e4dc287b291d467e527fb31550ac6b15240f7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=20Keskim=C3=A4ki?= Date: Wed, 16 Aug 2023 11:51:38 +0300 Subject: [PATCH] Fix few db queries using deprecated sequelize function --- controllers/topics.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/controllers/topics.js b/controllers/topics.js index dbad3c5..6a80ff6 100644 --- a/controllers/topics.js +++ b/controllers/topics.js @@ -41,7 +41,7 @@ topicsRouter.post('/:id/copy', async (req, res) => { order: [['createdAt', 'DESC']] }) - const from = await db.Topic.findById(req.params.id) + const from = await db.Topic.findByPk(req.params.id) const secret_id = getRandomId() @@ -134,7 +134,7 @@ topicsRouter.put( res.status(500).json({ error: 'Something is wrong... try reloading the page' }) }) } else { - db.Topic.findById(req.params.id) + db.Topic.findByPk(req.params.id) .then((topic) => { if (!topic) return res.status(400).json({ error: 'no topic with that id' })